@i18n-agent/mcp-client 1.8.0 โ†’ 1.8.2

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/README.md CHANGED
@@ -76,12 +76,15 @@ Analyze "Hello world! This is a test." for translation to Spanish
76
76
 
77
77
  ## ๐Ÿ›  Supported AI IDEs
78
78
 
79
- | IDE | Status | Config Location |
80
- |-----|--------|----------------|
81
- | **Claude Desktop** | โœ… Auto-configured | `~/Library/Application Support/Claude/claude_desktop_config.json` |
82
- | **Cursor** | โœ… Auto-configured | `~/.cursor/mcp_settings.json` |
83
- | **VS Code** | โœ… Auto-configured | `~/.vscode/mcp_settings.json` |
84
- | **Other MCP IDEs** | ๐Ÿ”ง Manual setup | Varies |
79
+ | IDE | Status | macOS | Windows | Linux |
80
+ |-----|--------|-------|---------|-------|
81
+ | **Claude Desktop** | โœ… Auto-configured | `~/Library/Application Support/Claude/` | `%APPDATA%\Claude\` | `~/.config/Claude/` |
82
+ | **Claude Code CLI** | โœ… Auto-configured | `~/.claude.json` | `~/.claude.json` | `~/.claude.json` |
83
+ | **Cursor** | โœ… Auto-configured | `~/.cursor/mcp_settings.json` | `~/.cursor/mcp_settings.json` | `~/.cursor/mcp_settings.json` |
84
+ | **VS Code** | โœ… Auto-configured | `~/.vscode/mcp_settings.json` | `~/.vscode/mcp_settings.json` | `~/.vscode/mcp_settings.json` |
85
+ | **Codex (OpenAI)** | โœ… Auto-configured | `~/.codex/mcp_settings.json` | `~/.codex/mcp_settings.json` | `~/.codex/mcp_settings.json` |
86
+
87
+ **Note:** The installer automatically detects your platform and uses the correct config paths.
85
88
 
86
89
  ## ๐ŸŒ Language Support (48 Languages)
87
90
  - **bg**: Bulgarian
package/install.js CHANGED
@@ -12,12 +12,42 @@ import { fileURLToPath } from 'url';
12
12
 
13
13
  const __dirname = path.dirname(fileURLToPath(import.meta.url));
14
14
 
15
+ // Helper to get platform-specific paths
16
+ function getClaudeDesktopPath() {
17
+ const platform = process.platform;
18
+ if (platform === 'darwin') {
19
+ // macOS
20
+ return {
21
+ configPath: path.join(os.homedir(), 'Library/Application Support/Claude/claude_desktop_config.json'),
22
+ displayPath: '~/Library/Application Support/Claude/claude_desktop_config.json'
23
+ };
24
+ } else if (platform === 'win32') {
25
+ // Windows
26
+ return {
27
+ configPath: path.join(os.homedir(), 'AppData/Roaming/Claude/claude_desktop_config.json'),
28
+ displayPath: '%APPDATA%\\Claude\\claude_desktop_config.json'
29
+ };
30
+ } else {
31
+ // Linux
32
+ return {
33
+ configPath: path.join(os.homedir(), '.config/Claude/claude_desktop_config.json'),
34
+ displayPath: '~/.config/Claude/claude_desktop_config.json'
35
+ };
36
+ }
37
+ }
38
+
15
39
  // Supported IDE configurations
40
+ const claudePaths = getClaudeDesktopPath();
16
41
  const IDE_CONFIGS = {
17
42
  claude: {
18
43
  name: 'Claude Desktop',
19
- configPath: path.join(os.homedir(), 'Library/Application Support/Claude/claude_desktop_config.json'),
20
- displayPath: '~/Library/Application Support/Claude/claude_desktop_config.json'
44
+ configPath: claudePaths.configPath,
45
+ displayPath: claudePaths.displayPath
46
+ },
47
+ 'claude-code': {
48
+ name: 'Claude Code CLI',
49
+ configPath: path.join(os.homedir(), '.claude.json'),
50
+ displayPath: '~/.claude.json'
21
51
  },
22
52
  cursor: {
23
53
  name: 'Cursor',
@@ -28,6 +58,11 @@ const IDE_CONFIGS = {
28
58
  name: 'VS Code (with MCP extension)',
29
59
  configPath: path.join(os.homedir(), '.vscode/mcp_settings.json'),
30
60
  displayPath: '~/.vscode/mcp_settings.json'
61
+ },
62
+ codex: {
63
+ name: 'Codex (OpenAI)',
64
+ configPath: path.join(os.homedir(), '.codex/mcp_settings.json'),
65
+ displayPath: '~/.codex/mcp_settings.json'
31
66
  }
32
67
  };
33
68
 
@@ -42,6 +77,9 @@ Features:
42
77
  ๐Ÿ“ File translation (JSON, YAML, CSV, MD, etc.)
43
78
  ๐Ÿ’ฐ Credit balance checking
44
79
  ๐ŸŒ 48 languages supported with regional variants
80
+
81
+ ๐Ÿ”‘ IMPORTANT: Get your API key at https://app.i18nagent.ai
82
+ (Required for the MCP client to work)
45
83
  `);
46
84
 
47
85
  const getMcpClientPaths = () => {
@@ -206,8 +244,10 @@ async function main() {
206
244
 
207
245
  Supported IDEs:
208
246
  - Claude Desktop (macOS)
247
+ - Claude Code CLI
209
248
  - Cursor
210
249
  - VS Code (with MCP extension)
250
+ - Codex (OpenAI)
211
251
 
212
252
  Manual setup:
213
253
  1. Create the configuration file for your IDE
@@ -225,45 +265,70 @@ For manual setup instructions, visit: https://docs.i18nagent.ai/setup
225
265
  });
226
266
 
227
267
  console.log('\n๐Ÿ“ Installing for all available IDEs...\n');
228
-
268
+
229
269
  let installCount = 0;
230
-
270
+ const installedIDEs = [];
271
+
231
272
  for (const ide of availableIDEs) {
232
273
  try {
233
274
  console.log(`โš™๏ธ Configuring ${ide.name}...`);
234
-
235
- if (ide.key === 'claude') {
275
+
276
+ if (ide.key === 'claude' || ide.key === 'claude-code') {
236
277
  updateClaudeConfig(ide.configPath);
237
278
  } else {
238
279
  updateGenericMCPConfig(ide.configPath);
239
280
  }
240
-
281
+
241
282
  console.log(`โœ… ${ide.name} configured successfully!`);
242
283
  console.log(` Config: ${ide.displayPath}\n`);
243
284
  installCount++;
244
-
285
+ installedIDEs.push(ide);
286
+
245
287
  } catch (error) {
246
288
  console.error(`โŒ Failed to configure ${ide.name}: ${error.message}\n`);
247
289
  }
248
290
  }
249
-
291
+
250
292
  if (installCount > 0) {
293
+ // Show config file paths for ONLY installed IDEs
294
+ const configPaths = installedIDEs.map(ide => ` - ${ide.name}: ${ide.displayPath}`).join('\n');
295
+
296
+ // Platform-specific environment variable instructions
297
+ const isWindows = process.platform === 'win32';
298
+ const envVarInstructions = isWindows
299
+ ? ` Windows PowerShell:
300
+ $env:API_KEY="your-api-key-here"
301
+
302
+ Or set permanently via System Environment Variables:
303
+ 1. Search "Environment Variables" in Windows
304
+ 2. Click "New" under User variables
305
+ 3. Variable name: API_KEY
306
+ 4. Variable value: your-api-key-here`
307
+ : ` macOS/Linux:
308
+ export API_KEY=your-api-key-here
309
+
310
+ Add to shell profile for persistence (~/.bashrc, ~/.zshrc):
311
+ echo 'export API_KEY=your-api-key-here' >> ~/.zshrc`;
312
+
251
313
  console.log(`๐ŸŽ‰ Installation complete! Configured ${installCount} IDE(s).
252
314
 
253
- ๐Ÿ”‘ Important: Set your API key
315
+ ๐Ÿ”‘ NEXT STEP: Add your API key
254
316
  โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”
255
- You need to set your API key to use the translation service:
256
-
257
317
  1. Get your API key from: https://app.i18nagent.ai
258
- 2. Set it as an environment variable:
259
318
 
260
- export API_KEY=your-api-key-here
319
+ 2. Add it to your config file(s):
320
+ ${configPaths}
321
+
322
+ Open the file and add your API key to the "env" section:
323
+ "env": {
324
+ "MCP_SERVER_URL": "https://mcp.i18nagent.ai",
325
+ "API_KEY": "your-api-key-here" โ† Add your key here
326
+ }
261
327
 
262
- Or add it to your shell profile (~/.bashrc, ~/.zshrc):
263
- echo 'export API_KEY=your-api-key-here' >> ~/.zshrc
328
+ OR set as environment variable:
329
+ ${envVarInstructions}
264
330
 
265
- ๐Ÿ”„ Restart your IDE
266
- After setting the API key, restart your AI IDE to load the new configuration.
331
+ 3. Restart your IDE to load the configuration
267
332
 
268
333
  ๐Ÿงช Test the installation
269
334
  Try these commands in your AI IDE:
package/mcp-client.js CHANGED
@@ -5,7 +5,7 @@
5
5
  * Integrates with Claude Code CLI to provide translation capabilities
6
6
  */
7
7
 
8
- const MCP_CLIENT_VERSION = '1.8.0';
8
+ const MCP_CLIENT_VERSION = '1.8.2';
9
9
 
10
10
  import { Server } from '@modelcontextprotocol/sdk/server/index.js';
11
11
  import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
@@ -334,26 +334,40 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
334
334
  }
335
335
  } catch (error) {
336
336
  console.error(`Error executing tool ${name}:`, error);
337
-
337
+
338
338
  // Check if error is about API key or credit issues
339
339
  const errorMsg = error.message || '';
340
- const isAuthError = errorMsg.toLowerCase().includes('api key') ||
340
+ const isAuthError = errorMsg.toLowerCase().includes('api key') ||
341
341
  errorMsg.toLowerCase().includes('api_key') ||
342
342
  errorMsg.toLowerCase().includes('unauthorized') ||
343
343
  errorMsg.includes('(401)');
344
- const isCreditError = errorMsg.toLowerCase().includes('credit') ||
344
+ const isCreditError = errorMsg.toLowerCase().includes('credit') ||
345
345
  errorMsg.toLowerCase().includes('quota') ||
346
346
  errorMsg.toLowerCase().includes('limit exceeded') ||
347
347
  errorMsg.includes('(402)');
348
-
348
+
349
+ // Check if error is already descriptive (validation errors, specific errors with clear messages)
350
+ const hasDescriptiveError = errorMsg.includes('Invalid language code') ||
351
+ errorMsg.includes('is a multilingual region') ||
352
+ errorMsg.includes('not found') ||
353
+ errorMsg.includes('timed out') ||
354
+ errorMsg.includes('Timeout') ||
355
+ errorMsg.includes('Required') ||
356
+ errorMsg.includes('must be') ||
357
+ errorMsg.includes('is required') ||
358
+ errorMsg.length > 200; // Long errors are likely already detailed
359
+
349
360
  let finalErrorMsg = error.message;
350
-
351
- // Add retry guidance for non-auth/credit errors (only for tools that send content)
361
+
362
+ // Only add retry guidance if:
363
+ // 1. It's not an auth/credit error
364
+ // 2. It's a content-based tool
365
+ // 3. The error is NOT already descriptive
352
366
  const contentBasedTools = ['translate_text', 'translate_file'];
353
- if (!isAuthError && !isCreditError && contentBasedTools.includes(name)) {
367
+ if (!isAuthError && !isCreditError && !hasDescriptiveError && contentBasedTools.includes(name)) {
354
368
  finalErrorMsg = `${error.message}. Please retry with smaller chunks or split the content into multiple requests.`;
355
369
  }
356
-
370
+
357
371
  throw new McpError(
358
372
  ErrorCode.InternalError,
359
373
  `Tool execution failed: ${finalErrorMsg}`
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@i18n-agent/mcp-client",
3
- "version": "1.8.0",
4
- "description": "MCP client for i18n-agent translation service with async job support and enhanced progress tracking - supports Claude, Cursor, VS Code, and other AI IDEs",
3
+ "version": "1.8.2",
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": {
7
7
  "i18n-agent-install": "install.js"