@i18n-agent/mcp-client 1.8.5 → 1.8.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.
Files changed (2) hide show
  1. package/install.js +63 -27
  2. package/package.json +1 -1
package/install.js CHANGED
@@ -195,7 +195,7 @@ exec node "${mcpClientPath}"`;
195
195
  return wrapperPath;
196
196
  }
197
197
 
198
- function updateClaudeConfig(configPath) {
198
+ function updateClaudeConfig(configPath, ideKey = 'claude') {
199
199
  let config = {};
200
200
  let existingApiKey = "";
201
201
 
@@ -220,29 +220,50 @@ function updateClaudeConfig(configPath) {
220
220
  config.mcpServers = {};
221
221
  }
222
222
 
223
- // Detect if we need a wrapper script (for nvm users)
224
223
  const nodeEnv = detectNodeEnvironment();
225
- const claudeDir = path.join(os.homedir(), '.claude');
226
-
227
- if (nodeEnv.isNvm) {
228
- // Create wrapper script for nvm users
229
- console.log(' 🔧 Detected nvm environment, creating wrapper script...');
230
- const wrapperPath = createWrapperScript(claudeDir);
231
-
232
- config.mcpServers["i18n-agent"] = {
233
- command: wrapperPath,
234
- env: {
235
- MCP_SERVER_URL: "https://mcp.i18nagent.ai",
236
- API_KEY: existingApiKey || ""
224
+ const { mcpClientPath } = getMcpClientPaths();
225
+
226
+ // Claude Code CLI works better with command+args format (not wrapper)
227
+ if (ideKey === 'claude-code') {
228
+ if (nodeEnv.isNvm) {
229
+ // For nvm, use absolute node path with args
230
+ console.log(' 🔧 Using direct node path for Claude Code CLI');
231
+ config.mcpServers["i18n-agent"] = {
232
+ command: nodeEnv.nodePath,
233
+ args: [mcpClientPath],
234
+ env: {
235
+ MCP_SERVER_URL: "https://mcp.i18nagent.ai",
236
+ API_KEY: existingApiKey || ""
237
+ }
238
+ };
239
+ } else {
240
+ // For system node, use 'node' with args
241
+ const baseConfig = createMCPConfig();
242
+ config.mcpServers["i18n-agent"] = baseConfig.mcpServers["i18n-agent"];
243
+ if (existingApiKey) {
244
+ config.mcpServers["i18n-agent"].env.API_KEY = existingApiKey;
237
245
  }
238
- };
246
+ }
239
247
  } else {
240
- // Standard configuration for system node
241
- const baseConfig = createMCPConfig();
242
- config.mcpServers["i18n-agent"] = baseConfig.mcpServers["i18n-agent"];
243
- // Preserve existing API key
244
- if (existingApiKey) {
245
- config.mcpServers["i18n-agent"].env.API_KEY = existingApiKey;
248
+ // Claude Desktop - use wrapper script for compatibility
249
+ if (nodeEnv.isNvm) {
250
+ const claudeDir = path.join(os.homedir(), '.claude');
251
+ console.log(' 🔧 Detected nvm environment, creating wrapper script...');
252
+ const wrapperPath = createWrapperScript(claudeDir);
253
+
254
+ config.mcpServers["i18n-agent"] = {
255
+ command: wrapperPath,
256
+ env: {
257
+ MCP_SERVER_URL: "https://mcp.i18nagent.ai",
258
+ API_KEY: existingApiKey || ""
259
+ }
260
+ };
261
+ } else {
262
+ const baseConfig = createMCPConfig();
263
+ config.mcpServers["i18n-agent"] = baseConfig.mcpServers["i18n-agent"];
264
+ if (existingApiKey) {
265
+ config.mcpServers["i18n-agent"].env.API_KEY = existingApiKey;
266
+ }
246
267
  }
247
268
  }
248
269
 
@@ -276,12 +297,27 @@ function updateGenericMCPConfig(configPath) {
276
297
  config.mcpServers = {};
277
298
  }
278
299
 
279
- const baseConfig = createMCPConfig();
280
- config.mcpServers["i18n-agent"] = baseConfig.mcpServers["i18n-agent"];
300
+ const nodeEnv = detectNodeEnvironment();
301
+ const { mcpClientPath, packageDir } = getMcpClientPaths();
281
302
 
282
- // Preserve existing API key
283
- if (existingApiKey) {
284
- config.mcpServers["i18n-agent"].env.API_KEY = existingApiKey;
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
+ }
285
321
  }
286
322
 
287
323
  // Write config
@@ -337,7 +373,7 @@ For manual setup instructions, visit: https://docs.i18nagent.ai/setup
337
373
  console.log(`⚙️ Configuring ${ide.name}...`);
338
374
 
339
375
  if (ide.key === 'claude' || ide.key === 'claude-code') {
340
- updateClaudeConfig(ide.configPath);
376
+ updateClaudeConfig(ide.configPath, ide.key);
341
377
  } else {
342
378
  updateGenericMCPConfig(ide.configPath);
343
379
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@i18n-agent/mcp-client",
3
- "version": "1.8.5",
3
+ "version": "1.8.7",
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": {