@i18n-agent/mcp-client 1.8.6 → 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 +86 -5
- package/package.json +1 -1
package/install.js
CHANGED
|
@@ -297,12 +297,27 @@ function updateGenericMCPConfig(configPath) {
|
|
|
297
297
|
config.mcpServers = {};
|
|
298
298
|
}
|
|
299
299
|
|
|
300
|
-
const
|
|
301
|
-
|
|
300
|
+
const nodeEnv = detectNodeEnvironment();
|
|
301
|
+
const { mcpClientPath, packageDir } = getMcpClientPaths();
|
|
302
302
|
|
|
303
|
-
//
|
|
304
|
-
if (
|
|
305
|
-
|
|
303
|
+
// Use absolute node path for nvm environments, 'node' for system installations
|
|
304
|
+
if (nodeEnv.isNvm) {
|
|
305
|
+
console.log(' 🔧 Using absolute node path for nvm environment');
|
|
306
|
+
config.mcpServers["i18n-agent"] = {
|
|
307
|
+
command: nodeEnv.nodePath,
|
|
308
|
+
args: [mcpClientPath],
|
|
309
|
+
cwd: packageDir,
|
|
310
|
+
env: {
|
|
311
|
+
MCP_SERVER_URL: "https://mcp.i18nagent.ai",
|
|
312
|
+
API_KEY: existingApiKey || ""
|
|
313
|
+
}
|
|
314
|
+
};
|
|
315
|
+
} else {
|
|
316
|
+
const baseConfig = createMCPConfig();
|
|
317
|
+
config.mcpServers["i18n-agent"] = baseConfig.mcpServers["i18n-agent"];
|
|
318
|
+
if (existingApiKey) {
|
|
319
|
+
config.mcpServers["i18n-agent"].env.API_KEY = existingApiKey;
|
|
320
|
+
}
|
|
306
321
|
}
|
|
307
322
|
|
|
308
323
|
// Write config
|
|
@@ -312,6 +327,63 @@ function updateGenericMCPConfig(configPath) {
|
|
|
312
327
|
return config;
|
|
313
328
|
}
|
|
314
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
|
+
|
|
315
387
|
async function main() {
|
|
316
388
|
try {
|
|
317
389
|
console.log('🔍 Detecting available AI IDEs...\n');
|
|
@@ -359,6 +431,15 @@ For manual setup instructions, visit: https://docs.i18nagent.ai/setup
|
|
|
359
431
|
|
|
360
432
|
if (ide.key === 'claude' || ide.key === 'claude-code') {
|
|
361
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
|
+
}
|
|
362
443
|
} else {
|
|
363
444
|
updateGenericMCPConfig(ide.configPath);
|
|
364
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": {
|