@i18n-agent/mcp-client 1.8.455 → 1.8.462
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 +17 -22
- package/package.json +3 -2
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.
|
|
8
|
+
const MCP_CLIENT_VERSION = '1.8.461';
|
|
9
9
|
|
|
10
10
|
import { Server } from '@modelcontextprotocol/sdk/server/index.js';
|
|
11
11
|
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
|
|
@@ -18,6 +18,7 @@ import {
|
|
|
18
18
|
import axios from 'axios';
|
|
19
19
|
import fs from 'fs';
|
|
20
20
|
import path from 'path';
|
|
21
|
+
import FormData from 'form-data';
|
|
21
22
|
import { detectNamespaceFromPath, generateNamespaceSuggestions, getNamespaceSuggestionText } from './namespace-detector.js';
|
|
22
23
|
|
|
23
24
|
const server = new Server(
|
|
@@ -375,7 +376,7 @@ server.setRequestHandler(ListToolsRequestSchema, async () => {
|
|
|
375
376
|
},
|
|
376
377
|
{
|
|
377
378
|
name: 'upload_translations',
|
|
378
|
-
description: 'Upload existing translations for reuse to reduce
|
|
379
|
+
description: 'Upload existing translations for reuse to reduce costs. Provide sourceFilePath (original language file) and targetFilePath (translated file) with sourceLocale and targetLocale. Example: sourceFilePath="/docs/en/guide.md", targetFilePath="/docs/de/guide.md", sourceLocale="en", targetLocale="de". Supports JSON, YAML, PO, XLIFF, MD, TXT, HTML. Namespace is auto-detected or can be explicitly provided.',
|
|
379
380
|
inputSchema: {
|
|
380
381
|
type: 'object',
|
|
381
382
|
properties: {
|
|
@@ -2045,28 +2046,22 @@ async function handleSingleFileUpload(args) {
|
|
|
2045
2046
|
// Detect file type if auto
|
|
2046
2047
|
const detectedFileType = fileType === 'auto' ? path.extname(filePath || 'file').slice(1) || 'json' : fileType;
|
|
2047
2048
|
|
|
2048
|
-
// Build request
|
|
2049
|
-
const
|
|
2050
|
-
|
|
2051
|
-
|
|
2052
|
-
|
|
2053
|
-
|
|
2054
|
-
|
|
2055
|
-
sourceLocale,
|
|
2056
|
-
targetLocale
|
|
2057
|
-
};
|
|
2049
|
+
// Build request using FormData (server expects multipart/form-data)
|
|
2050
|
+
const fileName = filePath ? path.basename(filePath) : 'uploaded-file';
|
|
2051
|
+
|
|
2052
|
+
const formData = new FormData();
|
|
2053
|
+
formData.append('file', content, fileName);
|
|
2054
|
+
formData.append('sourceLocale', sourceLocale);
|
|
2055
|
+
formData.append('targetLocale', targetLocale);
|
|
2058
2056
|
|
|
2059
2057
|
try {
|
|
2060
|
-
const response = await axios.post(
|
|
2061
|
-
|
|
2058
|
+
const response = await axios.post(
|
|
2059
|
+
`${MCP_SERVER_URL}/namespaces/${finalNamespace}/translations/upload`,
|
|
2060
|
+
formData,
|
|
2062
2061
|
{
|
|
2063
2062
|
headers: {
|
|
2064
|
-
'Content-Type': 'text/plain',
|
|
2065
2063
|
'Authorization': `Bearer ${API_KEY}`,
|
|
2066
|
-
|
|
2067
|
-
'X-Target-Locale': targetLocale,
|
|
2068
|
-
'X-File-Name': requestData.fileName,
|
|
2069
|
-
'X-File-Type': detectedFileType
|
|
2064
|
+
...formData.getHeaders()
|
|
2070
2065
|
},
|
|
2071
2066
|
timeout: 60000
|
|
2072
2067
|
}
|
|
@@ -2083,7 +2078,7 @@ async function handleSingleFileUpload(args) {
|
|
|
2083
2078
|
type: 'text',
|
|
2084
2079
|
text: `✅ Translation Upload Successful\n\n` +
|
|
2085
2080
|
`📂 Namespace: ${finalNamespace}${detectionInfo ? ` (auto-detected)` : ''}\n` +
|
|
2086
|
-
`📄 File: ${
|
|
2081
|
+
`📄 File: ${fileName}\n` +
|
|
2087
2082
|
`🌍 Languages: ${sourceLocale} → ${targetLocale}\n` +
|
|
2088
2083
|
`✨ Translation Pairs Stored: ${result.pairsStored || 0}\n` +
|
|
2089
2084
|
`🔄 Translation Pairs Updated: ${result.pairsUpdated || 0}\n\n` +
|
|
@@ -2167,8 +2162,8 @@ async function handleParallelDocumentUpload(args) {
|
|
|
2167
2162
|
|
|
2168
2163
|
// Build request
|
|
2169
2164
|
const formData = new FormData();
|
|
2170
|
-
formData.append('sourceFile',
|
|
2171
|
-
formData.append('targetFile',
|
|
2165
|
+
formData.append('sourceFile', sourceContent, sourceFilePath ? path.basename(sourceFilePath) : 'source.md');
|
|
2166
|
+
formData.append('targetFile', targetContent, targetFilePath ? path.basename(targetFilePath) : 'target.md');
|
|
2172
2167
|
formData.append('sourceLanguage', sourceLocale);
|
|
2173
2168
|
formData.append('targetLanguage', targetLocale);
|
|
2174
2169
|
formData.append('namespace', finalNamespace);
|
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.462",
|
|
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": {
|
|
@@ -35,7 +35,8 @@
|
|
|
35
35
|
"homepage": "https://i18nagent.ai",
|
|
36
36
|
"dependencies": {
|
|
37
37
|
"@modelcontextprotocol/sdk": "^1.0.0",
|
|
38
|
-
"axios": "^1.6.0"
|
|
38
|
+
"axios": "^1.6.0",
|
|
39
|
+
"form-data": "^4.0.0"
|
|
39
40
|
},
|
|
40
41
|
"engines": {
|
|
41
42
|
"node": ">=16.0.0"
|