@i18n-agent/mcp-client 1.8.7 → 1.8.8
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/install.js +66 -0
- package/package.json +1 -1
package/install.js
CHANGED
|
@@ -327,6 +327,63 @@ function updateGenericMCPConfig(configPath) {
|
|
|
327
327
|
return config;
|
|
328
328
|
}
|
|
329
329
|
|
|
330
|
+
function updateClaudeJsonConfig(configPath) {
|
|
331
|
+
let config = {};
|
|
332
|
+
let existingApiKey = "";
|
|
333
|
+
|
|
334
|
+
if (fs.existsSync(configPath)) {
|
|
335
|
+
try {
|
|
336
|
+
const existing = fs.readFileSync(configPath, 'utf8');
|
|
337
|
+
config = JSON.parse(existing);
|
|
338
|
+
|
|
339
|
+
// Preserve existing API key if present
|
|
340
|
+
if (config.mcpServers?.["i18n-agent"]?.env?.API_KEY) {
|
|
341
|
+
existingApiKey = config.mcpServers["i18n-agent"].env.API_KEY;
|
|
342
|
+
console.log(' 🔑 Preserving existing API key from ~/.claude.json');
|
|
343
|
+
}
|
|
344
|
+
} catch (error) {
|
|
345
|
+
console.warn(` ⚠️ Warning: Could not parse ~/.claude.json - it may be corrupted`);
|
|
346
|
+
return;
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
if (!config.mcpServers) {
|
|
351
|
+
config.mcpServers = {};
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
const nodeEnv = detectNodeEnvironment();
|
|
355
|
+
const { mcpClientPath } = getMcpClientPaths();
|
|
356
|
+
|
|
357
|
+
// Use absolute node path for nvm, 'node' for system installations
|
|
358
|
+
if (nodeEnv.isNvm) {
|
|
359
|
+
config.mcpServers["i18n-agent"] = {
|
|
360
|
+
command: nodeEnv.nodePath,
|
|
361
|
+
args: [mcpClientPath],
|
|
362
|
+
env: {
|
|
363
|
+
MCP_SERVER_URL: "https://mcp.i18nagent.ai",
|
|
364
|
+
API_KEY: existingApiKey || ""
|
|
365
|
+
}
|
|
366
|
+
};
|
|
367
|
+
} else {
|
|
368
|
+
config.mcpServers["i18n-agent"] = {
|
|
369
|
+
command: "node",
|
|
370
|
+
args: [mcpClientPath],
|
|
371
|
+
env: {
|
|
372
|
+
MCP_SERVER_URL: "https://mcp.i18nagent.ai",
|
|
373
|
+
API_KEY: existingApiKey || ""
|
|
374
|
+
}
|
|
375
|
+
};
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
// Write config
|
|
379
|
+
try {
|
|
380
|
+
fs.writeFileSync(configPath, JSON.stringify(config, null, 2));
|
|
381
|
+
console.log(' ✅ ~/.claude.json updated');
|
|
382
|
+
} catch (error) {
|
|
383
|
+
console.warn(` ⚠️ Warning: Failed to write ~/.claude.json: ${error.message}`);
|
|
384
|
+
}
|
|
385
|
+
}
|
|
386
|
+
|
|
330
387
|
async function main() {
|
|
331
388
|
try {
|
|
332
389
|
console.log('🔍 Detecting available AI IDEs...\n');
|
|
@@ -374,6 +431,15 @@ For manual setup instructions, visit: https://docs.i18nagent.ai/setup
|
|
|
374
431
|
|
|
375
432
|
if (ide.key === 'claude' || ide.key === 'claude-code') {
|
|
376
433
|
updateClaudeConfig(ide.configPath, ide.key);
|
|
434
|
+
|
|
435
|
+
// Claude Code CLI also needs ~/.claude.json updated (source of truth)
|
|
436
|
+
if (ide.key === 'claude-code') {
|
|
437
|
+
const claudeJsonPath = path.join(os.homedir(), '.claude.json');
|
|
438
|
+
if (fs.existsSync(claudeJsonPath)) {
|
|
439
|
+
console.log(' 🔧 Updating ~/.claude.json (source of truth)...');
|
|
440
|
+
updateClaudeJsonConfig(claudeJsonPath);
|
|
441
|
+
}
|
|
442
|
+
}
|
|
377
443
|
} else {
|
|
378
444
|
updateGenericMCPConfig(ide.configPath);
|
|
379
445
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@i18n-agent/mcp-client",
|
|
3
|
-
"version": "1.8.
|
|
3
|
+
"version": "1.8.8",
|
|
4
4
|
"description": "🌍 i18n-agent MCP Client - 48 languages, AI-powered translation for Claude, Claude Code, Cursor, VS Code, Codex. Get API key at https://app.i18nagent.ai",
|
|
5
5
|
"main": "mcp-client.js",
|
|
6
6
|
"bin": {
|