claude-autopm 1.13.4 → 1.13.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/scripts/mcp-handler.js +22 -17
package/package.json
CHANGED
package/scripts/mcp-handler.js
CHANGED
|
@@ -228,35 +228,39 @@ class MCPHandler {
|
|
|
228
228
|
const config = this.loadConfig();
|
|
229
229
|
const activeServers = config.mcp?.activeServers || [];
|
|
230
230
|
|
|
231
|
-
// Ensure .claude directory exists
|
|
231
|
+
// Ensure .claude directory exists
|
|
232
232
|
this.ensureClaudeDir();
|
|
233
233
|
|
|
234
|
+
// Read existing mcp-servers.json to preserve all servers
|
|
235
|
+
let existingMcpConfig = { mcpServers: {}, contextPools: {}, documentationSources: {} };
|
|
236
|
+
if (fs.existsSync(this.mcpServersPath)) {
|
|
237
|
+
try {
|
|
238
|
+
const content = fs.readFileSync(this.mcpServersPath, 'utf8');
|
|
239
|
+
existingMcpConfig = JSON.parse(content);
|
|
240
|
+
} catch (error) {
|
|
241
|
+
console.log('⚠️ Could not read existing mcp-servers.json, creating new');
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
|
|
234
245
|
if (activeServers.length === 0) {
|
|
235
|
-
console.log('ℹ️ No active servers
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
mcpServers: {},
|
|
239
|
-
contextPools: config.mcp?.contextPools || {},
|
|
240
|
-
documentationSources: config.mcp?.documentationSources || {}
|
|
241
|
-
};
|
|
242
|
-
fs.writeFileSync(
|
|
243
|
-
this.mcpServersPath,
|
|
244
|
-
JSON.stringify(emptyConfig, null, 2)
|
|
245
|
-
);
|
|
246
|
+
console.log('ℹ️ No active servers in config.json');
|
|
247
|
+
console.log('💡 Preserving existing servers in mcp-servers.json');
|
|
248
|
+
console.log(`📊 Existing servers: ${Object.keys(existingMcpConfig.mcpServers).length}`);
|
|
246
249
|
return;
|
|
247
250
|
}
|
|
248
251
|
|
|
252
|
+
// Start with existing configuration
|
|
249
253
|
const mcpConfig = {
|
|
250
|
-
mcpServers: {},
|
|
251
|
-
contextPools:
|
|
252
|
-
documentationSources:
|
|
254
|
+
mcpServers: existingMcpConfig.mcpServers || {},
|
|
255
|
+
contextPools: existingMcpConfig.contextPools || {},
|
|
256
|
+
documentationSources: existingMcpConfig.documentationSources || {}
|
|
253
257
|
};
|
|
254
258
|
|
|
255
|
-
//
|
|
259
|
+
// Update active servers from registry
|
|
256
260
|
activeServers.forEach(serverName => {
|
|
257
261
|
const server = this.getServer(serverName);
|
|
258
262
|
if (!server) {
|
|
259
|
-
console.log(` ⚠️ Server '${serverName}' not found, skipping`);
|
|
263
|
+
console.log(` ⚠️ Server '${serverName}' not found in registry, skipping`);
|
|
260
264
|
return;
|
|
261
265
|
}
|
|
262
266
|
|
|
@@ -278,6 +282,7 @@ class MCPHandler {
|
|
|
278
282
|
|
|
279
283
|
console.log(`\n✅ Configuration synced to ${this.mcpServersPath}`);
|
|
280
284
|
console.log(`📊 Active servers: ${activeServers.length}`);
|
|
285
|
+
console.log(`📦 Total servers in file: ${Object.keys(mcpConfig.mcpServers).length}`);
|
|
281
286
|
}
|
|
282
287
|
|
|
283
288
|
/**
|