@i18n-agent/mcp-client 1.8.18 → 1.8.20
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 +2 -0
- package/mcp-client.js +94 -9
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -346,6 +346,7 @@ Translate text content with cultural adaptation and context awareness.
|
|
|
346
346
|
- `targetLanguage` (string): Target language code
|
|
347
347
|
- `targetAudience` (string): Target audience context
|
|
348
348
|
- `industry` (string): Industry context
|
|
349
|
+
- `namespace` (string, **required**): Unique namespace identifier for backend tracking and project organization
|
|
349
350
|
- `sourceLanguage` (string, optional): Source language (auto-detected if not provided)
|
|
350
351
|
- `region` (string, optional): Specific region for localization
|
|
351
352
|
|
|
@@ -356,6 +357,7 @@ Translate files while preserving structure and format.
|
|
|
356
357
|
- `filePath` or `fileContent` (string): File path or content to translate
|
|
357
358
|
- `fileType` (string): File format (json, yaml, xml, csv, txt, md, etc.)
|
|
358
359
|
- `targetLanguage` (string): Target language code
|
|
360
|
+
- `namespace` (string, **required**): Unique namespace identifier for backend tracking and project organization
|
|
359
361
|
- `preserveKeys` (boolean): Whether to preserve object keys/structure
|
|
360
362
|
- `outputFormat` (string): Output format (same, json, yaml, txt)
|
|
361
363
|
|
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.
|
|
8
|
+
const MCP_CLIENT_VERSION = '1.8.19';
|
|
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: '⚠️ CRITICAL: For multi-language translation, use targetLanguages parameter (not targetLanguage). 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.',
|
|
50
|
+
description: '⚠️ CRITICAL: For multi-language translation, use targetLanguages parameter (not targetLanguage). 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. Set pseudoTranslation=true for testing i18n implementations without AI cost.',
|
|
51
51
|
inputSchema: {
|
|
52
52
|
type: 'object',
|
|
53
53
|
properties: {
|
|
@@ -83,8 +83,42 @@ server.setRequestHandler(ListToolsRequestSchema, async () => {
|
|
|
83
83
|
type: 'string',
|
|
84
84
|
description: 'Optional additional context or instructions for the translation (e.g., "Keep technical terms in English", "Use formal tone")',
|
|
85
85
|
},
|
|
86
|
+
pseudoTranslation: {
|
|
87
|
+
type: 'boolean',
|
|
88
|
+
description: 'Enable pseudo-translation mode for testing i18n implementations (bypasses AI translation, no credit cost)',
|
|
89
|
+
},
|
|
90
|
+
pseudoOptions: {
|
|
91
|
+
type: 'object',
|
|
92
|
+
properties: {
|
|
93
|
+
addCJK: {
|
|
94
|
+
type: 'boolean',
|
|
95
|
+
description: 'Add CJK characters to test wide character support',
|
|
96
|
+
},
|
|
97
|
+
expansionRatio: {
|
|
98
|
+
type: 'number',
|
|
99
|
+
description: 'Length expansion ratio (1.0 = no expansion, 1.3 = 30% longer, 2.0 = double length)',
|
|
100
|
+
},
|
|
101
|
+
addSpecialChars: {
|
|
102
|
+
type: 'boolean',
|
|
103
|
+
description: 'Add special characters to test encoding/escaping',
|
|
104
|
+
},
|
|
105
|
+
addBrackets: {
|
|
106
|
+
type: 'boolean',
|
|
107
|
+
description: 'Wrap strings with brackets to identify untranslated content',
|
|
108
|
+
},
|
|
109
|
+
addAccents: {
|
|
110
|
+
type: 'boolean',
|
|
111
|
+
description: 'Replace Latin characters with accented equivalents',
|
|
112
|
+
},
|
|
113
|
+
},
|
|
114
|
+
description: 'Configuration options for pseudo-translation',
|
|
115
|
+
},
|
|
116
|
+
namespace: {
|
|
117
|
+
type: 'string',
|
|
118
|
+
description: 'Unique namespace identifier for backend tracking and project organization (required for production use)',
|
|
119
|
+
},
|
|
86
120
|
},
|
|
87
|
-
required: ['texts', 'targetLanguages'],
|
|
121
|
+
required: ['texts', 'targetLanguages', 'namespace'],
|
|
88
122
|
},
|
|
89
123
|
},
|
|
90
124
|
{
|
|
@@ -103,7 +137,7 @@ server.setRequestHandler(ListToolsRequestSchema, async () => {
|
|
|
103
137
|
},
|
|
104
138
|
{
|
|
105
139
|
name: 'translate_file',
|
|
106
|
-
description: '⚠️ CRITICAL: For multi-language translation, use targetLanguages parameter (not targetLanguage). 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.',
|
|
140
|
+
description: '⚠️ CRITICAL: For multi-language translation, use targetLanguages parameter (not targetLanguage). 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. Set pseudoTranslation=true for testing i18n implementations without AI cost.',
|
|
107
141
|
inputSchema: {
|
|
108
142
|
type: 'object',
|
|
109
143
|
properties: {
|
|
@@ -160,8 +194,42 @@ server.setRequestHandler(ListToolsRequestSchema, async () => {
|
|
|
160
194
|
type: 'string',
|
|
161
195
|
description: 'Optional additional context or instructions for the translation (e.g., "Keep technical terms in English", "Use formal tone")',
|
|
162
196
|
},
|
|
197
|
+
pseudoTranslation: {
|
|
198
|
+
type: 'boolean',
|
|
199
|
+
description: 'Enable pseudo-translation mode for testing i18n implementations (bypasses AI translation, no credit cost)',
|
|
200
|
+
},
|
|
201
|
+
pseudoOptions: {
|
|
202
|
+
type: 'object',
|
|
203
|
+
properties: {
|
|
204
|
+
addCJK: {
|
|
205
|
+
type: 'boolean',
|
|
206
|
+
description: 'Add CJK characters to test wide character support',
|
|
207
|
+
},
|
|
208
|
+
expansionRatio: {
|
|
209
|
+
type: 'number',
|
|
210
|
+
description: 'Length expansion ratio (1.0 = no expansion, 1.3 = 30% longer, 2.0 = double length)',
|
|
211
|
+
},
|
|
212
|
+
addSpecialChars: {
|
|
213
|
+
type: 'boolean',
|
|
214
|
+
description: 'Add special characters to test encoding/escaping',
|
|
215
|
+
},
|
|
216
|
+
addBrackets: {
|
|
217
|
+
type: 'boolean',
|
|
218
|
+
description: 'Wrap strings with brackets to identify untranslated content',
|
|
219
|
+
},
|
|
220
|
+
addAccents: {
|
|
221
|
+
type: 'boolean',
|
|
222
|
+
description: 'Replace Latin characters with accented equivalents',
|
|
223
|
+
},
|
|
224
|
+
},
|
|
225
|
+
description: 'Configuration options for pseudo-translation',
|
|
226
|
+
},
|
|
227
|
+
namespace: {
|
|
228
|
+
type: 'string',
|
|
229
|
+
description: 'Unique namespace identifier for backend tracking and project organization (required for production use)',
|
|
230
|
+
},
|
|
163
231
|
},
|
|
164
|
-
required: ['targetLanguages'],
|
|
232
|
+
required: ['targetLanguages', 'namespace'],
|
|
165
233
|
},
|
|
166
234
|
},
|
|
167
235
|
{
|
|
@@ -376,12 +444,16 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
376
444
|
});
|
|
377
445
|
|
|
378
446
|
async function handleTranslateText(args) {
|
|
379
|
-
const { texts, targetLanguages: rawTargetLanguages, sourceLanguage, targetAudience = 'general', industry = 'technology', region, context } = args;
|
|
447
|
+
const { texts, targetLanguages: rawTargetLanguages, sourceLanguage, targetAudience = 'general', industry = 'technology', region, context, pseudoTranslation, pseudoOptions, namespace } = args;
|
|
380
448
|
|
|
381
449
|
if (!texts || !Array.isArray(texts) || texts.length === 0) {
|
|
382
450
|
throw new Error('texts must be a non-empty array');
|
|
383
451
|
}
|
|
384
452
|
|
|
453
|
+
if (!namespace) {
|
|
454
|
+
throw new Error('namespace is required for translation tracking and project organization');
|
|
455
|
+
}
|
|
456
|
+
|
|
385
457
|
// Normalize targetLanguages - accept both string and array
|
|
386
458
|
let targetLanguages = rawTargetLanguages;
|
|
387
459
|
let targetLanguage = undefined;
|
|
@@ -420,6 +492,9 @@ async function handleTranslateText(args) {
|
|
|
420
492
|
industry: industry,
|
|
421
493
|
region: region,
|
|
422
494
|
context: context,
|
|
495
|
+
pseudoTranslation: pseudoTranslation,
|
|
496
|
+
pseudoOptions: pseudoOptions,
|
|
497
|
+
namespace: namespace,
|
|
423
498
|
}
|
|
424
499
|
}
|
|
425
500
|
};
|
|
@@ -684,13 +759,20 @@ async function handleTranslateFile(args) {
|
|
|
684
759
|
outputFormat = 'same',
|
|
685
760
|
sourceLanguage,
|
|
686
761
|
region,
|
|
687
|
-
context
|
|
762
|
+
context,
|
|
763
|
+
pseudoTranslation,
|
|
764
|
+
pseudoOptions,
|
|
765
|
+
namespace
|
|
688
766
|
} = args;
|
|
689
767
|
|
|
690
768
|
if (!filePath && !fileContent) {
|
|
691
769
|
throw new Error('Either filePath or fileContent must be provided');
|
|
692
770
|
}
|
|
693
771
|
|
|
772
|
+
if (!namespace) {
|
|
773
|
+
throw new Error('namespace is required for translation tracking and project organization');
|
|
774
|
+
}
|
|
775
|
+
|
|
694
776
|
// Normalize targetLanguages - accept both string and array
|
|
695
777
|
let targetLanguages = rawTargetLanguages;
|
|
696
778
|
let targetLanguage = undefined;
|
|
@@ -732,7 +814,8 @@ async function handleTranslateFile(args) {
|
|
|
732
814
|
targetAudience,
|
|
733
815
|
industry,
|
|
734
816
|
preserveKeys,
|
|
735
|
-
outputFormat
|
|
817
|
+
outputFormat,
|
|
818
|
+
namespace
|
|
736
819
|
};
|
|
737
820
|
|
|
738
821
|
// Add optional parameters only if defined
|
|
@@ -740,6 +823,8 @@ async function handleTranslateFile(args) {
|
|
|
740
823
|
if (targetLanguages !== undefined) requestArgs.targetLanguages = targetLanguages;
|
|
741
824
|
if (region !== undefined) requestArgs.region = region;
|
|
742
825
|
if (context !== undefined) requestArgs.context = context;
|
|
826
|
+
if (pseudoTranslation !== undefined) requestArgs.pseudoTranslation = pseudoTranslation;
|
|
827
|
+
if (pseudoOptions !== undefined) requestArgs.pseudoOptions = pseudoOptions;
|
|
743
828
|
|
|
744
829
|
// Use MCP JSON-RPC protocol for translate_file
|
|
745
830
|
const mcpRequest = {
|
|
@@ -915,7 +1000,7 @@ async function pollTranslationJob(jobId, estimatedTime) {
|
|
|
915
1000
|
|
|
916
1001
|
const response = await axios.post(MCP_SERVER_URL, statusRequest, {
|
|
917
1002
|
headers: { 'Content-Type': 'application/json' },
|
|
918
|
-
timeout:
|
|
1003
|
+
timeout: 30000
|
|
919
1004
|
});
|
|
920
1005
|
|
|
921
1006
|
if (response.data.error) {
|
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.20",
|
|
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": {
|