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

Function generateCorrectConfig

MCP/diagnose-mcp.js:136–187  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

134
135// 生成正确的配置
136function generateCorrectConfig() {
137 console.log('\n4️⃣ Generating Correct Configuration:\n');
138
139 const serverPath = path.resolve('./server.js');
140 const configs = [
141 {
142 path: process.env.HOME + '/.config/cursor/mcp_settings.json',
143 content: {
144 mcpServers: {
145 icss: {
146 command: "node",
147 args: [serverPath],
148 env: {}
149 }
150 }
151 }
152 },
153 {
154 path: process.env.HOME + '/Library/Application Support/Cursor/mcp_settings.json',
155 content: {
156 mcpServers: {
157 icss: {
158 command: "node",
159 args: [serverPath],
160 env: {}
161 }
162 }
163 }
164 }
165 ];
166
167 configs.forEach((config, index) => {
168 console.log(` 📝 Config ${index + 1}: ${config.path}`);
169
170 // 确保目录存在
171 const dir = path.dirname(config.path);
172 if (!fs.existsSync(dir)) {
173 fs.mkdirSync(dir, { recursive: true });
174 console.log(` ✅ Created directory: ${dir}`);
175 }
176
177 // 写入配置
178 try {
179 fs.writeFileSync(config.path, JSON.stringify(config.content, null, 2));
180 console.log(` ✅ Written configuration`);
181 } catch (err) {
182 console.log(` ❌ Failed to write: ${err.message}`);
183 }
184 });
185
186 console.log('\n 💡 Try both locations and restart Cursor completely');
187}
188
189// 提供故障排除建议
190function provideTroubleshootingTips() {

Callers 1

runDiagnosisFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected