@i18n-agent/mcp-client 1.4.0 → 1.4.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.
Files changed (2) hide show
  1. package/mcp-client.js +21 -3
  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.3.0';
8
+ const MCP_CLIENT_VERSION = '1.4.2';
9
9
 
10
10
  import { Server } from '@modelcontextprotocol/sdk/server/index.js';
11
11
  import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
@@ -265,8 +265,9 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
265
265
 
266
266
  let finalErrorMsg = error.message;
267
267
 
268
- // Add retry guidance for non-auth/credit errors
269
- if (!isAuthError && !isCreditError) {
268
+ // Add retry guidance for non-auth/credit errors (only for tools that send content)
269
+ const contentBasedTools = ['translate_text', 'translate_file'];
270
+ if (!isAuthError && !isCreditError && contentBasedTools.includes(name)) {
270
271
  finalErrorMsg = `${error.message}. Please retry with smaller chunks or split the content into multiple requests.`;
271
272
  }
272
273
 
@@ -1305,6 +1306,23 @@ async function handleCheckTranslationStatus(args) {
1305
1306
  return response.data.result;
1306
1307
  } catch (error) {
1307
1308
  console.error('Check translation status error:', error);
1309
+
1310
+ // Handle 503 service unavailable
1311
+ if (error.response?.status === 503) {
1312
+ throw new Error(`Translation service is temporarily unavailable (503). Please try again in a few moments.`);
1313
+ }
1314
+
1315
+ // Handle 404 not found
1316
+ if (error.response?.status === 404) {
1317
+ throw new Error(`Translation job ${jobId} not found. The job may have expired or the ID is incorrect.`);
1318
+ }
1319
+
1320
+ // Handle timeout
1321
+ if (error.code === 'ECONNABORTED') {
1322
+ throw new Error(`Status check timed out. The service may be experiencing high load. Please try again.`);
1323
+ }
1324
+
1325
+ // Generic error
1308
1326
  throw new Error(`Unable to check translation status: ${error.message}`);
1309
1327
  }
1310
1328
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@i18n-agent/mcp-client",
3
- "version": "1.4.0",
3
+ "version": "1.4.2",
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": {