@i18n-agent/mcp-client 1.8.19 → 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 +25 -6
- 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
|
@@ -113,8 +113,12 @@ server.setRequestHandler(ListToolsRequestSchema, async () => {
|
|
|
113
113
|
},
|
|
114
114
|
description: 'Configuration options for pseudo-translation',
|
|
115
115
|
},
|
|
116
|
+
namespace: {
|
|
117
|
+
type: 'string',
|
|
118
|
+
description: 'Unique namespace identifier for backend tracking and project organization (required for production use)',
|
|
119
|
+
},
|
|
116
120
|
},
|
|
117
|
-
required: ['texts', 'targetLanguages'],
|
|
121
|
+
required: ['texts', 'targetLanguages', 'namespace'],
|
|
118
122
|
},
|
|
119
123
|
},
|
|
120
124
|
{
|
|
@@ -220,8 +224,12 @@ server.setRequestHandler(ListToolsRequestSchema, async () => {
|
|
|
220
224
|
},
|
|
221
225
|
description: 'Configuration options for pseudo-translation',
|
|
222
226
|
},
|
|
227
|
+
namespace: {
|
|
228
|
+
type: 'string',
|
|
229
|
+
description: 'Unique namespace identifier for backend tracking and project organization (required for production use)',
|
|
230
|
+
},
|
|
223
231
|
},
|
|
224
|
-
required: ['targetLanguages'],
|
|
232
|
+
required: ['targetLanguages', 'namespace'],
|
|
225
233
|
},
|
|
226
234
|
},
|
|
227
235
|
{
|
|
@@ -436,12 +444,16 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
436
444
|
});
|
|
437
445
|
|
|
438
446
|
async function handleTranslateText(args) {
|
|
439
|
-
const { texts, targetLanguages: rawTargetLanguages, sourceLanguage, targetAudience = 'general', industry = 'technology', region, context, pseudoTranslation, pseudoOptions } = args;
|
|
447
|
+
const { texts, targetLanguages: rawTargetLanguages, sourceLanguage, targetAudience = 'general', industry = 'technology', region, context, pseudoTranslation, pseudoOptions, namespace } = args;
|
|
440
448
|
|
|
441
449
|
if (!texts || !Array.isArray(texts) || texts.length === 0) {
|
|
442
450
|
throw new Error('texts must be a non-empty array');
|
|
443
451
|
}
|
|
444
452
|
|
|
453
|
+
if (!namespace) {
|
|
454
|
+
throw new Error('namespace is required for translation tracking and project organization');
|
|
455
|
+
}
|
|
456
|
+
|
|
445
457
|
// Normalize targetLanguages - accept both string and array
|
|
446
458
|
let targetLanguages = rawTargetLanguages;
|
|
447
459
|
let targetLanguage = undefined;
|
|
@@ -482,6 +494,7 @@ async function handleTranslateText(args) {
|
|
|
482
494
|
context: context,
|
|
483
495
|
pseudoTranslation: pseudoTranslation,
|
|
484
496
|
pseudoOptions: pseudoOptions,
|
|
497
|
+
namespace: namespace,
|
|
485
498
|
}
|
|
486
499
|
}
|
|
487
500
|
};
|
|
@@ -748,13 +761,18 @@ async function handleTranslateFile(args) {
|
|
|
748
761
|
region,
|
|
749
762
|
context,
|
|
750
763
|
pseudoTranslation,
|
|
751
|
-
pseudoOptions
|
|
764
|
+
pseudoOptions,
|
|
765
|
+
namespace
|
|
752
766
|
} = args;
|
|
753
767
|
|
|
754
768
|
if (!filePath && !fileContent) {
|
|
755
769
|
throw new Error('Either filePath or fileContent must be provided');
|
|
756
770
|
}
|
|
757
771
|
|
|
772
|
+
if (!namespace) {
|
|
773
|
+
throw new Error('namespace is required for translation tracking and project organization');
|
|
774
|
+
}
|
|
775
|
+
|
|
758
776
|
// Normalize targetLanguages - accept both string and array
|
|
759
777
|
let targetLanguages = rawTargetLanguages;
|
|
760
778
|
let targetLanguage = undefined;
|
|
@@ -796,7 +814,8 @@ async function handleTranslateFile(args) {
|
|
|
796
814
|
targetAudience,
|
|
797
815
|
industry,
|
|
798
816
|
preserveKeys,
|
|
799
|
-
outputFormat
|
|
817
|
+
outputFormat,
|
|
818
|
+
namespace
|
|
800
819
|
};
|
|
801
820
|
|
|
802
821
|
// Add optional parameters only if defined
|
|
@@ -981,7 +1000,7 @@ async function pollTranslationJob(jobId, estimatedTime) {
|
|
|
981
1000
|
|
|
982
1001
|
const response = await axios.post(MCP_SERVER_URL, statusRequest, {
|
|
983
1002
|
headers: { 'Content-Type': 'application/json' },
|
|
984
|
-
timeout:
|
|
1003
|
+
timeout: 30000
|
|
985
1004
|
});
|
|
986
1005
|
|
|
987
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": {
|