MCPcopy Create free account
hub / github.com/chokcoco/iCSS / ProjectSetup

Class ProjectSetup

MCP/setup.js:10–99  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

8const __dirname = path.dirname(__filename);
9
10class ProjectSetup {
11 constructor() {
12 this.projectRoot = __dirname;
13 this.dataDir = path.join(this.projectRoot, 'data');
14 }
15
16 async setup() {
17 console.log('🚀 Setting up iCSS MCP Server...\n');
18
19 // 1. 创建必要的目录
20 this.createDirectories();
21
22 // 2. 创建环境变量文件
23 this.createEnvFile();
24
25 // 3. 显示下一步指令
26 this.showNextSteps();
27 }
28
29 createDirectories() {
30 console.log('📁 Creating necessary directories...');
31
32 const directories = [
33 this.dataDir
34 ];
35
36 directories.forEach(dir => {
37 if (!fs.existsSync(dir)) {
38 fs.mkdirSync(dir, { recursive: true });
39 console.log(` ✅ Created: ${path.relative(this.projectRoot, dir)}`);
40 } else {
41 console.log(` ℹ️ Already exists: ${path.relative(this.projectRoot, dir)}`);
42 }
43 });
44 }
45
46 createEnvFile() {
47 console.log('\n🔧 Creating environment configuration...');
48
49 const envPath = path.join(this.projectRoot, '.env');
50 const envExampleContent = `
51 # GitHub API Configuration (Optional - for higher rate limits)
52 # Get your token from: https://github.com/settings/tokens
53 GITHUB_TOKEN=your_github_token_here
54
55 # Server Configuration
56 NODE_ENV=production
57 PORT=3000
58
59 # Database Configuration
60 DB_PATH=./data/icss.db
61 `;
62
63 if (!fs.existsSync(envPath)) {
64 fs.writeFileSync(envPath, envExampleContent);
65 console.log(' ✅ Created .env file');
66 } else {
67 console.log(' ℹ️ .env file already exists');

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected