@i18n-agent/mcp-client 1.4.3 → 1.6.0

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/mcp-client.js +32 -10
  2. package/package.json +1 -1
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.4.3';
8
+ const MCP_CLIENT_VERSION = '1.6.0';
9
9
 
10
10
  import { Server } from '@modelcontextprotocol/sdk/server/index.js';
11
11
  import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
@@ -47,7 +47,7 @@ server.setRequestHandler(ListToolsRequestSchema, async () => {
47
47
  tools: [
48
48
  {
49
49
  name: 'translate_text',
50
- description: 'Translate text content with cultural adaptation using AI subagents. For large requests (>100 texts or >50,000 characters), returns a jobId for async processing. Use check_translation_status to monitor progress and download results.',
50
+ description: 'Translate text content with cultural adaptation using AI subagents. Supports both single and multi-language translation. For large requests (>100 texts or >50,000 characters), returns a jobId for async processing. Use check_translation_status to monitor progress and download results.',
51
51
  inputSchema: {
52
52
  type: 'object',
53
53
  properties: {
@@ -58,7 +58,12 @@ server.setRequestHandler(ListToolsRequestSchema, async () => {
58
58
  },
59
59
  targetLanguage: {
60
60
  type: 'string',
61
- description: 'Target language code (e.g., "es", "fr", "zh-CN")',
61
+ description: 'Target language code (e.g., "es", "fr", "zh-CN") - for single language translation',
62
+ },
63
+ targetLanguages: {
64
+ type: 'array',
65
+ items: { type: 'string' },
66
+ description: 'Array of target language codes (e.g., ["es", "fr", "zh-CN"]) - for multi-language translation',
62
67
  },
63
68
  sourceLanguage: {
64
69
  type: 'string',
@@ -81,7 +86,10 @@ server.setRequestHandler(ListToolsRequestSchema, async () => {
81
86
  description: 'Optional additional context or instructions for the translation (e.g., "Keep technical terms in English", "Use formal tone")',
82
87
  },
83
88
  },
84
- required: ['texts', 'targetLanguage'],
89
+ anyOf: [
90
+ { required: ['texts', 'targetLanguage'] },
91
+ { required: ['texts', 'targetLanguages'] }
92
+ ],
85
93
  },
86
94
  },
87
95
  {
@@ -100,7 +108,7 @@ server.setRequestHandler(ListToolsRequestSchema, async () => {
100
108
  },
101
109
  {
102
110
  name: 'translate_file',
103
- description: 'Translate file content while preserving structure and format. Supports JSON, YAML, XML, CSV, TXT, MD, and other text files. For large files (>100KB), returns a jobId for async processing. Use check_translation_status to monitor progress and download results.',
111
+ description: 'Translate file content while preserving structure and format. Supports both single and multi-language translation. Supports JSON, YAML, XML, CSV, TXT, MD, and other text files. For large files (>100KB), returns a jobId for async processing. Use check_translation_status to monitor progress and download results.',
104
112
  inputSchema: {
105
113
  type: 'object',
106
114
  properties: {
@@ -120,7 +128,12 @@ server.setRequestHandler(ListToolsRequestSchema, async () => {
120
128
  },
121
129
  targetLanguage: {
122
130
  type: 'string',
123
- description: 'Target language code or name',
131
+ description: 'Target language code or name - for single language translation',
132
+ },
133
+ targetLanguages: {
134
+ type: 'array',
135
+ items: { type: 'string' },
136
+ description: 'Array of target language codes (e.g., ["es", "fr", "zh-CN"]) - for multi-language translation',
124
137
  },
125
138
  targetAudience: {
126
139
  type: 'string',
@@ -155,7 +168,10 @@ server.setRequestHandler(ListToolsRequestSchema, async () => {
155
168
  description: 'Optional additional context or instructions for the translation (e.g., "Keep technical terms in English", "Use formal tone")',
156
169
  },
157
170
  },
158
- required: ['targetLanguage'],
171
+ anyOf: [
172
+ { required: ['targetLanguage'] },
173
+ { required: ['targetLanguages'] }
174
+ ],
159
175
  },
160
176
  },
161
177
  {
@@ -412,10 +428,13 @@ async function handleTranslateText(args) {
412
428
  }
413
429
 
414
430
  // Check if it's actually a service unavailable error (only for real infrastructure issues)
431
+ if (error.response?.status === 503) {
432
+ throw new Error(`i18n-agent encountered unexpected problem, and we are working on it, try again later.`);
433
+ }
434
+
415
435
  if (error.code === 'ECONNREFUSED' ||
416
436
  error.code === 'ETIMEDOUT' ||
417
437
  error.code === 'ENOTFOUND' ||
418
- (error.response?.status === 503 && totalChars <= 50000) ||
419
438
  error.response?.status === 502 ||
420
439
  error.response?.status === 504) {
421
440
  const serviceErrorDetails = error.response?.data?.result?.content?.[0]?.text ||
@@ -708,10 +727,13 @@ async function handleTranslateFile(args) {
708
727
  }
709
728
 
710
729
  // Check if it's actually a service unavailable error (only for real infrastructure issues)
730
+ if (error.response?.status === 503 && content.length <= 50000) {
731
+ throw new Error(`i18n-agent encountered unexpected problem, and we are working on it, try again later.`);
732
+ }
733
+
711
734
  if (error.code === 'ECONNREFUSED' ||
712
735
  error.code === 'ETIMEDOUT' ||
713
736
  error.code === 'ENOTFOUND' ||
714
- (error.response?.status === 503 && content.length <= 50000) ||
715
737
  error.response?.status === 502 ||
716
738
  error.response?.status === 504) {
717
739
  const serviceErrorDetails = error.response?.data?.result?.content?.[0]?.text ||
@@ -1301,7 +1323,7 @@ async function handleCheckTranslationStatus(args) {
1301
1323
 
1302
1324
  // Handle 503 service unavailable
1303
1325
  if (error.response?.status === 503) {
1304
- throw new Error(`Translation service is temporarily unavailable (503). Please try again in a few moments.`);
1326
+ throw new Error(`i18n-agent encountered unexpected problem, and we are working on it, try again later.`);
1305
1327
  }
1306
1328
 
1307
1329
  // Handle 404 not found
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@i18n-agent/mcp-client",
3
- "version": "1.4.3",
3
+ "version": "1.6.0",
4
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",
5
5
  "main": "mcp-client.js",
6
6
  "bin": {