ccjk 2.3.2 → 2.4.2
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/README.md +270 -444
- package/README.zh-CN.md +273 -447
- package/dist/chunks/api-providers.mjs +5 -35
- package/dist/chunks/auto-bootstrap.mjs +1 -1
- package/dist/chunks/ccr.mjs +5 -2
- package/dist/chunks/claude-wrapper.mjs +442 -0
- package/dist/chunks/cloud-sync.mjs +29 -0
- package/dist/chunks/constants.mjs +1 -1
- package/dist/chunks/context-manager.mjs +641 -0
- package/dist/chunks/context.mjs +248 -0
- package/dist/chunks/index2.mjs +2 -0
- package/dist/chunks/index3.mjs +19 -19
- package/dist/chunks/init.mjs +18 -8
- package/dist/chunks/marketplace.mjs +6 -2
- package/dist/chunks/mcp.mjs +1 -1
- package/dist/chunks/menu.mjs +3 -3
- package/dist/chunks/notification.mjs +27 -27
- package/dist/chunks/package.mjs +1 -1
- package/dist/chunks/platform.mjs +70 -21
- package/dist/chunks/skills-sync.mjs +1 -1
- package/dist/chunks/version-checker.mjs +31 -31
- package/dist/cli.mjs +55 -5
- package/dist/i18n/locales/en/context.json +32 -0
- package/dist/i18n/locales/en/marketplace.json +1 -0
- package/dist/i18n/locales/en/mcp.json +12 -1
- package/dist/i18n/locales/en/superpowers.json +46 -0
- package/dist/i18n/locales/zh-CN/context.json +32 -0
- package/dist/i18n/locales/zh-CN/marketplace.json +1 -0
- package/dist/i18n/locales/zh-CN/mcp.json +12 -1
- package/dist/i18n/locales/zh-CN/superpowers.json +46 -0
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/shared/ccjk.QbS8EAOd.mjs +1019 -0
- package/dist/shared/ccjk.RR9TS76h.mjs +698 -0
- package/package.json +4 -1
- package/dist/shared/ccjk.Bi-m3LKY.mjs +0 -357
- package/dist/shared/ccjk.D-RZS4E2.mjs +0 -416
|
@@ -1,416 +0,0 @@
|
|
|
1
|
-
import ansis from 'ansis';
|
|
2
|
-
import inquirer from 'inquirer';
|
|
3
|
-
import { af as getMcpService, r as readCodexConfig, Z as applyCodexPlatformCommand, w as writeCodexConfig, e as readMcpConfig, j as buildMcpServerConfig, f as writeMcpConfig, ab as MCP_SERVICE_CONFIGS } from '../chunks/codex.mjs';
|
|
4
|
-
import { ensureI18nInitialized, i18n } from '../chunks/index2.mjs';
|
|
5
|
-
import { ClAUDE_CONFIG_FILE, CODEX_CONFIG_FILE } from '../chunks/constants.mjs';
|
|
6
|
-
import { exists } from '../chunks/fs-operations.mjs';
|
|
7
|
-
import { isWindows, getSystemRoot } from '../chunks/platform.mjs';
|
|
8
|
-
|
|
9
|
-
function detectActiveTool() {
|
|
10
|
-
const hasClaudeConfig = exists(ClAUDE_CONFIG_FILE);
|
|
11
|
-
const hasCodexConfig = exists(CODEX_CONFIG_FILE);
|
|
12
|
-
if (hasClaudeConfig) {
|
|
13
|
-
return "claude-code";
|
|
14
|
-
}
|
|
15
|
-
if (hasCodexConfig) {
|
|
16
|
-
return "codex";
|
|
17
|
-
}
|
|
18
|
-
return "claude-code";
|
|
19
|
-
}
|
|
20
|
-
async function installMcpService(serviceId, tool, apiKey) {
|
|
21
|
-
ensureI18nInitialized();
|
|
22
|
-
const service = await getMcpService(serviceId);
|
|
23
|
-
if (!service) {
|
|
24
|
-
return {
|
|
25
|
-
success: false,
|
|
26
|
-
serviceId,
|
|
27
|
-
serviceName: serviceId,
|
|
28
|
-
error: i18n.t("mcp:installer.serviceNotFound", { id: serviceId })
|
|
29
|
-
};
|
|
30
|
-
}
|
|
31
|
-
if (service.requiresApiKey && !apiKey) {
|
|
32
|
-
const promptMessage = service.apiKeyPrompt || i18n.t("mcp:apiKeyPrompt");
|
|
33
|
-
const { inputApiKey } = await inquirer.prompt([{
|
|
34
|
-
type: "input",
|
|
35
|
-
name: "inputApiKey",
|
|
36
|
-
message: promptMessage,
|
|
37
|
-
validate: (input) => !!input || i18n.t("api:keyRequired")
|
|
38
|
-
}]);
|
|
39
|
-
if (!inputApiKey) {
|
|
40
|
-
return {
|
|
41
|
-
success: false,
|
|
42
|
-
serviceId,
|
|
43
|
-
serviceName: service.name,
|
|
44
|
-
error: i18n.t("mcp:installer.apiKeyRequired")
|
|
45
|
-
};
|
|
46
|
-
}
|
|
47
|
-
apiKey = inputApiKey;
|
|
48
|
-
}
|
|
49
|
-
const targetTool = tool || detectActiveTool();
|
|
50
|
-
try {
|
|
51
|
-
if (targetTool === "codex") {
|
|
52
|
-
await installMcpServiceForCodex(serviceId, service.config, apiKey, service.apiKeyEnvVar);
|
|
53
|
-
} else {
|
|
54
|
-
await installMcpServiceForClaudeCode(serviceId, service.config, apiKey, service.apiKeyEnvVar);
|
|
55
|
-
}
|
|
56
|
-
return {
|
|
57
|
-
success: true,
|
|
58
|
-
serviceId,
|
|
59
|
-
serviceName: service.name
|
|
60
|
-
};
|
|
61
|
-
} catch (error) {
|
|
62
|
-
return {
|
|
63
|
-
success: false,
|
|
64
|
-
serviceId,
|
|
65
|
-
serviceName: service.name,
|
|
66
|
-
error: error instanceof Error ? error.message : String(error)
|
|
67
|
-
};
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
async function installMcpServiceForClaudeCode(serviceId, baseConfig, apiKey, apiKeyEnvVar) {
|
|
71
|
-
let config = readMcpConfig();
|
|
72
|
-
if (!config) {
|
|
73
|
-
config = { mcpServers: {} };
|
|
74
|
-
}
|
|
75
|
-
const serverConfig = buildMcpServerConfig(
|
|
76
|
-
baseConfig,
|
|
77
|
-
apiKey,
|
|
78
|
-
apiKeyEnvVar ? `YOUR_${apiKeyEnvVar}` : "YOUR_API_KEY",
|
|
79
|
-
apiKeyEnvVar
|
|
80
|
-
);
|
|
81
|
-
if (!config.mcpServers) {
|
|
82
|
-
config.mcpServers = {};
|
|
83
|
-
}
|
|
84
|
-
config.mcpServers[serviceId] = serverConfig;
|
|
85
|
-
writeMcpConfig(config);
|
|
86
|
-
}
|
|
87
|
-
async function installMcpServiceForCodex(serviceId, baseConfig, apiKey, apiKeyEnvVar) {
|
|
88
|
-
const existingConfig = readCodexConfig();
|
|
89
|
-
let command = baseConfig.command || serviceId;
|
|
90
|
-
let args = (baseConfig.args || []).map((arg) => String(arg));
|
|
91
|
-
if (serviceId === "serena") {
|
|
92
|
-
const idx = args.indexOf("--context");
|
|
93
|
-
if (idx >= 0 && idx + 1 < args.length) {
|
|
94
|
-
args[idx + 1] = "codex";
|
|
95
|
-
} else {
|
|
96
|
-
args.push("--context", "codex");
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
const serviceConfig = { id: serviceId.toLowerCase(), command, args };
|
|
100
|
-
applyCodexPlatformCommand(serviceConfig);
|
|
101
|
-
command = serviceConfig.command;
|
|
102
|
-
args = serviceConfig.args || [];
|
|
103
|
-
const env = { ...baseConfig.env || {} };
|
|
104
|
-
if (isWindows()) {
|
|
105
|
-
const systemRoot = getSystemRoot();
|
|
106
|
-
if (systemRoot) {
|
|
107
|
-
env.SYSTEMROOT = systemRoot;
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
if (apiKey && apiKeyEnvVar) {
|
|
111
|
-
env[apiKeyEnvVar] = apiKey;
|
|
112
|
-
}
|
|
113
|
-
const newService = {
|
|
114
|
-
id: serviceId.toLowerCase(),
|
|
115
|
-
command,
|
|
116
|
-
args,
|
|
117
|
-
env: Object.keys(env).length > 0 ? env : void 0,
|
|
118
|
-
startup_timeout_sec: 30
|
|
119
|
-
};
|
|
120
|
-
const existingServices = existingConfig?.mcpServices || [];
|
|
121
|
-
const mergedMap = /* @__PURE__ */ new Map();
|
|
122
|
-
for (const svc of existingServices) {
|
|
123
|
-
mergedMap.set(svc.id.toLowerCase(), { ...svc });
|
|
124
|
-
}
|
|
125
|
-
mergedMap.set(newService.id, newService);
|
|
126
|
-
const finalServices = Array.from(mergedMap.values());
|
|
127
|
-
const configData = {
|
|
128
|
-
model: existingConfig?.model || null,
|
|
129
|
-
modelProvider: existingConfig?.modelProvider || null,
|
|
130
|
-
providers: existingConfig?.providers || [],
|
|
131
|
-
mcpServices: finalServices,
|
|
132
|
-
otherConfig: existingConfig?.otherConfig || []
|
|
133
|
-
};
|
|
134
|
-
writeCodexConfig(configData);
|
|
135
|
-
}
|
|
136
|
-
async function uninstallMcpService(serviceId, tool) {
|
|
137
|
-
ensureI18nInitialized();
|
|
138
|
-
const targetTool = tool || detectActiveTool();
|
|
139
|
-
try {
|
|
140
|
-
if (targetTool === "codex") {
|
|
141
|
-
await uninstallMcpServiceFromCodex(serviceId);
|
|
142
|
-
} else {
|
|
143
|
-
await uninstallMcpServiceFromClaudeCode(serviceId);
|
|
144
|
-
}
|
|
145
|
-
return {
|
|
146
|
-
success: true,
|
|
147
|
-
serviceId
|
|
148
|
-
};
|
|
149
|
-
} catch (error) {
|
|
150
|
-
return {
|
|
151
|
-
success: false,
|
|
152
|
-
serviceId,
|
|
153
|
-
error: error instanceof Error ? error.message : String(error)
|
|
154
|
-
};
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
async function uninstallMcpServiceFromClaudeCode(serviceId) {
|
|
158
|
-
const config = readMcpConfig();
|
|
159
|
-
if (!config || !config.mcpServers) {
|
|
160
|
-
throw new Error(i18n.t("mcp:installer.noConfig"));
|
|
161
|
-
}
|
|
162
|
-
const normalizedId = serviceId.toLowerCase();
|
|
163
|
-
const existingKey = Object.keys(config.mcpServers).find(
|
|
164
|
-
(key) => key.toLowerCase() === normalizedId
|
|
165
|
-
);
|
|
166
|
-
if (!existingKey) {
|
|
167
|
-
throw new Error(i18n.t("mcp:installer.serviceNotInstalled", { id: serviceId }));
|
|
168
|
-
}
|
|
169
|
-
delete config.mcpServers[existingKey];
|
|
170
|
-
writeMcpConfig(config);
|
|
171
|
-
}
|
|
172
|
-
async function uninstallMcpServiceFromCodex(serviceId) {
|
|
173
|
-
const existingConfig = readCodexConfig();
|
|
174
|
-
if (!existingConfig || !existingConfig.mcpServices) {
|
|
175
|
-
throw new Error(i18n.t("mcp:installer.noConfig"));
|
|
176
|
-
}
|
|
177
|
-
const normalizedId = serviceId.toLowerCase();
|
|
178
|
-
const serviceIndex = existingConfig.mcpServices.findIndex(
|
|
179
|
-
(svc) => svc.id.toLowerCase() === normalizedId
|
|
180
|
-
);
|
|
181
|
-
if (serviceIndex === -1) {
|
|
182
|
-
throw new Error(i18n.t("mcp:installer.serviceNotInstalled", { id: serviceId }));
|
|
183
|
-
}
|
|
184
|
-
existingConfig.mcpServices.splice(serviceIndex, 1);
|
|
185
|
-
writeCodexConfig(existingConfig);
|
|
186
|
-
}
|
|
187
|
-
async function listInstalledMcpServices(tool) {
|
|
188
|
-
ensureI18nInitialized();
|
|
189
|
-
const targetTool = tool || detectActiveTool();
|
|
190
|
-
if (targetTool === "codex") {
|
|
191
|
-
return listInstalledMcpServicesFromCodex();
|
|
192
|
-
} else {
|
|
193
|
-
return listInstalledMcpServicesFromClaudeCode();
|
|
194
|
-
}
|
|
195
|
-
}
|
|
196
|
-
function listInstalledMcpServicesFromClaudeCode() {
|
|
197
|
-
const config = readMcpConfig();
|
|
198
|
-
if (!config || !config.mcpServers) {
|
|
199
|
-
return [];
|
|
200
|
-
}
|
|
201
|
-
const services = [];
|
|
202
|
-
for (const [id, serverConfig] of Object.entries(config.mcpServers)) {
|
|
203
|
-
const knownService = MCP_SERVICE_CONFIGS.find(
|
|
204
|
-
(s) => s.id.toLowerCase() === id.toLowerCase()
|
|
205
|
-
);
|
|
206
|
-
services.push({
|
|
207
|
-
id,
|
|
208
|
-
name: knownService?.id || id,
|
|
209
|
-
command: serverConfig.command,
|
|
210
|
-
args: serverConfig.args,
|
|
211
|
-
url: serverConfig.url,
|
|
212
|
-
type: serverConfig.type || "stdio"
|
|
213
|
-
});
|
|
214
|
-
}
|
|
215
|
-
return services;
|
|
216
|
-
}
|
|
217
|
-
function listInstalledMcpServicesFromCodex() {
|
|
218
|
-
const config = readCodexConfig();
|
|
219
|
-
if (!config || !config.mcpServices) {
|
|
220
|
-
return [];
|
|
221
|
-
}
|
|
222
|
-
const services = [];
|
|
223
|
-
for (const svc of config.mcpServices) {
|
|
224
|
-
const knownService = MCP_SERVICE_CONFIGS.find(
|
|
225
|
-
(s) => s.id.toLowerCase() === svc.id.toLowerCase()
|
|
226
|
-
);
|
|
227
|
-
services.push({
|
|
228
|
-
id: svc.id,
|
|
229
|
-
name: knownService?.id || svc.id,
|
|
230
|
-
command: svc.command,
|
|
231
|
-
args: svc.args,
|
|
232
|
-
type: "stdio"
|
|
233
|
-
});
|
|
234
|
-
}
|
|
235
|
-
return services;
|
|
236
|
-
}
|
|
237
|
-
async function isMcpServiceInstalled(serviceId, tool) {
|
|
238
|
-
const installedServices = await listInstalledMcpServices(tool);
|
|
239
|
-
const normalizedId = serviceId.toLowerCase();
|
|
240
|
-
return installedServices.some((svc) => svc.id.toLowerCase() === normalizedId);
|
|
241
|
-
}
|
|
242
|
-
async function displayInstalledMcpServices(tool) {
|
|
243
|
-
ensureI18nInitialized();
|
|
244
|
-
const targetTool = tool || detectActiveTool();
|
|
245
|
-
const services = await listInstalledMcpServices(targetTool);
|
|
246
|
-
if (services.length === 0) {
|
|
247
|
-
console.log(ansis.yellow(i18n.t("mcp:installer.noServicesInstalled")));
|
|
248
|
-
return;
|
|
249
|
-
}
|
|
250
|
-
console.log(ansis.cyan.bold(`
|
|
251
|
-
${i18n.t("mcp:installer.installedServices", { tool: targetTool })}
|
|
252
|
-
`));
|
|
253
|
-
services.forEach((service, idx) => {
|
|
254
|
-
console.log(`${ansis.green(`${idx + 1}.`)} ${ansis.bold(service.name)} ${ansis.dim(`[${service.id}]`)}`);
|
|
255
|
-
if (service.command) {
|
|
256
|
-
console.log(` ${ansis.dim(`Command: ${service.command}`)}`);
|
|
257
|
-
}
|
|
258
|
-
if (service.url) {
|
|
259
|
-
console.log(` ${ansis.dim(`URL: ${service.url}`)}`);
|
|
260
|
-
}
|
|
261
|
-
console.log("");
|
|
262
|
-
});
|
|
263
|
-
}
|
|
264
|
-
|
|
265
|
-
const MCP_SERVERS = [
|
|
266
|
-
// CCJK managed services (from mcp-services config)
|
|
267
|
-
...MCP_SERVICE_CONFIGS.map((svc) => ({
|
|
268
|
-
name: svc.id,
|
|
269
|
-
description: svc.id,
|
|
270
|
-
// Will be replaced with i18n
|
|
271
|
-
package: svc.config.command || svc.id,
|
|
272
|
-
category: "ccjk",
|
|
273
|
-
serviceId: svc.id,
|
|
274
|
-
requiresApiKey: svc.requiresApiKey
|
|
275
|
-
})),
|
|
276
|
-
// External MCP servers from Awesome MCP Servers
|
|
277
|
-
{ name: "Filesystem", description: "Secure file operations", package: "@modelcontextprotocol/server-filesystem", category: "core" },
|
|
278
|
-
{ name: "GitHub", description: "Repository management", package: "@modelcontextprotocol/server-github", category: "dev" },
|
|
279
|
-
{ name: "PostgreSQL", description: "Database operations", package: "@modelcontextprotocol/server-postgres", category: "database" },
|
|
280
|
-
{ name: "Puppeteer", description: "Browser automation", package: "@modelcontextprotocol/server-puppeteer", category: "automation" },
|
|
281
|
-
{ name: "Brave Search", description: "Web search", package: "@modelcontextprotocol/server-brave-search", category: "search" },
|
|
282
|
-
{ name: "Google Maps", description: "Location services", package: "@modelcontextprotocol/server-google-maps", category: "api" },
|
|
283
|
-
{ name: "Slack", description: "Team communication", package: "@modelcontextprotocol/server-slack", category: "communication" },
|
|
284
|
-
{ name: "Memory", description: "Knowledge graph", package: "@modelcontextprotocol/server-memory", category: "ai" }
|
|
285
|
-
];
|
|
286
|
-
async function mcpSearch(keyword, _options = {}) {
|
|
287
|
-
const results = MCP_SERVERS.filter(
|
|
288
|
-
(s) => s.name.toLowerCase().includes(keyword.toLowerCase()) || s.description.toLowerCase().includes(keyword.toLowerCase()) || s.category.toLowerCase().includes(keyword.toLowerCase())
|
|
289
|
-
);
|
|
290
|
-
if (results.length === 0) {
|
|
291
|
-
console.log(ansis.yellow(`
|
|
292
|
-
${i18n.t("mcp:market.noResults", { keyword })}`));
|
|
293
|
-
return;
|
|
294
|
-
}
|
|
295
|
-
console.log(ansis.cyan.bold(`
|
|
296
|
-
${i18n.t("mcp:market.searchResults", { count: results.length, keyword })}
|
|
297
|
-
`));
|
|
298
|
-
results.forEach((server, idx) => {
|
|
299
|
-
console.log(`${ansis.green(`${idx + 1}.`)} ${ansis.bold(server.name)} ${ansis.dim(`[${server.category}]`)}`);
|
|
300
|
-
console.log(` ${server.description}`);
|
|
301
|
-
console.log(` ${ansis.dim(server.package)}
|
|
302
|
-
`);
|
|
303
|
-
});
|
|
304
|
-
}
|
|
305
|
-
async function mcpTrending(_options = {}) {
|
|
306
|
-
console.log(ansis.cyan.bold(`
|
|
307
|
-
${i18n.t("mcp:market.trending")}
|
|
308
|
-
`));
|
|
309
|
-
const trending = MCP_SERVERS.slice(0, 5);
|
|
310
|
-
trending.forEach((server, idx) => {
|
|
311
|
-
console.log(`${ansis.green(`${idx + 1}.`)} ${ansis.bold(server.name)} ${ansis.dim(`[${server.category}]`)}`);
|
|
312
|
-
console.log(` ${server.description}`);
|
|
313
|
-
console.log(` ${ansis.dim(server.package)}
|
|
314
|
-
`);
|
|
315
|
-
});
|
|
316
|
-
}
|
|
317
|
-
async function mcpInstall(serverName, options = {}) {
|
|
318
|
-
const server = MCP_SERVERS.find((s) => s.name.toLowerCase() === serverName.toLowerCase());
|
|
319
|
-
if (!server) {
|
|
320
|
-
console.log(ansis.red(`
|
|
321
|
-
${i18n.t("mcp:market.serverNotFound", { name: serverName })}`));
|
|
322
|
-
return;
|
|
323
|
-
}
|
|
324
|
-
if (server.serviceId) {
|
|
325
|
-
const isInstalled = await isMcpServiceInstalled(server.serviceId, options.tool);
|
|
326
|
-
if (isInstalled) {
|
|
327
|
-
console.log(ansis.yellow(`
|
|
328
|
-
${i18n.t("mcp:installer.alreadyInstalled", { name: server.name })}`));
|
|
329
|
-
return;
|
|
330
|
-
}
|
|
331
|
-
console.log(ansis.cyan(`
|
|
332
|
-
${i18n.t("mcp:market.installing", { name: server.name })}`));
|
|
333
|
-
if (server.requiresApiKey) {
|
|
334
|
-
console.log(ansis.dim(i18n.t("mcp:installer.requiresApiKey")));
|
|
335
|
-
}
|
|
336
|
-
console.log("");
|
|
337
|
-
const { confirm } = await inquirer.prompt([{
|
|
338
|
-
type: "confirm",
|
|
339
|
-
name: "confirm",
|
|
340
|
-
message: i18n.t("mcp:market.confirmInstall"),
|
|
341
|
-
default: true
|
|
342
|
-
}]);
|
|
343
|
-
if (!confirm) {
|
|
344
|
-
console.log(ansis.yellow(i18n.t("mcp:market.cancelled")));
|
|
345
|
-
return;
|
|
346
|
-
}
|
|
347
|
-
const result = await installMcpService(server.serviceId, options.tool);
|
|
348
|
-
if (result.success) {
|
|
349
|
-
console.log(ansis.green(`
|
|
350
|
-
${i18n.t("mcp:market.installSuccess", { name: server.name })}`));
|
|
351
|
-
console.log(ansis.dim(i18n.t("mcp:installer.restartRequired")));
|
|
352
|
-
} else {
|
|
353
|
-
console.log(ansis.red(`
|
|
354
|
-
${i18n.t("mcp:installer.installFailed", { name: server.name })}`));
|
|
355
|
-
if (result.error) {
|
|
356
|
-
console.log(ansis.dim(result.error));
|
|
357
|
-
}
|
|
358
|
-
}
|
|
359
|
-
} else {
|
|
360
|
-
console.log(ansis.cyan(`
|
|
361
|
-
${i18n.t("mcp:market.installing", { name: server.name })}`));
|
|
362
|
-
console.log(ansis.dim(`Package: ${server.package}
|
|
363
|
-
`));
|
|
364
|
-
const { confirm } = await inquirer.prompt([{
|
|
365
|
-
type: "confirm",
|
|
366
|
-
name: "confirm",
|
|
367
|
-
message: i18n.t("mcp:market.confirmInstall"),
|
|
368
|
-
default: true
|
|
369
|
-
}]);
|
|
370
|
-
if (!confirm) {
|
|
371
|
-
console.log(ansis.yellow(i18n.t("mcp:market.cancelled")));
|
|
372
|
-
return;
|
|
373
|
-
}
|
|
374
|
-
console.log(ansis.green(`
|
|
375
|
-
${i18n.t("mcp:market.installSuccess", { name: server.name })}`));
|
|
376
|
-
console.log(ansis.dim(i18n.t("mcp:market.manualConfig")));
|
|
377
|
-
}
|
|
378
|
-
}
|
|
379
|
-
async function mcpUninstall(serverName, options = {}) {
|
|
380
|
-
const server = MCP_SERVERS.find((s) => s.name.toLowerCase() === serverName.toLowerCase());
|
|
381
|
-
const serviceId = server?.serviceId || serverName;
|
|
382
|
-
const isInstalled = await isMcpServiceInstalled(serviceId, options.tool);
|
|
383
|
-
if (!isInstalled) {
|
|
384
|
-
console.log(ansis.yellow(`
|
|
385
|
-
${i18n.t("mcp:installer.serviceNotInstalled", { id: serverName })}`));
|
|
386
|
-
return;
|
|
387
|
-
}
|
|
388
|
-
const displayName = server?.name || serverName;
|
|
389
|
-
const { confirm } = await inquirer.prompt([{
|
|
390
|
-
type: "confirm",
|
|
391
|
-
name: "confirm",
|
|
392
|
-
message: i18n.t("mcp:market.confirmUninstall", { name: displayName }),
|
|
393
|
-
default: false
|
|
394
|
-
}]);
|
|
395
|
-
if (!confirm) {
|
|
396
|
-
console.log(ansis.yellow(i18n.t("mcp:market.cancelled")));
|
|
397
|
-
return;
|
|
398
|
-
}
|
|
399
|
-
const result = await uninstallMcpService(serviceId, options.tool);
|
|
400
|
-
if (result.success) {
|
|
401
|
-
console.log(ansis.green(`
|
|
402
|
-
${i18n.t("mcp:installer.uninstallSuccess", { name: displayName })}`));
|
|
403
|
-
console.log(ansis.dim(i18n.t("mcp:installer.restartRequired")));
|
|
404
|
-
} else {
|
|
405
|
-
console.log(ansis.red(`
|
|
406
|
-
${i18n.t("mcp:installer.uninstallFailed", { name: displayName })}`));
|
|
407
|
-
if (result.error) {
|
|
408
|
-
console.log(ansis.dim(result.error));
|
|
409
|
-
}
|
|
410
|
-
}
|
|
411
|
-
}
|
|
412
|
-
async function mcpList(options = {}) {
|
|
413
|
-
await displayInstalledMcpServices(options.tool);
|
|
414
|
-
}
|
|
415
|
-
|
|
416
|
-
export { mcpList as a, mcpSearch as b, mcpUninstall as c, mcpTrending as d, mcpInstall as m };
|