| 8 | |
| 9 | // 检查所有可能的 Cursor MCP 配置位置 |
| 10 | function checkCursorConfigs() { |
| 11 | console.log('1️⃣ Checking Cursor MCP Configuration Locations:\n'); |
| 12 | |
| 13 | const possiblePaths = [ |
| 14 | '~/.config/cursor/mcp_settings.json', |
| 15 | '~/Library/Application Support/Cursor/mcp_settings.json', |
| 16 | '~/.cursor/mcp_settings.json', |
| 17 | process.env.HOME + '/.config/cursor/mcp_settings.json', |
| 18 | process.env.HOME + '/Library/Application Support/Cursor/mcp_settings.json' |
| 19 | ]; |
| 20 | |
| 21 | let foundConfigs = 0; |
| 22 | |
| 23 | possiblePaths.forEach(configPath => { |
| 24 | const expandedPath = configPath.startsWith('~') ? |
| 25 | configPath.replace('~', process.env.HOME) : configPath; |
| 26 | |
| 27 | if (fs.existsSync(expandedPath)) { |
| 28 | foundConfigs++; |
| 29 | console.log(` ✅ Found: ${configPath}`); |
| 30 | try { |
| 31 | const content = fs.readFileSync(expandedPath, 'utf8'); |
| 32 | const config = JSON.parse(content); |
| 33 | console.log(` Servers: ${Object.keys(config.mcpServers || {}).join(', ')}`); |
| 34 | } catch (err) { |
| 35 | console.log(` ❌ Invalid JSON: ${err.message}`); |
| 36 | } |
| 37 | } else { |
| 38 | console.log(` ❌ Not found: ${configPath}`); |
| 39 | } |
| 40 | }); |
| 41 | |
| 42 | if (foundConfigs === 0) { |
| 43 | console.log('\n ⚠️ No MCP configuration files found!'); |
| 44 | } |
| 45 | |
| 46 | return foundConfigs > 0; |
| 47 | } |
| 48 | |
| 49 | // 检查服务器可执行性 |
| 50 | function checkServerExecutability() { |