@i18n-agent/mcp-client 1.4.2 → 1.5.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.
- package/mcp-client.js +11 -13
- 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.
|
|
8
|
+
const MCP_CLIENT_VERSION = '1.5.0';
|
|
9
9
|
|
|
10
10
|
import { Server } from '@modelcontextprotocol/sdk/server/index.js';
|
|
11
11
|
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
|
|
@@ -81,7 +81,7 @@ server.setRequestHandler(ListToolsRequestSchema, async () => {
|
|
|
81
81
|
description: 'Optional additional context or instructions for the translation (e.g., "Keep technical terms in English", "Use formal tone")',
|
|
82
82
|
},
|
|
83
83
|
},
|
|
84
|
-
required: ['texts', 'targetLanguage'
|
|
84
|
+
required: ['texts', 'targetLanguage'],
|
|
85
85
|
},
|
|
86
86
|
},
|
|
87
87
|
{
|
|
@@ -288,14 +288,6 @@ async function handleTranslateText(args) {
|
|
|
288
288
|
if (!targetLanguage) {
|
|
289
289
|
throw new Error('targetLanguage is required');
|
|
290
290
|
}
|
|
291
|
-
|
|
292
|
-
if (!targetAudience) {
|
|
293
|
-
throw new Error('targetAudience is required');
|
|
294
|
-
}
|
|
295
|
-
|
|
296
|
-
if (!industry) {
|
|
297
|
-
throw new Error('industry is required');
|
|
298
|
-
}
|
|
299
291
|
|
|
300
292
|
// Check if this is a large translation request
|
|
301
293
|
const totalChars = texts.reduce((sum, text) => sum + text.length, 0);
|
|
@@ -420,10 +412,13 @@ async function handleTranslateText(args) {
|
|
|
420
412
|
}
|
|
421
413
|
|
|
422
414
|
// Check if it's actually a service unavailable error (only for real infrastructure issues)
|
|
415
|
+
if (error.response?.status === 503) {
|
|
416
|
+
throw new Error(`i18n-agent encountered unexpected problem, and we are working on it, try again later.`);
|
|
417
|
+
}
|
|
418
|
+
|
|
423
419
|
if (error.code === 'ECONNREFUSED' ||
|
|
424
420
|
error.code === 'ETIMEDOUT' ||
|
|
425
421
|
error.code === 'ENOTFOUND' ||
|
|
426
|
-
(error.response?.status === 503 && totalChars <= 50000) ||
|
|
427
422
|
error.response?.status === 502 ||
|
|
428
423
|
error.response?.status === 504) {
|
|
429
424
|
const serviceErrorDetails = error.response?.data?.result?.content?.[0]?.text ||
|
|
@@ -716,10 +711,13 @@ async function handleTranslateFile(args) {
|
|
|
716
711
|
}
|
|
717
712
|
|
|
718
713
|
// Check if it's actually a service unavailable error (only for real infrastructure issues)
|
|
714
|
+
if (error.response?.status === 503 && content.length <= 50000) {
|
|
715
|
+
throw new Error(`i18n-agent encountered unexpected problem, and we are working on it, try again later.`);
|
|
716
|
+
}
|
|
717
|
+
|
|
719
718
|
if (error.code === 'ECONNREFUSED' ||
|
|
720
719
|
error.code === 'ETIMEDOUT' ||
|
|
721
720
|
error.code === 'ENOTFOUND' ||
|
|
722
|
-
(error.response?.status === 503 && content.length <= 50000) ||
|
|
723
721
|
error.response?.status === 502 ||
|
|
724
722
|
error.response?.status === 504) {
|
|
725
723
|
const serviceErrorDetails = error.response?.data?.result?.content?.[0]?.text ||
|
|
@@ -1309,7 +1307,7 @@ async function handleCheckTranslationStatus(args) {
|
|
|
1309
1307
|
|
|
1310
1308
|
// Handle 503 service unavailable
|
|
1311
1309
|
if (error.response?.status === 503) {
|
|
1312
|
-
throw new Error(`
|
|
1310
|
+
throw new Error(`i18n-agent encountered unexpected problem, and we are working on it, try again later.`);
|
|
1313
1311
|
}
|
|
1314
1312
|
|
|
1315
1313
|
// Handle 404 not found
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@i18n-agent/mcp-client",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.5.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": {
|