| 79 | |
| 80 | // 测试MCP SDK导入 |
| 81 | function testMCPSDK() { |
| 82 | console.log('\n3️⃣ Testing MCP SDK...'); |
| 83 | |
| 84 | try { |
| 85 | import('@modelcontextprotocol/sdk/server/index.js').then(() => { |
| 86 | console.log('✅ MCP SDK imported successfully'); |
| 87 | console.log('\n🎉 All tests passed! The server should work correctly.\n'); |
| 88 | |
| 89 | console.log('📋 Next steps:'); |
| 90 | console.log('1. Make sure Cursor MCP configuration is correct'); |
| 91 | console.log('2. Check Cursor logs for any connection issues'); |
| 92 | console.log('3. Restart Cursor after configuration changes'); |
| 93 | |
| 94 | console.log('\n🔧 Cursor Configuration:'); |
| 95 | console.log('File: ~/.config/cursor/mcp_settings.json'); |
| 96 | console.log('Content:'); |
| 97 | console.log(JSON.stringify({ |
| 98 | mcpServers: { |
| 99 | icss: { |
| 100 | command: "node", |
| 101 | args: [process.cwd() + "/server.js"], |
| 102 | env: {} |
| 103 | } |
| 104 | } |
| 105 | }, null, 2)); |
| 106 | }).catch(err => { |
| 107 | console.error('❌ MCP SDK import failed:', err.message); |
| 108 | console.log('\n💡 Try reinstalling dependencies: npm install'); |
| 109 | }); |
| 110 | } catch (err) { |
| 111 | console.error('❌ MCP SDK test failed:', err.message); |
| 112 | } |
| 113 | } |
| 114 | |
| 115 | // 运行测试 |
| 116 | testDatabase() |