@i18n-agent/mcp-client 1.8.2 โ 1.8.4
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/install.js +85 -21
- package/package.json +1 -1
package/install.js
CHANGED
|
@@ -9,6 +9,7 @@ import fs from 'fs';
|
|
|
9
9
|
import path from 'path';
|
|
10
10
|
import os from 'os';
|
|
11
11
|
import { fileURLToPath } from 'url';
|
|
12
|
+
import { execSync } from 'child_process';
|
|
12
13
|
|
|
13
14
|
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
14
15
|
|
|
@@ -46,8 +47,8 @@ const IDE_CONFIGS = {
|
|
|
46
47
|
},
|
|
47
48
|
'claude-code': {
|
|
48
49
|
name: 'Claude Code CLI',
|
|
49
|
-
configPath: path.join(os.homedir(), '.claude.json'),
|
|
50
|
-
displayPath: '~/.claude.json'
|
|
50
|
+
configPath: path.join(os.homedir(), '.config/claude/claude_code_config.json'),
|
|
51
|
+
displayPath: '~/.config/claude/claude_code_config.json'
|
|
51
52
|
},
|
|
52
53
|
cursor: {
|
|
53
54
|
name: 'Cursor',
|
|
@@ -83,21 +84,55 @@ Features:
|
|
|
83
84
|
`);
|
|
84
85
|
|
|
85
86
|
const getMcpClientPaths = () => {
|
|
86
|
-
|
|
87
|
-
const
|
|
88
|
-
|
|
87
|
+
// Instead of using ephemeral npx cache, install to stable location
|
|
88
|
+
const stableDir = path.join(os.homedir(), '.claude', 'mcp-servers', 'i18n-agent');
|
|
89
|
+
const mcpClientPath = path.join(stableDir, 'mcp-client.js');
|
|
90
|
+
const packageDir = stableDir;
|
|
91
|
+
return { mcpClientPath, packageDir, sourceFile: path.resolve(__dirname, 'mcp-client.js') };
|
|
89
92
|
};
|
|
90
93
|
|
|
94
|
+
function copyMcpClientToStableLocation() {
|
|
95
|
+
const paths = getMcpClientPaths();
|
|
96
|
+
|
|
97
|
+
// Create stable directory
|
|
98
|
+
fs.mkdirSync(paths.packageDir, { recursive: true });
|
|
99
|
+
|
|
100
|
+
// Copy mcp-client.js to stable location
|
|
101
|
+
fs.copyFileSync(paths.sourceFile, paths.mcpClientPath);
|
|
102
|
+
|
|
103
|
+
// Copy package.json to stable location
|
|
104
|
+
const packageJsonSource = path.resolve(__dirname, 'package.json');
|
|
105
|
+
const packageJsonDest = path.join(paths.packageDir, 'package.json');
|
|
106
|
+
fs.copyFileSync(packageJsonSource, packageJsonDest);
|
|
107
|
+
|
|
108
|
+
// Install dependencies
|
|
109
|
+
console.log(` ๐ฆ Installing dependencies...`);
|
|
110
|
+
try {
|
|
111
|
+
execSync('npm install --production --silent', {
|
|
112
|
+
cwd: paths.packageDir,
|
|
113
|
+
stdio: 'pipe'
|
|
114
|
+
});
|
|
115
|
+
console.log(` โ
Dependencies installed successfully`);
|
|
116
|
+
} catch (error) {
|
|
117
|
+
console.error(` โ ๏ธ Warning: Failed to install dependencies automatically`);
|
|
118
|
+
console.error(` ๐ก Run manually: cd ${paths.packageDir} && npm install`);
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
console.log(` ๐ฆ Installed MCP client to: ${paths.packageDir}`);
|
|
122
|
+
|
|
123
|
+
return paths;
|
|
124
|
+
}
|
|
125
|
+
|
|
91
126
|
async function detectAvailableIDEs() {
|
|
92
127
|
const available = [];
|
|
93
|
-
|
|
128
|
+
|
|
94
129
|
for (const [key, config] of Object.entries(IDE_CONFIGS)) {
|
|
95
130
|
const configDir = path.dirname(config.configPath);
|
|
96
131
|
if (fs.existsSync(configDir)) {
|
|
97
132
|
available.push({ key, ...config });
|
|
98
133
|
}
|
|
99
134
|
}
|
|
100
|
-
|
|
135
|
+
|
|
101
136
|
return available;
|
|
102
137
|
}
|
|
103
138
|
|
|
@@ -236,7 +271,12 @@ function updateGenericMCPConfig(configPath) {
|
|
|
236
271
|
async function main() {
|
|
237
272
|
try {
|
|
238
273
|
console.log('๐ Detecting available AI IDEs...\n');
|
|
239
|
-
|
|
274
|
+
|
|
275
|
+
// First, copy MCP client to stable location
|
|
276
|
+
console.log('๐ฆ Installing MCP client files...');
|
|
277
|
+
copyMcpClientToStableLocation();
|
|
278
|
+
console.log('');
|
|
279
|
+
|
|
240
280
|
const availableIDEs = await detectAvailableIDEs();
|
|
241
281
|
|
|
242
282
|
if (availableIDEs.length === 0) {
|
|
@@ -312,32 +352,56 @@ For manual setup instructions, visit: https://docs.i18nagent.ai/setup
|
|
|
312
352
|
|
|
313
353
|
console.log(`๐ Installation complete! Configured ${installCount} IDE(s).
|
|
314
354
|
|
|
315
|
-
๐
|
|
316
|
-
|
|
317
|
-
1
|
|
355
|
+
๐ CRITICAL: Add your API key (required for MCP client to work)
|
|
356
|
+
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
|
357
|
+
Step 1: Get your API key
|
|
358
|
+
๐ Visit: https://app.i18nagent.ai
|
|
359
|
+
๐ Sign up or log in
|
|
360
|
+
๐ Copy your API key (starts with "i18n_")
|
|
318
361
|
|
|
319
|
-
2
|
|
362
|
+
Step 2: Add API key to config file(s)
|
|
320
363
|
${configPaths}
|
|
321
364
|
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
365
|
+
Option A - Edit config file directly (RECOMMENDED):
|
|
366
|
+
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
|
367
|
+
Open the config file and find the "env" section:
|
|
368
|
+
|
|
369
|
+
"mcpServers": {
|
|
370
|
+
"i18n-agent": {
|
|
371
|
+
"command": "...",
|
|
372
|
+
"env": {
|
|
373
|
+
"MCP_SERVER_URL": "https://mcp.i18nagent.ai",
|
|
374
|
+
"API_KEY": "" โ Paste your API key here (between the quotes)
|
|
375
|
+
}
|
|
376
|
+
}
|
|
326
377
|
}
|
|
327
378
|
|
|
328
|
-
|
|
379
|
+
Example with actual key:
|
|
380
|
+
"API_KEY": "i18n_1234567890abcdef"
|
|
381
|
+
|
|
382
|
+
Option B - Use environment variable:
|
|
383
|
+
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
|
329
384
|
${envVarInstructions}
|
|
330
385
|
|
|
331
|
-
3
|
|
386
|
+
Step 3: Restart your IDE
|
|
387
|
+
Close and reopen your IDE to load the new configuration
|
|
332
388
|
|
|
333
389
|
๐งช Test the installation
|
|
390
|
+
โโโโโโโโโโโโโโโโโโโโโโ
|
|
334
391
|
Try these commands in your AI IDE:
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
392
|
+
โ "Translate 'Hello world' to Spanish"
|
|
393
|
+
โ "Check my translation credits"
|
|
394
|
+
โ "List supported languages"
|
|
395
|
+
|
|
396
|
+
If you get "Invalid API key" errors, double-check:
|
|
397
|
+
- API key is correctly pasted in the config file
|
|
398
|
+
- No extra spaces or quotes around the key
|
|
399
|
+
- Config file is saved
|
|
400
|
+
- IDE has been restarted
|
|
338
401
|
|
|
339
402
|
๐ Documentation: https://docs.i18nagent.ai
|
|
340
403
|
๐ Issues: https://github.com/i18n-agent/mcp-client/issues
|
|
404
|
+
๐ฌ Support: support@i18nagent.ai
|
|
341
405
|
`);
|
|
342
406
|
} else {
|
|
343
407
|
console.error('โ Installation failed for all IDEs. Please check the error messages above.');
|
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.4",
|
|
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": {
|