@i18n-agent/mcp-client 1.9.2 → 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.
- package/mcp-client.js +28 -17
- 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.
|
|
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
|
|
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
|
-
|
|
977
|
-
|
|
978
|
-
|
|
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) {
|
|
@@ -1828,8 +1841,6 @@ async function handleDownloadTranslations(args) {
|
|
|
1828
1841
|
parsedResult = result;
|
|
1829
1842
|
}
|
|
1830
1843
|
|
|
1831
|
-
// Detect storage type and handle accordingly
|
|
1832
|
-
const storageType = parsedResult.storageType || 'local';
|
|
1833
1844
|
const outputDir = `/tmp/i18n-translations-${jobId}`;
|
|
1834
1845
|
|
|
1835
1846
|
// Create output directory
|
|
@@ -1839,8 +1850,8 @@ async function handleDownloadTranslations(args) {
|
|
|
1839
1850
|
|
|
1840
1851
|
const filesWritten = [];
|
|
1841
1852
|
|
|
1842
|
-
if (
|
|
1843
|
-
//
|
|
1853
|
+
if (parsedResult.downloadUrls && Object.keys(parsedResult.downloadUrls).length > 0) {
|
|
1854
|
+
// Download files from S3 presigned URLs
|
|
1844
1855
|
console.error(`📥 Downloading ${Object.keys(parsedResult.downloadUrls).length} translation files from S3...`);
|
|
1845
1856
|
|
|
1846
1857
|
for (const [language, downloadUrl] of Object.entries(parsedResult.downloadUrls)) {
|
|
@@ -1896,10 +1907,10 @@ async function handleDownloadTranslations(args) {
|
|
|
1896
1907
|
}
|
|
1897
1908
|
} else {
|
|
1898
1909
|
// No valid download method found
|
|
1899
|
-
throw new Error(`No translations available.
|
|
1910
|
+
throw new Error(`No translations available. Expected downloadUrls in response.`);
|
|
1900
1911
|
}
|
|
1901
1912
|
|
|
1902
|
-
// Return success with file paths
|
|
1913
|
+
// Return success with file paths and instructions for consumer
|
|
1903
1914
|
return {
|
|
1904
1915
|
content: [{
|
|
1905
1916
|
type: 'text',
|
|
@@ -1908,10 +1919,10 @@ async function handleDownloadTranslations(args) {
|
|
|
1908
1919
|
jobId,
|
|
1909
1920
|
outputDirectory: outputDir,
|
|
1910
1921
|
filesWritten,
|
|
1911
|
-
storageType,
|
|
1912
1922
|
fileName: parsedResult.fileName,
|
|
1913
1923
|
targetLanguages: parsedResult.targetLanguages,
|
|
1914
|
-
message: `✅
|
|
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.`
|
|
1915
1926
|
}, null, 2)
|
|
1916
1927
|
}]
|
|
1917
1928
|
};
|
|
@@ -2172,7 +2183,7 @@ async function handleParallelDocumentUpload(args) {
|
|
|
2172
2183
|
return {
|
|
2173
2184
|
content: [{
|
|
2174
2185
|
type: 'text',
|
|
2175
|
-
text: `✅
|
|
2186
|
+
text: `✅ Translation Upload Successful\n\n` +
|
|
2176
2187
|
`📂 Namespace: ${finalNamespace}\n` +
|
|
2177
2188
|
`📄 Source: ${sourceFilePath ? path.basename(sourceFilePath) : 'source content'}\n` +
|
|
2178
2189
|
`📄 Target: ${targetFilePath ? path.basename(targetFilePath) : 'target content'}\n` +
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@i18n-agent/mcp-client",
|
|
3
|
-
"version": "1.9.
|
|
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": {
|