@i18n-agent/mcp-client 1.9.3 → 1.9.5

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 +24 -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.9.3';
8
+ const MCP_CLIENT_VERSION = '1.9.5';
9
9
 
10
10
  import { Server } from '@modelcontextprotocol/sdk/server/index.js';
11
11
  import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
@@ -362,7 +362,7 @@ server.setRequestHandler(ListToolsRequestSchema, async () => {
362
362
  },
363
363
  {
364
364
  name: 'download_translations',
365
- description: 'Download completed translations by writing them to /tmp/i18n-translations-{jobId}/. Returns metadata with file paths instead of large translation content to avoid token bloat. Consumer can then read or copy files as needed.',
365
+ description: 'Download completed translations to /tmp/i18n-translations-{jobId}/. Returns file paths and action_required field. IMPORTANT: After downloading, copy each {lang}.json file to the correct locale folder matching the source file structure (e.g., if source was locales/en/messages.json, copy to locales/{lang}/messages.json).',
366
366
  inputSchema: {
367
367
  type: 'object',
368
368
  properties: {
@@ -966,22 +966,35 @@ async function handleTranslateFile(args) {
966
966
 
967
967
  // Check if we got an async job response
968
968
  const result = response.data.result;
969
-
969
+
970
970
  if (result && result.content && result.content[0]) {
971
971
  const textContent = result.content[0].text;
972
-
972
+
973
973
  // Try to parse as JSON to check for job ID
974
974
  try {
975
975
  const parsed = JSON.parse(textContent);
976
- if (parsed.status === 'processing' && parsed.jobId) {
977
- // Async job started - poll for status
978
- return await pollTranslationJob(parsed.jobId, parsed.estimatedTime);
976
+
977
+ // Check for queued/processing status - return with prominent background monitoring instruction
978
+ // DO NOT auto-poll here - let the consumer handle monitoring in background to save tokens
979
+ if ((parsed.status === 'queued' || parsed.status === 'processing') && parsed.jobId) {
980
+ return {
981
+ content: [{
982
+ type: 'text',
983
+ text: JSON.stringify({
984
+ status: parsed.status,
985
+ jobId: parsed.jobId,
986
+ message: `⚠️ IMPORTANT: Monitor this job in background to avoid token waste from polling.\n\nDo NOT poll check_translation_status in a loop. Use async/background execution instead.`,
987
+ estimatedTime: parsed.estimatedTime,
988
+ fileSize: parsed.fileSize
989
+ }, null, 2)
990
+ }]
991
+ };
979
992
  }
980
993
  } catch {
981
994
  // Not JSON or not an async response, return as-is
982
995
  }
983
996
  }
984
-
997
+
985
998
  return result;
986
999
 
987
1000
  } catch (error) {
@@ -1897,7 +1910,7 @@ async function handleDownloadTranslations(args) {
1897
1910
  throw new Error(`No translations available. Expected downloadUrls in response.`);
1898
1911
  }
1899
1912
 
1900
- // Return success with file paths
1913
+ // Return success with file paths and instructions for consumer
1901
1914
  return {
1902
1915
  content: [{
1903
1916
  type: 'text',
@@ -1908,7 +1921,8 @@ async function handleDownloadTranslations(args) {
1908
1921
  filesWritten,
1909
1922
  fileName: parsedResult.fileName,
1910
1923
  targetLanguages: parsedResult.targetLanguages,
1911
- message: `✅ Downloaded ${filesWritten.length} translation files to ${outputDir}`
1924
+ message: `✅ Downloaded ${filesWritten.length} translation files to ${outputDir}`,
1925
+ action_required: `Copy each translated file to its correct locale folder. Common patterns: locales/{lang}/${parsedResult.fileName || 'file.json'}, locales/{lang}.json, or {filename}.{lang}.json. Match the source file's directory structure.`
1912
1926
  }, null, 2)
1913
1927
  }]
1914
1928
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@i18n-agent/mcp-client",
3
- "version": "1.9.3",
3
+ "version": "1.9.5",
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": {