@i18n-agent/mcp-client 1.8.13 ā 1.8.14
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 +78 -12
- package/package.json +1 -1
package/install.js
CHANGED
|
@@ -78,9 +78,6 @@ Features:
|
|
|
78
78
|
š File translation (JSON, YAML, CSV, MD, etc.)
|
|
79
79
|
š° Credit balance checking
|
|
80
80
|
š 48 languages supported with regional variants
|
|
81
|
-
|
|
82
|
-
š IMPORTANT: Get your API key at https://app.i18nagent.ai
|
|
83
|
-
(Required for the MCP client to work)
|
|
84
81
|
`);
|
|
85
82
|
|
|
86
83
|
const getMcpClientPaths = () => {
|
|
@@ -136,6 +133,45 @@ async function detectAvailableIDEs() {
|
|
|
136
133
|
return available;
|
|
137
134
|
}
|
|
138
135
|
|
|
136
|
+
function checkExistingApiKey(configPath) {
|
|
137
|
+
if (!fs.existsSync(configPath)) {
|
|
138
|
+
return false;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
try {
|
|
142
|
+
const content = fs.readFileSync(configPath, 'utf8');
|
|
143
|
+
const config = JSON.parse(content);
|
|
144
|
+
const apiKey = config.mcpServers?.["i18n-agent"]?.env?.API_KEY;
|
|
145
|
+
return apiKey && apiKey.trim() !== '';
|
|
146
|
+
} catch (error) {
|
|
147
|
+
return false;
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
async function checkExistingApiKeys(availableIDEs) {
|
|
152
|
+
const withKeys = [];
|
|
153
|
+
const withoutKeys = [];
|
|
154
|
+
|
|
155
|
+
for (const ide of availableIDEs) {
|
|
156
|
+
// Also check ~/.claude.json for Claude Code CLI
|
|
157
|
+
if (ide.key === 'claude-code') {
|
|
158
|
+
const claudeJsonPath = path.join(os.homedir(), '.claude.json');
|
|
159
|
+
if (checkExistingApiKey(claudeJsonPath)) {
|
|
160
|
+
withKeys.push(ide);
|
|
161
|
+
continue;
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
if (checkExistingApiKey(ide.configPath)) {
|
|
166
|
+
withKeys.push(ide);
|
|
167
|
+
} else {
|
|
168
|
+
withoutKeys.push(ide);
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
return { withKeys, withoutKeys };
|
|
173
|
+
}
|
|
174
|
+
|
|
139
175
|
function createMCPConfig() {
|
|
140
176
|
const { mcpClientPath, packageDir } = getMcpClientPaths();
|
|
141
177
|
|
|
@@ -392,13 +428,8 @@ async function main() {
|
|
|
392
428
|
try {
|
|
393
429
|
console.log('š Detecting available AI IDEs...\n');
|
|
394
430
|
|
|
395
|
-
// First, copy MCP client to stable location
|
|
396
|
-
console.log('š¦ Installing MCP client files...');
|
|
397
|
-
copyMcpClientToStableLocation();
|
|
398
|
-
console.log('');
|
|
399
|
-
|
|
400
431
|
const availableIDEs = await detectAvailableIDEs();
|
|
401
|
-
|
|
432
|
+
|
|
402
433
|
if (availableIDEs.length === 0) {
|
|
403
434
|
console.log(`ā No supported AI IDEs detected.
|
|
404
435
|
|
|
@@ -418,13 +449,48 @@ For manual setup instructions, visit: https://docs.i18nagent.ai/setup
|
|
|
418
449
|
`);
|
|
419
450
|
process.exit(1);
|
|
420
451
|
}
|
|
421
|
-
|
|
452
|
+
|
|
422
453
|
console.log('ā
Available AI IDEs:');
|
|
423
454
|
availableIDEs.forEach((ide, index) => {
|
|
424
455
|
console.log(`${index + 1}. ${ide.name}`);
|
|
425
456
|
});
|
|
426
|
-
|
|
427
|
-
|
|
457
|
+
console.log('');
|
|
458
|
+
|
|
459
|
+
// Check for existing API keys BEFORE installation
|
|
460
|
+
const { withKeys, withoutKeys } = await checkExistingApiKeys(availableIDEs);
|
|
461
|
+
|
|
462
|
+
if (withKeys.length > 0 && withoutKeys.length === 0) {
|
|
463
|
+
console.log(`ā
API Keys Already Configured:`);
|
|
464
|
+
withKeys.forEach(ide => {
|
|
465
|
+
console.log(` - ${ide.name}`);
|
|
466
|
+
});
|
|
467
|
+
console.log(`\nš Your API keys are preserved. Updating MCP client files only...\n`);
|
|
468
|
+
} else if (withKeys.length > 0 && withoutKeys.length > 0) {
|
|
469
|
+
// Mixed case: some have keys, some don't
|
|
470
|
+
console.log(`ā
API Keys Already Configured:`);
|
|
471
|
+
withKeys.forEach(ide => {
|
|
472
|
+
console.log(` - ${ide.name}`);
|
|
473
|
+
});
|
|
474
|
+
console.log(`\nš API Key Setup Required:`);
|
|
475
|
+
withoutKeys.forEach(ide => {
|
|
476
|
+
console.log(` - ${ide.name}`);
|
|
477
|
+
});
|
|
478
|
+
console.log(`\nš Existing API keys will be preserved.`);
|
|
479
|
+
console.log(`š” Get your API key at: https://app.i18nagent.ai\n`);
|
|
480
|
+
} else if (withoutKeys.length > 0) {
|
|
481
|
+
console.log(`š API Key Setup Required:`);
|
|
482
|
+
withoutKeys.forEach(ide => {
|
|
483
|
+
console.log(` - ${ide.name}`);
|
|
484
|
+
});
|
|
485
|
+
console.log(`\nš” Get your API key at: https://app.i18nagent.ai\n`);
|
|
486
|
+
}
|
|
487
|
+
|
|
488
|
+
// Now copy MCP client to stable location
|
|
489
|
+
console.log('š¦ Installing MCP client files...');
|
|
490
|
+
copyMcpClientToStableLocation();
|
|
491
|
+
console.log('');
|
|
492
|
+
|
|
493
|
+
console.log('š Updating configurations...\n');
|
|
428
494
|
|
|
429
495
|
let installCount = 0;
|
|
430
496
|
const installedIDEs = [];
|
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.14",
|
|
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": {
|