claude-autopm 1.13.5 → 1.13.7
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 +52 -2
package/package.json
CHANGED
package/scripts/mcp-handler.js
CHANGED
|
@@ -264,23 +264,37 @@ class MCPHandler {
|
|
|
264
264
|
return;
|
|
265
265
|
}
|
|
266
266
|
|
|
267
|
+
// Convert env metadata to simple strings for Claude Code compatibility
|
|
268
|
+
const envVars = this._convertEnvMetadataToStrings(server.metadata.env);
|
|
269
|
+
|
|
267
270
|
mcpConfig.mcpServers[serverName] = {
|
|
268
271
|
command: server.metadata.command,
|
|
269
272
|
args: server.metadata.args,
|
|
270
|
-
env:
|
|
273
|
+
env: envVars,
|
|
271
274
|
envFile: server.metadata.envFile
|
|
272
275
|
};
|
|
273
276
|
|
|
274
277
|
console.log(` ✅ Synced: ${serverName}`);
|
|
275
278
|
});
|
|
276
279
|
|
|
277
|
-
// Write configuration
|
|
280
|
+
// Write configuration to .claude/mcp-servers.json (AutoPM format)
|
|
278
281
|
fs.writeFileSync(
|
|
279
282
|
this.mcpServersPath,
|
|
280
283
|
JSON.stringify(mcpConfig, null, 2)
|
|
281
284
|
);
|
|
282
285
|
|
|
286
|
+
// Write configuration to .mcp.json (Claude Code format)
|
|
287
|
+
const claudeCodeMcpPath = path.join(this.projectRoot, '.mcp.json');
|
|
288
|
+
const claudeCodeConfig = {
|
|
289
|
+
mcpServers: mcpConfig.mcpServers
|
|
290
|
+
};
|
|
291
|
+
fs.writeFileSync(
|
|
292
|
+
claudeCodeMcpPath,
|
|
293
|
+
JSON.stringify(claudeCodeConfig, null, 2)
|
|
294
|
+
);
|
|
295
|
+
|
|
283
296
|
console.log(`\n✅ Configuration synced to ${this.mcpServersPath}`);
|
|
297
|
+
console.log(`✅ Claude Code config synced to ${claudeCodeMcpPath}`);
|
|
284
298
|
console.log(`📊 Active servers: ${activeServers.length}`);
|
|
285
299
|
console.log(`📦 Total servers in file: ${Object.keys(mcpConfig.mcpServers).length}`);
|
|
286
300
|
}
|
|
@@ -1249,6 +1263,42 @@ This server can be integrated with various agents and context pools.
|
|
|
1249
1263
|
return defaultValue !== '';
|
|
1250
1264
|
}
|
|
1251
1265
|
|
|
1266
|
+
/**
|
|
1267
|
+
* Convert env metadata objects to simple string format for Claude Code
|
|
1268
|
+
* @private
|
|
1269
|
+
* @param {Object} envObj - Environment variables object (may contain metadata)
|
|
1270
|
+
* @returns {Object} Environment variables as simple strings
|
|
1271
|
+
*/
|
|
1272
|
+
_convertEnvMetadataToStrings(envObj) {
|
|
1273
|
+
if (!envObj) return {};
|
|
1274
|
+
|
|
1275
|
+
const converted = {};
|
|
1276
|
+
|
|
1277
|
+
Object.entries(envObj).forEach(([key, value]) => {
|
|
1278
|
+
// If value is already a string, keep it
|
|
1279
|
+
if (typeof value === 'string') {
|
|
1280
|
+
converted[key] = value;
|
|
1281
|
+
}
|
|
1282
|
+
// If value is metadata object, convert to string format
|
|
1283
|
+
else if (typeof value === 'object' && value !== null) {
|
|
1284
|
+
const defaultVal = value.default || '';
|
|
1285
|
+
// If it's a literal value (not empty string), use it directly
|
|
1286
|
+
if (defaultVal && !defaultVal.startsWith('${')) {
|
|
1287
|
+
converted[key] = defaultVal;
|
|
1288
|
+
}
|
|
1289
|
+
// Otherwise use variable substitution format
|
|
1290
|
+
else {
|
|
1291
|
+
converted[key] = `\${${key}:-${defaultVal}}`;
|
|
1292
|
+
}
|
|
1293
|
+
}
|
|
1294
|
+
else {
|
|
1295
|
+
converted[key] = String(value);
|
|
1296
|
+
}
|
|
1297
|
+
});
|
|
1298
|
+
|
|
1299
|
+
return converted;
|
|
1300
|
+
}
|
|
1301
|
+
|
|
1252
1302
|
/**
|
|
1253
1303
|
* Run comprehensive MCP diagnostics
|
|
1254
1304
|
* @returns {Object} Diagnostic results
|