ls-mcp 1.9.0 → 1.10.0
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 +12 -0
- package/dist/bin/cli.cjs +841 -268
- package/dist/bin/cli.mjs +823 -250
- package/dist/main.cjs +703 -242
- package/dist/main.d.cts +77 -14
- package/dist/main.d.ts +77 -14
- package/dist/main.mjs +702 -243
- package/package.json +3 -1
- package/src/bin/cli.ts +37 -5
- package/src/components/credential-warning.ts +37 -0
- package/src/components/summary.ts +57 -0
- package/src/main.ts +49 -258
- package/src/services/credential-detection-service.ts +166 -0
- package/src/services/mcp-config-linter-service.ts +13 -74
- package/src/services/mcp-config-parser.ts +233 -0
- package/src/services/mcp-config-service.ts +267 -0
- package/src/services/mcp-path-registry.ts +164 -0
- package/src/services/mcp-server-manager-service.ts +3 -3
- package/src/services/render-service.ts +46 -2
- package/src/types/mcp-config-service.types.ts +75 -0
- package/src/types.ts +38 -0
package/dist/bin/cli.cjs
CHANGED
|
@@ -25,19 +25,175 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
25
25
|
));
|
|
26
26
|
|
|
27
27
|
// src/bin/cli.ts
|
|
28
|
-
var
|
|
28
|
+
var import_node_util12 = require("util");
|
|
29
29
|
|
|
30
|
-
// src/
|
|
31
|
-
var
|
|
32
|
-
var import_node_os2 = require("os");
|
|
30
|
+
// src/services/mcp-config-service.ts
|
|
31
|
+
var import_node_os = require("os");
|
|
33
32
|
var import_node_path2 = __toESM(require("path"), 1);
|
|
33
|
+
var import_promises2 = __toESM(require("fs/promises"), 1);
|
|
34
|
+
var import_node_util = __toESM(require("util"), 1);
|
|
35
|
+
|
|
36
|
+
// src/services/mcp-path-registry.ts
|
|
37
|
+
var import_node_path = __toESM(require("path"), 1);
|
|
38
|
+
var MCPPathRegistry = class _MCPPathRegistry {
|
|
39
|
+
static {
|
|
40
|
+
__name(this, "MCPPathRegistry");
|
|
41
|
+
}
|
|
42
|
+
static WINDOWS_PATHS = {
|
|
43
|
+
claude: [
|
|
44
|
+
{ filePath: import_node_path.default.join(process.env.APPDATA || "", "Claude", "claude_desktop_config.json"), type: "global" }
|
|
45
|
+
],
|
|
46
|
+
claude_code: [
|
|
47
|
+
{ filePath: ".mcp.json", type: "local" }
|
|
48
|
+
],
|
|
49
|
+
cursor: [
|
|
50
|
+
{ filePath: import_node_path.default.join(process.env.HOME || "", ".cursor", "mcp.json"), type: "global" },
|
|
51
|
+
{ filePath: import_node_path.default.join(".cursor", "mcp.json"), type: "local" }
|
|
52
|
+
],
|
|
53
|
+
vscode: [
|
|
54
|
+
{ filePath: import_node_path.default.join(".vscode", "mcp.json"), type: "local" },
|
|
55
|
+
{ filePath: import_node_path.default.join(process.env.APPDATA || "", "Code", "User", "settings.json"), type: "global" },
|
|
56
|
+
{ filePath: import_node_path.default.join(process.env.APPDATA || "", "Code - Insiders", "User", "settings.json"), type: "global" },
|
|
57
|
+
{ filePath: import_node_path.default.join(process.env.APPDATA || "", "Code", "User", "mcp.json"), type: "global" },
|
|
58
|
+
{ filePath: import_node_path.default.join(process.env.APPDATA || "", "Code - Insiders", "User", "mcp.json"), type: "global" }
|
|
59
|
+
],
|
|
60
|
+
cline: [
|
|
61
|
+
{ filePath: import_node_path.default.join(process.env.APPDATA || "", "Code", "User", "globalStorage", "saoudrizwan.claude-dev", "settings", "cline_mcp_settings.json"), type: "global" },
|
|
62
|
+
{ filePath: import_node_path.default.join(process.env.APPDATA || "", "Code - Insiders", "User", "globalStorage", "saoudrizwan.claude-dev", "settings", "cline_mcp_settings.json"), type: "global" }
|
|
63
|
+
],
|
|
64
|
+
windsurf: [
|
|
65
|
+
{ filePath: import_node_path.default.join(".codeium", "windsurf", "mcp_config.json"), type: "local" }
|
|
66
|
+
],
|
|
67
|
+
roo: [
|
|
68
|
+
{ filePath: import_node_path.default.join(process.env.APPDATA || "", "Code", "User", "globalStorage", "rooveterinaryinc.roo-cline", "settings", "cline_mcp_settings.json"), type: "global" },
|
|
69
|
+
{ filePath: import_node_path.default.join(process.env.APPDATA || "", "Code - Insiders", "User", "globalStorage", "rooveterinaryinc.roo-cline", "settings", "cline_mcp_settings.json"), type: "global" }
|
|
70
|
+
],
|
|
71
|
+
"intellij-github-copilot": [
|
|
72
|
+
{ filePath: import_node_path.default.join(process.env.LOCALAPPDATA || "", "github-copilot", "intellij", "mcp.json"), type: "global" }
|
|
73
|
+
],
|
|
74
|
+
junie: [
|
|
75
|
+
{ filePath: import_node_path.default.join(process.env.HOME || "", ".junie", "mcp", "mcp.json"), type: "global" }
|
|
76
|
+
],
|
|
77
|
+
zed: [
|
|
78
|
+
{ filePath: import_node_path.default.join(process.env.LOCALAPPDATA || "", "zed", "settings.json"), type: "global" },
|
|
79
|
+
{ filePath: import_node_path.default.join(".zed", "settings.json"), type: "local" }
|
|
80
|
+
],
|
|
81
|
+
gemini: [
|
|
82
|
+
{ filePath: import_node_path.default.join(process.env.HOME || "", ".gemini", "settings.json"), type: "global" },
|
|
83
|
+
{ filePath: import_node_path.default.join(".gemini", "settings.json"), type: "local" }
|
|
84
|
+
]
|
|
85
|
+
};
|
|
86
|
+
static DARWIN_PATHS = {
|
|
87
|
+
claude: [
|
|
88
|
+
{ filePath: import_node_path.default.join(process.env.HOME || "", "Library", "Application Support", "Claude", "claude_desktop_config.json"), type: "global" }
|
|
89
|
+
],
|
|
90
|
+
claude_code: [
|
|
91
|
+
{ filePath: ".mcp.json", type: "local" }
|
|
92
|
+
],
|
|
93
|
+
cursor: [
|
|
94
|
+
{ filePath: import_node_path.default.join(process.env.HOME || "", ".cursor", "mcp.json"), type: "global" },
|
|
95
|
+
{ filePath: import_node_path.default.join(".cursor", "mcp.json"), type: "local" }
|
|
96
|
+
],
|
|
97
|
+
vscode: [
|
|
98
|
+
{ filePath: import_node_path.default.join(".vscode", "mcp.json"), type: "local" },
|
|
99
|
+
{ filePath: import_node_path.default.join(process.env.HOME || "", "Library", "Application Support", "Code", "User", "settings.json"), type: "global" },
|
|
100
|
+
{ filePath: import_node_path.default.join(process.env.HOME || "", "Library", "Application Support", "Code", "User", "mcp.json"), type: "global" },
|
|
101
|
+
{ filePath: import_node_path.default.join(process.env.HOME || "", "Library", "Application Support", "Code - Insiders", "User", "settings.json"), type: "global" },
|
|
102
|
+
{ filePath: import_node_path.default.join(process.env.HOME || "", "Library", "Application Support", "Code - Insiders", "User", "mcp.json"), type: "global" }
|
|
103
|
+
],
|
|
104
|
+
cline: [
|
|
105
|
+
{ filePath: import_node_path.default.join(process.env.HOME || "", "Library", "Application Support", "Code", "User", "globalStorage", "saoudrizwan.claude-dev", "settings", "cline_mcp_settings.json"), type: "global" },
|
|
106
|
+
{ filePath: import_node_path.default.join(process.env.HOME || "", "Library", "Application Support", "Code - Insiders", "User", "globalStorage", "saoudrizwan.claude-dev", "settings", "cline_mcp_settings.json"), type: "global" }
|
|
107
|
+
],
|
|
108
|
+
windsurf: [
|
|
109
|
+
{ filePath: import_node_path.default.join(".codeium", "windsurf", "mcp_config.json"), type: "local" }
|
|
110
|
+
],
|
|
111
|
+
roo: [
|
|
112
|
+
{ filePath: import_node_path.default.join(process.env.HOME || "", "Library", "Application Support", "Code", "User", "globalStorage", "rooveterinaryinc.roo-cline", "settings", "cline_mcp_settings.json"), type: "global" },
|
|
113
|
+
{ filePath: import_node_path.default.join(process.env.HOME || "", "Library", "Application Support", "Code - Insiders", "User", "globalStorage", "rooveterinaryinc.roo-cline", "settings", "cline_mcp_settings.json"), type: "global" }
|
|
114
|
+
],
|
|
115
|
+
"intellij-github-copilot": [
|
|
116
|
+
{ filePath: import_node_path.default.join(process.env.HOME || "", ".config", "github-copilot", "intellij", "mcp.json"), type: "global" }
|
|
117
|
+
],
|
|
118
|
+
junie: [
|
|
119
|
+
{ filePath: import_node_path.default.join(process.env.HOME || "", ".junie", "mcp", "mcp.json"), type: "global" },
|
|
120
|
+
{ filePath: import_node_path.default.join(".junie", "mcp", "mcp.json"), type: "local" }
|
|
121
|
+
],
|
|
122
|
+
zed: [
|
|
123
|
+
{ filePath: import_node_path.default.join(process.env.HOME || "", ".config", "zed", "settings.json"), type: "global" },
|
|
124
|
+
{ filePath: import_node_path.default.join(".zed", "settings.json"), type: "local" }
|
|
125
|
+
],
|
|
126
|
+
gemini: [
|
|
127
|
+
{ filePath: import_node_path.default.join(process.env.HOME || "", ".gemini", "settings.json"), type: "global" },
|
|
128
|
+
{ filePath: import_node_path.default.join(".gemini", "settings.json"), type: "local" }
|
|
129
|
+
]
|
|
130
|
+
};
|
|
131
|
+
customApps = /* @__PURE__ */ new Map();
|
|
132
|
+
/**
|
|
133
|
+
* Get all MCP configuration file paths for a specific operating system
|
|
134
|
+
*/
|
|
135
|
+
getPathsForOS(os) {
|
|
136
|
+
switch (os.toLowerCase()) {
|
|
137
|
+
case "win32":
|
|
138
|
+
case "windows":
|
|
139
|
+
return { ..._MCPPathRegistry.WINDOWS_PATHS };
|
|
140
|
+
case "darwin":
|
|
141
|
+
case "macos":
|
|
142
|
+
return { ..._MCPPathRegistry.DARWIN_PATHS };
|
|
143
|
+
default:
|
|
144
|
+
throw new Error(`Unsupported operating system: ${os}`);
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* Get MCP configuration file paths for a specific app on a specific OS
|
|
149
|
+
*/
|
|
150
|
+
getPathsForApp(os, appName) {
|
|
151
|
+
const osPaths = this.getPathsForOS(os);
|
|
152
|
+
const appPaths = osPaths[appName];
|
|
153
|
+
if (!appPaths) {
|
|
154
|
+
throw new Error(`App '${appName}' not found for OS '${os}'`);
|
|
155
|
+
}
|
|
156
|
+
return [...appPaths];
|
|
157
|
+
}
|
|
158
|
+
/**
|
|
159
|
+
* Get all supported app names for a specific OS
|
|
160
|
+
*/
|
|
161
|
+
getSupportedApps(os) {
|
|
162
|
+
const osPaths = this.getPathsForOS(os);
|
|
163
|
+
return Object.keys(osPaths);
|
|
164
|
+
}
|
|
165
|
+
/**
|
|
166
|
+
* Get all supported operating systems
|
|
167
|
+
*/
|
|
168
|
+
getSupportedOperatingSystems() {
|
|
169
|
+
return ["win32", "darwin"];
|
|
170
|
+
}
|
|
171
|
+
/**
|
|
172
|
+
* Register a custom app with custom paths for a specific OS
|
|
173
|
+
*/
|
|
174
|
+
registerCustomApp(os, appName, paths) {
|
|
175
|
+
if (!this.customApps.has(os)) {
|
|
176
|
+
this.customApps.set(os, {});
|
|
177
|
+
}
|
|
178
|
+
const osCustomApps = this.customApps.get(os);
|
|
179
|
+
osCustomApps[appName] = [...paths];
|
|
180
|
+
}
|
|
181
|
+
/**
|
|
182
|
+
* Get paths including custom registered apps
|
|
183
|
+
*/
|
|
184
|
+
getPathsForOSWithCustom(os) {
|
|
185
|
+
const basePaths = this.getPathsForOS(os);
|
|
186
|
+
const customPaths = this.customApps.get(os) || {};
|
|
187
|
+
return { ...basePaths, ...customPaths };
|
|
188
|
+
}
|
|
189
|
+
};
|
|
34
190
|
|
|
35
|
-
// src/services/mcp-config-
|
|
191
|
+
// src/services/mcp-config-parser.ts
|
|
36
192
|
var import_promises = __toESM(require("fs/promises"), 1);
|
|
37
193
|
var import_jsonc_parser = require("jsonc-parser");
|
|
38
|
-
var
|
|
194
|
+
var MCPConfigParser = class {
|
|
39
195
|
static {
|
|
40
|
-
__name(this, "
|
|
196
|
+
__name(this, "MCPConfigParser");
|
|
41
197
|
}
|
|
42
198
|
filePath;
|
|
43
199
|
fileContents = null;
|
|
@@ -47,9 +203,17 @@ var MCPConfigLinterService = class {
|
|
|
47
203
|
constructor(filePath) {
|
|
48
204
|
this.filePath = filePath;
|
|
49
205
|
}
|
|
50
|
-
|
|
206
|
+
/**
|
|
207
|
+
* Parse the configuration file and return structured data
|
|
208
|
+
*/
|
|
209
|
+
async parseConfigFile() {
|
|
51
210
|
if (this.parsed) {
|
|
52
|
-
return
|
|
211
|
+
return {
|
|
212
|
+
raw: this.fileContentsData,
|
|
213
|
+
parsed: this.parsed,
|
|
214
|
+
valid: this.valid,
|
|
215
|
+
servers: await this.extractMCPServers(this.fileContentsData)
|
|
216
|
+
};
|
|
53
217
|
}
|
|
54
218
|
this.parsed = true;
|
|
55
219
|
const fileContent = await this.getFileContent();
|
|
@@ -57,63 +221,519 @@ var MCPConfigLinterService = class {
|
|
|
57
221
|
this.fileContentsData = JSON.parse(fileContent);
|
|
58
222
|
if (typeof this.fileContentsData === "object") {
|
|
59
223
|
this.valid = true;
|
|
60
|
-
return;
|
|
61
224
|
}
|
|
62
225
|
} catch (e) {
|
|
63
226
|
}
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
this.
|
|
227
|
+
if (!this.valid) {
|
|
228
|
+
try {
|
|
229
|
+
this.fileContentsData = (0, import_jsonc_parser.parse)(fileContent);
|
|
230
|
+
if (typeof this.fileContentsData === "object") {
|
|
231
|
+
this.valid = true;
|
|
232
|
+
}
|
|
233
|
+
} catch (error) {
|
|
68
234
|
}
|
|
69
|
-
} catch (error) {
|
|
70
235
|
}
|
|
236
|
+
if (!this.valid) {
|
|
237
|
+
throw new Error(`Failed to parse configuration file: ${this.filePath}`);
|
|
238
|
+
}
|
|
239
|
+
return {
|
|
240
|
+
raw: this.fileContentsData,
|
|
241
|
+
parsed: this.parsed,
|
|
242
|
+
valid: this.valid,
|
|
243
|
+
servers: await this.extractMCPServers(this.fileContentsData)
|
|
244
|
+
};
|
|
245
|
+
}
|
|
246
|
+
/**
|
|
247
|
+
* Extract MCP servers from parsed configuration data
|
|
248
|
+
*/
|
|
249
|
+
async extractMCPServers(configData) {
|
|
250
|
+
if (!configData || typeof configData !== "object") {
|
|
251
|
+
return {};
|
|
252
|
+
}
|
|
253
|
+
if (configData.servers && typeof configData.servers === "object") {
|
|
254
|
+
return this.normalizeServerConfigs(configData.servers);
|
|
255
|
+
}
|
|
256
|
+
if (configData.mcp?.servers && typeof configData.mcp.servers === "object") {
|
|
257
|
+
return this.normalizeServerConfigs(configData.mcp.servers);
|
|
258
|
+
}
|
|
259
|
+
if (configData.mcpServers && typeof configData.mcpServers === "object") {
|
|
260
|
+
return this.normalizeServerConfigs(configData.mcpServers);
|
|
261
|
+
}
|
|
262
|
+
if (configData.context_servers && typeof configData.context_servers === "object") {
|
|
263
|
+
return this.normalizeServerConfigs(configData.context_servers);
|
|
264
|
+
}
|
|
265
|
+
return {};
|
|
266
|
+
}
|
|
267
|
+
/**
|
|
268
|
+
* Normalize server configurations to ensure consistent structure
|
|
269
|
+
*/
|
|
270
|
+
normalizeServerConfigs(servers) {
|
|
271
|
+
const normalized = {};
|
|
272
|
+
for (const [serverName, serverConfig] of Object.entries(servers)) {
|
|
273
|
+
if (serverConfig && typeof serverConfig === "object") {
|
|
274
|
+
const env = serverConfig.env && typeof serverConfig.env === "object" ? serverConfig.env : void 0;
|
|
275
|
+
normalized[serverName] = {
|
|
276
|
+
name: serverName,
|
|
277
|
+
command: serverConfig.command || "",
|
|
278
|
+
args: Array.isArray(serverConfig.args) ? serverConfig.args : void 0,
|
|
279
|
+
type: this.validateType(serverConfig.type) ? serverConfig.type : this.inferTransportType(serverConfig),
|
|
280
|
+
env
|
|
281
|
+
};
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
return normalized;
|
|
285
|
+
}
|
|
286
|
+
/**
|
|
287
|
+
* Validate type value
|
|
288
|
+
*/
|
|
289
|
+
validateType(type) {
|
|
290
|
+
return ["sse", "http", "stdio", "streamable-http"].includes(type);
|
|
291
|
+
}
|
|
292
|
+
/**
|
|
293
|
+
* Infer transport type from server configuration when type field is not explicitly set
|
|
294
|
+
*/
|
|
295
|
+
inferTransportType(serverConfig) {
|
|
296
|
+
if (serverConfig.url && typeof serverConfig.url === "string") {
|
|
297
|
+
return "http";
|
|
298
|
+
}
|
|
299
|
+
if (Array.isArray(serverConfig.args)) {
|
|
300
|
+
const argsString = serverConfig.args.join(" ").toLowerCase();
|
|
301
|
+
if (argsString.includes("stdio")) {
|
|
302
|
+
return "stdio";
|
|
303
|
+
}
|
|
304
|
+
if (argsString.includes("http")) {
|
|
305
|
+
return "http";
|
|
306
|
+
}
|
|
307
|
+
if (argsString.includes("sse")) {
|
|
308
|
+
return "sse";
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
if (serverConfig.command && typeof serverConfig.command === "string") {
|
|
312
|
+
return "stdio";
|
|
313
|
+
}
|
|
314
|
+
return void 0;
|
|
315
|
+
}
|
|
316
|
+
/**
|
|
317
|
+
* Validate server configuration
|
|
318
|
+
*/
|
|
319
|
+
validateServerConfig(serverConfig) {
|
|
320
|
+
if (!serverConfig || typeof serverConfig !== "object") {
|
|
321
|
+
return false;
|
|
322
|
+
}
|
|
323
|
+
if (!serverConfig.name || typeof serverConfig.name !== "string") {
|
|
324
|
+
return false;
|
|
325
|
+
}
|
|
326
|
+
if (!serverConfig.command || typeof serverConfig.command !== "string") {
|
|
327
|
+
return false;
|
|
328
|
+
}
|
|
329
|
+
return true;
|
|
71
330
|
}
|
|
331
|
+
/**
|
|
332
|
+
* Get supported configuration keys that the parser recognizes
|
|
333
|
+
*/
|
|
334
|
+
getSupportedConfigKeys() {
|
|
335
|
+
return ["servers", "mcp.servers", "mcpServers", "context_servers"];
|
|
336
|
+
}
|
|
337
|
+
/**
|
|
338
|
+
* Check if the configuration file has valid syntax
|
|
339
|
+
*/
|
|
72
340
|
async isValidSyntax() {
|
|
73
341
|
try {
|
|
74
|
-
await this.
|
|
75
|
-
return
|
|
342
|
+
const configData = await this.parseConfigFile();
|
|
343
|
+
return configData.valid;
|
|
76
344
|
} catch (error) {
|
|
77
345
|
return false;
|
|
78
346
|
}
|
|
79
347
|
}
|
|
348
|
+
/**
|
|
349
|
+
* Count the number of MCP servers in the configuration
|
|
350
|
+
*/
|
|
80
351
|
async countMCPServers() {
|
|
81
352
|
try {
|
|
82
|
-
const
|
|
83
|
-
return Object.keys(
|
|
353
|
+
const configData = await this.parseConfigFile();
|
|
354
|
+
return Object.keys(configData.servers).length;
|
|
84
355
|
} catch (error) {
|
|
85
356
|
return 0;
|
|
86
357
|
}
|
|
87
358
|
}
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
359
|
+
/**
|
|
360
|
+
* Get the raw file content
|
|
361
|
+
*/
|
|
362
|
+
async getFileContent() {
|
|
363
|
+
if (this.fileContents) {
|
|
364
|
+
return this.fileContents;
|
|
365
|
+
}
|
|
366
|
+
try {
|
|
367
|
+
this.fileContents = await import_promises.default.readFile(this.filePath, "utf-8");
|
|
368
|
+
return this.fileContents;
|
|
369
|
+
} catch (error) {
|
|
370
|
+
throw new Error(`Failed to read file: ${this.filePath}`);
|
|
92
371
|
}
|
|
93
|
-
|
|
94
|
-
|
|
372
|
+
}
|
|
373
|
+
};
|
|
374
|
+
|
|
375
|
+
// src/services/credential-detection-service.ts
|
|
376
|
+
var CredentialDetectionService = class {
|
|
377
|
+
static {
|
|
378
|
+
__name(this, "CredentialDetectionService");
|
|
379
|
+
}
|
|
380
|
+
/**
|
|
381
|
+
* Credential patterns grouped by risk level for easier maintenance
|
|
382
|
+
*/
|
|
383
|
+
static CREDENTIAL_PATTERNS = {
|
|
384
|
+
high: [
|
|
385
|
+
// API Keys and Tokens
|
|
386
|
+
/api[_-]?key/i,
|
|
387
|
+
/api[_-]?token/i,
|
|
388
|
+
/access[_-]?token/i,
|
|
389
|
+
/secret[_-]?key/i,
|
|
390
|
+
/private[_-]?key/i,
|
|
391
|
+
// Authentication Tokens
|
|
392
|
+
/auth[_-]?token/i,
|
|
393
|
+
/bearer[_-]?token/i,
|
|
394
|
+
/jwt[_-]?token/i,
|
|
395
|
+
/oauth[_-]?token/i,
|
|
396
|
+
// Passwords
|
|
397
|
+
/password/i,
|
|
398
|
+
/passwd/i,
|
|
399
|
+
/pwd/i,
|
|
400
|
+
// Credentials
|
|
401
|
+
/credential/i,
|
|
402
|
+
/creds/i,
|
|
403
|
+
// Specific service patterns
|
|
404
|
+
/openai[_-]?api[_-]?key/i,
|
|
405
|
+
/anthropic[_-]?api[_-]?key/i,
|
|
406
|
+
/firecrawl[_-]?api[_-]?key/i,
|
|
407
|
+
/github[_-]?token/i,
|
|
408
|
+
/gitlab[_-]?token/i,
|
|
409
|
+
/bitbucket[_-]?token/i,
|
|
410
|
+
// Database passwords
|
|
411
|
+
/db[_-]?password/i,
|
|
412
|
+
/database[_-]?password/i,
|
|
413
|
+
/redis[_-]?password/i,
|
|
414
|
+
/postgres[_-]?password/i,
|
|
415
|
+
/mysql[_-]?password/i,
|
|
416
|
+
// Cloud services
|
|
417
|
+
/aws[_-]?secret[_-]?access[_-]?key/i,
|
|
418
|
+
/aws[_-]?access[_-]?key[_-]?id/i,
|
|
419
|
+
/azure[_-]?key/i,
|
|
420
|
+
/gcp[_-]?key/i,
|
|
421
|
+
/google[_-]?api[_-]?key/i,
|
|
422
|
+
/gemini[_-]?api[_-]?key/i,
|
|
423
|
+
/claude[_-]?api[_-]?key/i
|
|
424
|
+
],
|
|
425
|
+
low: [
|
|
426
|
+
// Organization and Account IDs
|
|
427
|
+
/org[_-]?id/i,
|
|
428
|
+
/organization[_-]?id/i,
|
|
429
|
+
/account[_-]?id/i,
|
|
430
|
+
/user[_-]?id/i,
|
|
431
|
+
/openai[_-]?org[_-]?id/i
|
|
432
|
+
]
|
|
433
|
+
};
|
|
434
|
+
/**
|
|
435
|
+
* Check if an environment variable name suggests it might contain credentials
|
|
436
|
+
*/
|
|
437
|
+
static isPotentialCredential(envVarName) {
|
|
438
|
+
return this.CREDENTIAL_PATTERNS.high.some((pattern) => pattern.test(envVarName)) || this.CREDENTIAL_PATTERNS.low.some((pattern) => pattern.test(envVarName));
|
|
439
|
+
}
|
|
440
|
+
/**
|
|
441
|
+
* Analyze environment variables and return credential detection results
|
|
442
|
+
*/
|
|
443
|
+
static analyzeEnvironmentVariables(env) {
|
|
444
|
+
if (!env || typeof env !== "object") {
|
|
445
|
+
return {
|
|
446
|
+
hasCredentials: false,
|
|
447
|
+
credentialVars: [],
|
|
448
|
+
riskLevel: "none"
|
|
449
|
+
};
|
|
95
450
|
}
|
|
96
|
-
|
|
97
|
-
|
|
451
|
+
const credentialVars = [];
|
|
452
|
+
for (const [name, value] of Object.entries(env)) {
|
|
453
|
+
if (this.isPotentialCredential(name)) {
|
|
454
|
+
credentialVars.push({
|
|
455
|
+
name,
|
|
456
|
+
value: this.maskValue(value),
|
|
457
|
+
riskLevel: this.assessRiskLevel(name)
|
|
458
|
+
});
|
|
459
|
+
}
|
|
98
460
|
}
|
|
99
|
-
|
|
100
|
-
|
|
461
|
+
const hasCredentials = credentialVars.length > 0;
|
|
462
|
+
const riskLevel = this.calculateOverallRiskLevel(credentialVars);
|
|
463
|
+
return {
|
|
464
|
+
hasCredentials,
|
|
465
|
+
credentialVars,
|
|
466
|
+
riskLevel
|
|
467
|
+
};
|
|
468
|
+
}
|
|
469
|
+
/**
|
|
470
|
+
* Mask sensitive values for display (show only first and last character)
|
|
471
|
+
*/
|
|
472
|
+
static maskValue(value) {
|
|
473
|
+
if (!value || value.length <= 2) {
|
|
474
|
+
return value;
|
|
101
475
|
}
|
|
102
|
-
|
|
476
|
+
const first = value.charAt(0);
|
|
477
|
+
const last = value.charAt(value.length - 1);
|
|
478
|
+
const maskedLength = Math.min(value.length - 2, 8);
|
|
479
|
+
return `${first}${"*".repeat(maskedLength)}${last}`;
|
|
103
480
|
}
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
481
|
+
/**
|
|
482
|
+
* Assess risk level for a specific credential variable
|
|
483
|
+
*/
|
|
484
|
+
static assessRiskLevel(name) {
|
|
485
|
+
if (this.CREDENTIAL_PATTERNS.high.some((pattern) => pattern.test(name))) {
|
|
486
|
+
return "high";
|
|
487
|
+
}
|
|
488
|
+
if (this.CREDENTIAL_PATTERNS.low.some((pattern) => pattern.test(name))) {
|
|
489
|
+
return "low";
|
|
490
|
+
}
|
|
491
|
+
return "high";
|
|
492
|
+
}
|
|
493
|
+
/**
|
|
494
|
+
* Calculate overall risk level based on all credential variables
|
|
495
|
+
*/
|
|
496
|
+
static calculateOverallRiskLevel(credentialVars) {
|
|
497
|
+
if (credentialVars.length === 0) {
|
|
498
|
+
return "none";
|
|
499
|
+
}
|
|
500
|
+
const hasHighRisk = credentialVars.some((v) => v.riskLevel === "high");
|
|
501
|
+
if (hasHighRisk) {
|
|
502
|
+
return "high";
|
|
503
|
+
}
|
|
504
|
+
return "low";
|
|
505
|
+
}
|
|
506
|
+
};
|
|
507
|
+
|
|
508
|
+
// src/services/mcp-config-service.ts
|
|
509
|
+
var MCPConfigService = class {
|
|
510
|
+
static {
|
|
511
|
+
__name(this, "MCPConfigService");
|
|
512
|
+
}
|
|
513
|
+
pathRegistry;
|
|
514
|
+
currentOS;
|
|
515
|
+
debug;
|
|
516
|
+
constructor() {
|
|
517
|
+
this.pathRegistry = new MCPPathRegistry();
|
|
518
|
+
this.currentOS = (0, import_node_os.platform)();
|
|
519
|
+
this.debug = import_node_util.default.debuglog("ls-mcp");
|
|
520
|
+
}
|
|
521
|
+
/**
|
|
522
|
+
* Get MCP configuration files for a specific AI application on the current OS
|
|
523
|
+
*/
|
|
524
|
+
getConfigFilesPerApp(appName) {
|
|
525
|
+
try {
|
|
526
|
+
return this.pathRegistry.getPathsForApp(this.currentOS, appName);
|
|
527
|
+
} catch (error) {
|
|
528
|
+
throw new Error(`Failed to get config files for app '${appName}': ${error instanceof Error ? error.message : "Unknown error"}`);
|
|
529
|
+
}
|
|
530
|
+
}
|
|
531
|
+
/**
|
|
532
|
+
* Get MCP configuration files for all AI applications on the current OS
|
|
533
|
+
*/
|
|
534
|
+
getAllConfigFiles() {
|
|
535
|
+
try {
|
|
536
|
+
return this.pathRegistry.getPathsForOS(this.currentOS);
|
|
537
|
+
} catch (error) {
|
|
538
|
+
throw new Error(`Failed to get all config files: ${error instanceof Error ? error.message : "Unknown error"}`);
|
|
539
|
+
}
|
|
540
|
+
}
|
|
541
|
+
/**
|
|
542
|
+
* Get MCP servers configured for a specific AI application on the current OS
|
|
543
|
+
*/
|
|
544
|
+
async getMCPServersPerApp(appName) {
|
|
545
|
+
try {
|
|
546
|
+
const appPaths = this.getConfigFilesPerApp(appName);
|
|
547
|
+
const allServers = [];
|
|
548
|
+
for (const filePath of appPaths) {
|
|
549
|
+
const servers = await this.parseConfigFileForServers(filePath.filePath);
|
|
550
|
+
allServers.push(...servers);
|
|
551
|
+
}
|
|
552
|
+
return allServers;
|
|
553
|
+
} catch (error) {
|
|
554
|
+
throw new Error(`Failed to get MCP servers for app '${appName}': ${error instanceof Error ? error.message : "Unknown error"}`);
|
|
555
|
+
}
|
|
556
|
+
}
|
|
557
|
+
/**
|
|
558
|
+
* Get MCP servers configured for all AI applications on the current OS
|
|
559
|
+
*/
|
|
560
|
+
async getAllMCPServers() {
|
|
561
|
+
try {
|
|
562
|
+
const allApps = this.pathRegistry.getSupportedApps(this.currentOS);
|
|
563
|
+
const allServers = {};
|
|
564
|
+
for (const appName of allApps) {
|
|
565
|
+
try {
|
|
566
|
+
allServers[appName] = await this.getMCPServersPerApp(appName);
|
|
567
|
+
} catch (error) {
|
|
568
|
+
this.debug(`Failed to get servers for app '${appName}': ${error instanceof Error ? error.message : "Unknown error"}`);
|
|
569
|
+
allServers[appName] = [];
|
|
570
|
+
}
|
|
571
|
+
}
|
|
572
|
+
return allServers;
|
|
573
|
+
} catch (error) {
|
|
574
|
+
throw new Error(`Failed to get all MCP servers: ${error instanceof Error ? error.message : "Unknown error"}`);
|
|
575
|
+
}
|
|
576
|
+
}
|
|
577
|
+
/**
|
|
578
|
+
* Get metadata for all supported AI applications on the current OS
|
|
579
|
+
*/
|
|
580
|
+
getSupportedApps() {
|
|
581
|
+
try {
|
|
582
|
+
const appNames = this.pathRegistry.getSupportedApps(this.currentOS);
|
|
583
|
+
const appPaths = this.pathRegistry.getPathsForOS(this.currentOS);
|
|
584
|
+
return appNames.map((appName) => ({
|
|
585
|
+
name: appName,
|
|
586
|
+
friendlyName: this.getFriendlyName(appName),
|
|
587
|
+
paths: appPaths[appName] || []
|
|
588
|
+
}));
|
|
589
|
+
} catch (error) {
|
|
590
|
+
throw new Error(`Failed to get supported apps: ${error instanceof Error ? error.message : "Unknown error"}`);
|
|
591
|
+
}
|
|
592
|
+
}
|
|
593
|
+
/**
|
|
594
|
+
* Get all supported operating systems
|
|
595
|
+
*/
|
|
596
|
+
getSupportedOperatingSystems() {
|
|
597
|
+
return this.pathRegistry.getSupportedOperatingSystems();
|
|
598
|
+
}
|
|
599
|
+
/**
|
|
600
|
+
* Validate if a configuration file exists and is parsable
|
|
601
|
+
*/
|
|
602
|
+
async validateConfigFile(filePath) {
|
|
603
|
+
try {
|
|
604
|
+
await import_promises2.default.access(filePath);
|
|
605
|
+
const parser = this.createParser(filePath);
|
|
606
|
+
return await parser.isValidSyntax();
|
|
607
|
+
} catch (error) {
|
|
608
|
+
return false;
|
|
609
|
+
}
|
|
610
|
+
}
|
|
611
|
+
/**
|
|
612
|
+
* Create a parser instance (can be overridden for testing)
|
|
613
|
+
*/
|
|
614
|
+
createParser(filePath) {
|
|
615
|
+
return new MCPConfigParser(filePath);
|
|
616
|
+
}
|
|
617
|
+
/**
|
|
618
|
+
* Get MCP file groups with resolved paths and server information
|
|
619
|
+
*/
|
|
620
|
+
async getMCPFileGroups() {
|
|
621
|
+
try {
|
|
622
|
+
const appPaths = this.getAllConfigFiles();
|
|
623
|
+
const mcpFilesPathsData = {};
|
|
624
|
+
for (const [groupName, paths] of Object.entries(appPaths)) {
|
|
625
|
+
mcpFilesPathsData[groupName] = {
|
|
626
|
+
name: groupName,
|
|
627
|
+
friendlyName: this.getFriendlyName(groupName),
|
|
628
|
+
paths: [],
|
|
629
|
+
stats: { serversCount: 0 }
|
|
630
|
+
};
|
|
631
|
+
const uniqueFilePaths = /* @__PURE__ */ new Set();
|
|
632
|
+
let totalServersCount = 0;
|
|
633
|
+
for (const filePathData of paths) {
|
|
634
|
+
const resolvedPath = filePathData.filePath.replace("~", process.env.HOME || "");
|
|
635
|
+
const absolutePath = import_node_path2.default.resolve(resolvedPath);
|
|
636
|
+
if (uniqueFilePaths.has(absolutePath)) {
|
|
637
|
+
continue;
|
|
638
|
+
}
|
|
639
|
+
uniqueFilePaths.add(absolutePath);
|
|
640
|
+
try {
|
|
641
|
+
await import_promises2.default.access(resolvedPath);
|
|
642
|
+
const parser = this.createParser(resolvedPath);
|
|
643
|
+
const parsable = await parser.isValidSyntax();
|
|
644
|
+
filePathData.parsable = parsable;
|
|
645
|
+
if (parsable) {
|
|
646
|
+
const configData = await parser.parseConfigFile();
|
|
647
|
+
const servers = await this.convertToMCPServerInfo(configData.servers || {});
|
|
648
|
+
filePathData.servers = servers;
|
|
649
|
+
totalServersCount += servers.length;
|
|
650
|
+
}
|
|
651
|
+
mcpFilesPathsData[groupName].paths.push(filePathData);
|
|
652
|
+
} catch (error) {
|
|
653
|
+
this.debug(`Skipping file ${resolvedPath}: ${error instanceof Error ? error.message : "Unknown error"}`);
|
|
654
|
+
}
|
|
655
|
+
}
|
|
656
|
+
if (mcpFilesPathsData[groupName] && mcpFilesPathsData[groupName].stats) {
|
|
657
|
+
mcpFilesPathsData[groupName].stats.serversCount = totalServersCount;
|
|
658
|
+
}
|
|
659
|
+
}
|
|
660
|
+
return mcpFilesPathsData;
|
|
661
|
+
} catch (error) {
|
|
662
|
+
throw new Error(`Failed to get MCP file groups: ${error instanceof Error ? error.message : "Unknown error"}`);
|
|
663
|
+
}
|
|
664
|
+
}
|
|
665
|
+
/**
|
|
666
|
+
* Register a custom app with custom paths for the current OS
|
|
667
|
+
*/
|
|
668
|
+
registerCustomApp(appName, paths) {
|
|
669
|
+
try {
|
|
670
|
+
this.pathRegistry.registerCustomApp(this.currentOS, appName, paths);
|
|
671
|
+
} catch (error) {
|
|
672
|
+
throw new Error(`Failed to register custom app '${appName}': ${error instanceof Error ? error.message : "Unknown error"}`);
|
|
107
673
|
}
|
|
108
|
-
|
|
109
|
-
|
|
674
|
+
}
|
|
675
|
+
/**
|
|
676
|
+
* Parse a configuration file and return server information
|
|
677
|
+
*/
|
|
678
|
+
async parseConfigFileForServers(filePath) {
|
|
679
|
+
try {
|
|
680
|
+
const parser = this.createParser(filePath);
|
|
681
|
+
const configData = await parser.parseConfigFile();
|
|
682
|
+
return await this.convertToMCPServerInfo(configData.servers || {});
|
|
683
|
+
} catch (error) {
|
|
684
|
+
this.debug(`Failed to parse config file ${filePath}: ${error instanceof Error ? error.message : "Unknown error"}`);
|
|
685
|
+
return [];
|
|
686
|
+
}
|
|
687
|
+
}
|
|
688
|
+
/**
|
|
689
|
+
* Convert parsed server configs to MCPServerInfo format
|
|
690
|
+
*/
|
|
691
|
+
async convertToMCPServerInfo(servers) {
|
|
692
|
+
const serverInfos = [];
|
|
693
|
+
for (const [serverName, serverConfig] of Object.entries(servers)) {
|
|
694
|
+
if (serverConfig && typeof serverConfig === "object") {
|
|
695
|
+
serverInfos.push({
|
|
696
|
+
name: serverName,
|
|
697
|
+
command: serverConfig.command || "",
|
|
698
|
+
args: Array.isArray(serverConfig.args) ? serverConfig.args : void 0,
|
|
699
|
+
transport: serverConfig.type === "streamable-http" ? "http" : serverConfig.type,
|
|
700
|
+
// Map streamable-http to http
|
|
701
|
+
type: serverConfig.type,
|
|
702
|
+
source: serverConfig.command || "",
|
|
703
|
+
env: serverConfig.env,
|
|
704
|
+
status: "stopped",
|
|
705
|
+
// Default status, will be updated by server manager
|
|
706
|
+
credentials: CredentialDetectionService.analyzeEnvironmentVariables(serverConfig.env)
|
|
707
|
+
});
|
|
708
|
+
}
|
|
709
|
+
}
|
|
710
|
+
return serverInfos;
|
|
711
|
+
}
|
|
712
|
+
/**
|
|
713
|
+
* Get friendly name for an app
|
|
714
|
+
*/
|
|
715
|
+
getFriendlyName(appName) {
|
|
716
|
+
const friendlyNames = {
|
|
717
|
+
claude: "Claude Desktop",
|
|
718
|
+
claude_code: "Claude Code",
|
|
719
|
+
cursor: "Cursor",
|
|
720
|
+
vscode: "VS Code",
|
|
721
|
+
cline: "Cline",
|
|
722
|
+
windsurf: "Windsurf",
|
|
723
|
+
roo: "Roo",
|
|
724
|
+
"intellij-github-copilot": "IntelliJ GitHub Copilot",
|
|
725
|
+
junie: "IntelliJ Junie",
|
|
726
|
+
zed: "Zed",
|
|
727
|
+
gemini: "Gemini CLI"
|
|
728
|
+
};
|
|
729
|
+
return friendlyNames[appName] || appName;
|
|
110
730
|
}
|
|
111
731
|
};
|
|
112
732
|
|
|
113
733
|
// src/services/mcp-server-manager-service.ts
|
|
114
|
-
var
|
|
734
|
+
var import_node_path3 = __toESM(require("path"), 1);
|
|
115
735
|
var import_node_child_process = require("child_process");
|
|
116
|
-
var
|
|
736
|
+
var import_node_os2 = require("os");
|
|
117
737
|
var MCPServerManagerService = class {
|
|
118
738
|
static {
|
|
119
739
|
__name(this, "MCPServerManagerService");
|
|
@@ -133,7 +753,7 @@ var MCPServerManagerService = class {
|
|
|
133
753
|
if (serverConfig?.type && serverConfig.type === "sse") {
|
|
134
754
|
this.transport = "sse";
|
|
135
755
|
}
|
|
136
|
-
if (serverConfig?.type && serverConfig.type === "http") {
|
|
756
|
+
if (serverConfig?.type && (serverConfig.type === "http" || serverConfig.type === "streamable-http")) {
|
|
137
757
|
this.transport = "http";
|
|
138
758
|
}
|
|
139
759
|
if (serverConfig?.type && serverConfig.type === "stdio") {
|
|
@@ -169,7 +789,7 @@ var MCPServerManagerService = class {
|
|
|
169
789
|
isRunning() {
|
|
170
790
|
try {
|
|
171
791
|
let psOutput;
|
|
172
|
-
if ((0,
|
|
792
|
+
if ((0, import_node_os2.platform)() === "win32") {
|
|
173
793
|
psOutput = (0, import_node_child_process.execSync)('powershell -Command "Get-CimInstance -ClassName Win32_Process | Select-Object ProcessId,Name,CommandLine,ParentProcessId | ConvertTo-Csv -NoTypeInformation"', {
|
|
174
794
|
encoding: "utf8",
|
|
175
795
|
timeout: 5e3
|
|
@@ -187,7 +807,7 @@ var MCPServerManagerService = class {
|
|
|
187
807
|
let pid;
|
|
188
808
|
let ppid;
|
|
189
809
|
let commandLine;
|
|
190
|
-
if ((0,
|
|
810
|
+
if ((0, import_node_os2.platform)() === "win32") {
|
|
191
811
|
if (processLine.startsWith('"ProcessId"') || processLine.startsWith("ProcessId")) continue;
|
|
192
812
|
const parts = this.parseCSVLine(processLine);
|
|
193
813
|
if (parts.length < 4) continue;
|
|
@@ -210,7 +830,7 @@ var MCPServerManagerService = class {
|
|
|
210
830
|
for (const [pid, processData] of processMap) {
|
|
211
831
|
const commandMatchLinux = this.isCommandMatch(processData.commandTokens, pid, processData.ppid);
|
|
212
832
|
let commandMatchWin32 = false;
|
|
213
|
-
if ((0,
|
|
833
|
+
if ((0, import_node_os2.platform)() === "win32") {
|
|
214
834
|
let commandTokensOnWin32 = processData.commandTokens;
|
|
215
835
|
if (commandTokensOnWin32.length > 0 && commandTokensOnWin32[0].toLowerCase().startsWith("cmd")) {
|
|
216
836
|
commandTokensOnWin32 = commandTokensOnWin32.slice(1);
|
|
@@ -321,9 +941,9 @@ var MCPServerManagerService = class {
|
|
|
321
941
|
return true;
|
|
322
942
|
}
|
|
323
943
|
getBaseCommand(fullCommandPath) {
|
|
324
|
-
let baseCommand =
|
|
325
|
-
if ((0,
|
|
326
|
-
baseCommand =
|
|
944
|
+
let baseCommand = import_node_path3.default.basename(fullCommandPath);
|
|
945
|
+
if ((0, import_node_os2.platform)() === "win32") {
|
|
946
|
+
baseCommand = import_node_path3.default.basename(fullCommandPath, ".exe");
|
|
327
947
|
}
|
|
328
948
|
baseCommand = baseCommand.toLowerCase();
|
|
329
949
|
return baseCommand;
|
|
@@ -505,305 +1125,209 @@ var MCPServerManagerService = class {
|
|
|
505
1125
|
};
|
|
506
1126
|
|
|
507
1127
|
// src/main.ts
|
|
508
|
-
var osSpecificPaths = {
|
|
509
|
-
claude: [],
|
|
510
|
-
claude_code: [],
|
|
511
|
-
cursor: [],
|
|
512
|
-
vscode: [],
|
|
513
|
-
cline: [],
|
|
514
|
-
windsurf: [],
|
|
515
|
-
roo: [],
|
|
516
|
-
"intellij-github-copilot": [],
|
|
517
|
-
junie: []
|
|
518
|
-
};
|
|
519
|
-
if ((0, import_node_os2.platform)() === "win32") {
|
|
520
|
-
osSpecificPaths["claude"] = [
|
|
521
|
-
{ filePath: `${process.env.APPDATA}\\Claude\\claude_desktop_config.json`, type: "global" }
|
|
522
|
-
];
|
|
523
|
-
osSpecificPaths["claude_code"] = [
|
|
524
|
-
{ filePath: ".mcp.json", type: "local" }
|
|
525
|
-
];
|
|
526
|
-
osSpecificPaths["cursor"] = [
|
|
527
|
-
{ filePath: "~\\.cursor\\mcp.json", type: "global" },
|
|
528
|
-
{ filePath: ".cursor\\mcp.json", type: "local" }
|
|
529
|
-
];
|
|
530
|
-
osSpecificPaths["vscode"] = [
|
|
531
|
-
{ filePath: ".vscode\\mcp.json", type: "local" },
|
|
532
|
-
{ filePath: `${process.env.APPDATA}\\Code\\User\\settings.json`, type: "global" },
|
|
533
|
-
{ filePath: `${process.env.APPDATA}\\Code - Insiders\\User\\settings.json`, type: "global" },
|
|
534
|
-
{ filePath: `${process.env.APPDATA}\\Code\\User\\mcp.json`, type: "global" },
|
|
535
|
-
{ filePath: `${process.env.APPDATA}\\Code - Insiders\\User\\mcp.json`, type: "global" }
|
|
536
|
-
];
|
|
537
|
-
osSpecificPaths["cline"] = [
|
|
538
|
-
{ filePath: `${process.env.APPDATA}\\Code\\User\\globalStorage\\saoudrizwan.claude-dev\\settings\\cline_mcp_settings.json`, type: "global" },
|
|
539
|
-
{ filePath: `${process.env.APPDATA}\\Code - Insiders\\User\\globalStorage\\saoudrizwan.claude-dev\\settings\\cline_mcp_settings.json`, type: "global" }
|
|
540
|
-
];
|
|
541
|
-
osSpecificPaths["windsurf"] = [
|
|
542
|
-
{ filePath: ".codeium\\windsurf\\mcp_config.json", type: "local" }
|
|
543
|
-
];
|
|
544
|
-
osSpecificPaths["roo"] = [
|
|
545
|
-
{ filePath: `${process.env.APPDATA}\\Code\\User\\globalStorage\\rooveterinaryinc.roo-cline\\settings\\cline_mcp_settings.json`, type: "global" },
|
|
546
|
-
{ filePath: `${process.env.APPDATA}\\Code - Insiders\\User\\globalStorage\\rooveterinaryinc.roo-cline\\settings\\cline_mcp_settings.json`, type: "global" }
|
|
547
|
-
];
|
|
548
|
-
osSpecificPaths["intellij-github-copilot"] = [
|
|
549
|
-
{ filePath: `${process.env.LOCALAPPDATA}\\github-copilot\\intellij\\mcp.json`, type: "global" }
|
|
550
|
-
];
|
|
551
|
-
osSpecificPaths["junie"] = [
|
|
552
|
-
{ filePath: "~\\.junie\\mcp\\mcp.json", type: "global" }
|
|
553
|
-
];
|
|
554
|
-
osSpecificPaths["zed"] = [
|
|
555
|
-
{ filePath: `${process.env.LOCALAPPDATA}\\zed\\settings.json`, type: "global" },
|
|
556
|
-
{ filePath: ".zed\\settings.json", type: "local" }
|
|
557
|
-
];
|
|
558
|
-
} else {
|
|
559
|
-
osSpecificPaths["claude"] = [
|
|
560
|
-
{ filePath: "~/Library/Application Support/Claude/claude_desktop_config.json", type: "global" }
|
|
561
|
-
];
|
|
562
|
-
osSpecificPaths["claude_code"] = [
|
|
563
|
-
{ filePath: ".mcp.json", type: "local" }
|
|
564
|
-
];
|
|
565
|
-
osSpecificPaths["cursor"] = [
|
|
566
|
-
{ filePath: "~/.cursor/mcp.json", type: "global" },
|
|
567
|
-
{ filePath: ".cursor/mcp.json", type: "local" }
|
|
568
|
-
];
|
|
569
|
-
osSpecificPaths["vscode"] = [
|
|
570
|
-
{ filePath: ".vscode/mcp.json", type: "local" },
|
|
571
|
-
{ filePath: "~/Library/Application Support/Code/User/settings.json", type: "global" },
|
|
572
|
-
{ filePath: "~/Library/Application Support/Code/User/mcp.json", type: "global" },
|
|
573
|
-
{ filePath: "~/Library/Application Support/Code - Insiders/User/settings.json", type: "global" },
|
|
574
|
-
{ filePath: "~/Library/Application Support/Code - Insiders/User/mcp.json", type: "global" }
|
|
575
|
-
];
|
|
576
|
-
osSpecificPaths["cline"] = [
|
|
577
|
-
{ filePath: "~/Library/Application Support/Code/User/globalStorage/saoudrizwan.claude-dev/settings/cline_mcp_settings.json", type: "global" },
|
|
578
|
-
{ filePath: "~/Library/Application Support/Code - Insiders/User/globalStorage/saoudrizwan.claude-dev/settings/cline_mcp_settings.json", type: "global" }
|
|
579
|
-
];
|
|
580
|
-
osSpecificPaths["windsurf"] = [
|
|
581
|
-
{ filePath: ".codeium/windsurf/mcp_config.json", type: "local" }
|
|
582
|
-
];
|
|
583
|
-
osSpecificPaths["roo"] = [
|
|
584
|
-
{ filePath: "~/Library/Application Support/Code/User/globalStorage/rooveterinaryinc.roo-cline/settings/cline_mcp_settings.json", type: "global" },
|
|
585
|
-
{ filePath: "~/Library/Application Support/Code - Insiders/User/globalStorage/rooveterinaryinc.roo-cline/settings/cline_mcp_settings.json", type: "global" }
|
|
586
|
-
];
|
|
587
|
-
osSpecificPaths["intellij-github-copilot"] = [
|
|
588
|
-
{ filePath: "~/.config/github-copilot/intellij/mcp.json", type: "global" }
|
|
589
|
-
];
|
|
590
|
-
osSpecificPaths["junie"] = [
|
|
591
|
-
{ filePath: "~/.junie/mcp/mcp.json", type: "global" },
|
|
592
|
-
{ filePath: ".junie/mcp/mcp.json", type: "local" }
|
|
593
|
-
];
|
|
594
|
-
osSpecificPaths["zed"] = [
|
|
595
|
-
{ filePath: "~/.config/zed/settings.json", type: "global" },
|
|
596
|
-
{ filePath: ".zed/settings.json", type: "local" }
|
|
597
|
-
];
|
|
598
|
-
}
|
|
599
1128
|
var MCPFiles = class {
|
|
600
1129
|
static {
|
|
601
1130
|
__name(this, "MCPFiles");
|
|
602
1131
|
}
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
friendlyName: "Claude Desktop",
|
|
607
|
-
paths: osSpecificPaths["claude"]
|
|
608
|
-
},
|
|
609
|
-
claude_code: {
|
|
610
|
-
name: "claude-code",
|
|
611
|
-
friendlyName: "Claude Code",
|
|
612
|
-
paths: osSpecificPaths["claude_code"]
|
|
613
|
-
},
|
|
614
|
-
cursor: {
|
|
615
|
-
name: "cursor",
|
|
616
|
-
friendlyName: "Cursor",
|
|
617
|
-
paths: osSpecificPaths["cursor"]
|
|
618
|
-
},
|
|
619
|
-
vscode: {
|
|
620
|
-
name: "vscode",
|
|
621
|
-
friendlyName: "VS Code",
|
|
622
|
-
paths: osSpecificPaths["vscode"]
|
|
623
|
-
},
|
|
624
|
-
cline: {
|
|
625
|
-
name: "cline",
|
|
626
|
-
friendlyName: "Cline",
|
|
627
|
-
paths: osSpecificPaths["cline"]
|
|
628
|
-
},
|
|
629
|
-
windsurf: {
|
|
630
|
-
name: "windsurf",
|
|
631
|
-
friendlyName: "Windsurf",
|
|
632
|
-
paths: osSpecificPaths["windsurf"]
|
|
633
|
-
},
|
|
634
|
-
roo: {
|
|
635
|
-
name: "roo",
|
|
636
|
-
friendlyName: "Roo",
|
|
637
|
-
paths: osSpecificPaths["roo"]
|
|
638
|
-
},
|
|
639
|
-
"intellij-github-copilot": {
|
|
640
|
-
name: "intellij-github-copilot",
|
|
641
|
-
friendlyName: "IntelliJ GitHub Copilot",
|
|
642
|
-
paths: osSpecificPaths["intellij-github-copilot"]
|
|
643
|
-
},
|
|
644
|
-
junie: {
|
|
645
|
-
name: "junie",
|
|
646
|
-
friendlyName: "IntelliJ Junie",
|
|
647
|
-
paths: osSpecificPaths["junie"]
|
|
648
|
-
},
|
|
649
|
-
zed: {
|
|
650
|
-
name: "zed",
|
|
651
|
-
friendlyName: "Zed",
|
|
652
|
-
paths: osSpecificPaths["zed"]
|
|
653
|
-
}
|
|
654
|
-
};
|
|
655
|
-
constructor(mcpFilePathGroups) {
|
|
656
|
-
this.mcpFilePathGroups = mcpFilePathGroups || this.mcpFilePathGroups;
|
|
1132
|
+
mcpConfigService;
|
|
1133
|
+
constructor() {
|
|
1134
|
+
this.mcpConfigService = new MCPConfigService();
|
|
657
1135
|
}
|
|
1136
|
+
/**
|
|
1137
|
+
* Find and process all MCP configuration files
|
|
1138
|
+
*/
|
|
658
1139
|
async findFiles() {
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
const
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
const mcpServersFromConfig = await MCPConfigLinter.getMCPServers();
|
|
683
|
-
for (const serverName of Object.keys(mcpServersFromConfig)) {
|
|
684
|
-
const serverConfigRaw = mcpServersFromConfig[serverName];
|
|
685
|
-
const serverConfig = {
|
|
686
|
-
name: serverName,
|
|
687
|
-
command: serverConfigRaw.command || "",
|
|
688
|
-
args: serverConfigRaw.args,
|
|
689
|
-
url: serverConfigRaw.url,
|
|
690
|
-
transport: serverConfigRaw.transport,
|
|
691
|
-
type: serverConfigRaw.type,
|
|
692
|
-
env: serverConfigRaw.env
|
|
693
|
-
};
|
|
694
|
-
const MCPServerManager = new MCPServerManagerService(serverConfig);
|
|
695
|
-
const mcpServerProcessDetection = MCPServerManager.isRunning();
|
|
696
|
-
let mcpServerProcess = false;
|
|
697
|
-
if (mcpServerProcessDetection) {
|
|
698
|
-
if (typeof mcpServerProcessDetection === "object" && mcpServerProcessDetection.estimatedProduct === clientsGroup.name) {
|
|
699
|
-
mcpServerProcess = true;
|
|
1140
|
+
try {
|
|
1141
|
+
const mcpFilesPathsData = await this.mcpConfigService.getMCPFileGroups();
|
|
1142
|
+
for (const groupName of Object.keys(mcpFilesPathsData)) {
|
|
1143
|
+
const group = mcpFilesPathsData[groupName];
|
|
1144
|
+
for (const filePathData of group.paths) {
|
|
1145
|
+
if (filePathData.servers && filePathData.servers.length > 0) {
|
|
1146
|
+
for (const server of filePathData.servers) {
|
|
1147
|
+
const serverConfig = {
|
|
1148
|
+
name: server.name,
|
|
1149
|
+
command: server.command,
|
|
1150
|
+
args: server.args,
|
|
1151
|
+
transport: server.transport,
|
|
1152
|
+
// transport is always populated from type in the data layer
|
|
1153
|
+
type: server.type,
|
|
1154
|
+
env: server.env
|
|
1155
|
+
};
|
|
1156
|
+
const serverManager = new MCPServerManagerService(serverConfig);
|
|
1157
|
+
const processDetection = serverManager.isRunning();
|
|
1158
|
+
let isRunning = false;
|
|
1159
|
+
if (processDetection) {
|
|
1160
|
+
if (typeof processDetection === "object" && processDetection.estimatedProduct === group.name) {
|
|
1161
|
+
isRunning = true;
|
|
1162
|
+
}
|
|
700
1163
|
}
|
|
1164
|
+
server.status = isRunning ? "running" : "stopped";
|
|
701
1165
|
}
|
|
702
|
-
mcpServersData.push({
|
|
703
|
-
name: MCPServerManager.getName(),
|
|
704
|
-
command: MCPServerManager.getCmd(),
|
|
705
|
-
args: MCPServerManager.getArgs(),
|
|
706
|
-
source: MCPServerManager.getSource(),
|
|
707
|
-
transport: MCPServerManager.getTransport(),
|
|
708
|
-
env: MCPServerManager.getEnv(),
|
|
709
|
-
status: mcpServerProcess ? "running" : "stopped"
|
|
710
|
-
});
|
|
711
1166
|
}
|
|
712
|
-
filePathData.servers = mcpServersData;
|
|
713
|
-
mcpFilesPathsData[groupName]["stats"]["serversCount"] = await MCPConfigLinter.countMCPServers();
|
|
714
|
-
mcpFilesPathsData[groupName].paths.push(filePathData);
|
|
715
|
-
} catch (error) {
|
|
716
1167
|
}
|
|
717
1168
|
}
|
|
1169
|
+
return mcpFilesPathsData;
|
|
1170
|
+
} catch (error) {
|
|
1171
|
+
throw new Error(`Failed to find MCP files: ${error instanceof Error ? error.message : "Unknown error"}`);
|
|
718
1172
|
}
|
|
719
|
-
|
|
1173
|
+
}
|
|
1174
|
+
/**
|
|
1175
|
+
* Get MCP configuration service instance for advanced operations
|
|
1176
|
+
*/
|
|
1177
|
+
getMCPConfigService() {
|
|
1178
|
+
return this.mcpConfigService;
|
|
720
1179
|
}
|
|
721
1180
|
};
|
|
722
1181
|
|
|
723
1182
|
// src/services/render-service.ts
|
|
724
|
-
var
|
|
1183
|
+
var import_node_util11 = require("util");
|
|
725
1184
|
|
|
726
1185
|
// src/components/transport.ts
|
|
727
|
-
var
|
|
1186
|
+
var import_node_util2 = require("util");
|
|
728
1187
|
function render(text) {
|
|
729
1188
|
const formattedText = text.toUpperCase();
|
|
730
1189
|
let data = "";
|
|
731
1190
|
if (formattedText === "STDIO") {
|
|
732
|
-
data = (0,
|
|
1191
|
+
data = (0, import_node_util2.styleText)(["magenta"], formattedText);
|
|
733
1192
|
}
|
|
734
1193
|
if (formattedText === "SSE") {
|
|
735
|
-
data = (0,
|
|
1194
|
+
data = (0, import_node_util2.styleText)(["blue"], formattedText);
|
|
736
1195
|
}
|
|
737
1196
|
if (formattedText === "HTTP") {
|
|
738
|
-
data = (0,
|
|
1197
|
+
data = (0, import_node_util2.styleText)(["blue"], formattedText);
|
|
739
1198
|
}
|
|
740
1199
|
return data;
|
|
741
1200
|
}
|
|
742
1201
|
__name(render, "render");
|
|
743
1202
|
|
|
744
1203
|
// src/components/column-name.ts
|
|
745
|
-
var
|
|
1204
|
+
var import_node_util3 = require("util");
|
|
746
1205
|
function render2(text) {
|
|
747
1206
|
const formattedText = String(text).toUpperCase();
|
|
748
|
-
const data = (0,
|
|
1207
|
+
const data = (0, import_node_util3.styleText)(["dim"], formattedText);
|
|
749
1208
|
return data;
|
|
750
1209
|
}
|
|
751
1210
|
__name(render2, "render");
|
|
752
1211
|
|
|
753
1212
|
// src/components/mcp-server-status.ts
|
|
754
|
-
var
|
|
1213
|
+
var import_node_util4 = require("util");
|
|
755
1214
|
function render3(text) {
|
|
756
1215
|
const formattedText = text.toLowerCase();
|
|
757
1216
|
let data = "";
|
|
758
1217
|
if (formattedText === "running") {
|
|
759
|
-
data = (0,
|
|
1218
|
+
data = (0, import_node_util4.styleText)(["green"], "\u25CF");
|
|
760
1219
|
} else {
|
|
761
|
-
data = (0,
|
|
1220
|
+
data = (0, import_node_util4.styleText)(["red"], "\u25CF");
|
|
762
1221
|
}
|
|
763
1222
|
return data;
|
|
764
1223
|
}
|
|
765
1224
|
__name(render3, "render");
|
|
766
1225
|
|
|
767
1226
|
// src/components/mcp-server-name.ts
|
|
768
|
-
var
|
|
1227
|
+
var import_node_util5 = require("util");
|
|
769
1228
|
function render4(text) {
|
|
770
1229
|
const formattedText = text.toLowerCase();
|
|
771
|
-
const data = (0,
|
|
1230
|
+
const data = (0, import_node_util5.styleText)(["bold", "white"], formattedText);
|
|
772
1231
|
return data;
|
|
773
1232
|
}
|
|
774
1233
|
__name(render4, "render");
|
|
775
1234
|
|
|
776
1235
|
// src/components/mcp-server-source.ts
|
|
777
|
-
var
|
|
1236
|
+
var import_node_util6 = require("util");
|
|
778
1237
|
function render5(text) {
|
|
779
1238
|
const formattedText = String(text).trim();
|
|
780
|
-
return (0,
|
|
1239
|
+
return (0, import_node_util6.styleText)(["gray"], formattedText);
|
|
781
1240
|
}
|
|
782
1241
|
__name(render5, "render");
|
|
783
1242
|
|
|
784
1243
|
// src/components/file-path.ts
|
|
785
|
-
var
|
|
1244
|
+
var import_node_util7 = require("util");
|
|
786
1245
|
function render6(text) {
|
|
787
1246
|
const formattedText = text;
|
|
788
|
-
const data = (0,
|
|
1247
|
+
const data = (0, import_node_util7.styleText)(["underline"], formattedText);
|
|
789
1248
|
return data;
|
|
790
1249
|
}
|
|
791
1250
|
__name(render6, "render");
|
|
792
1251
|
|
|
793
1252
|
// src/components/mcp-servers-config-parsable.ts
|
|
794
|
-
var
|
|
1253
|
+
var import_node_util8 = require("util");
|
|
795
1254
|
function render7(text) {
|
|
796
1255
|
const formattedText = text.toUpperCase().replace(/_/g, " ");
|
|
797
1256
|
let data = formattedText;
|
|
798
1257
|
if (formattedText === "VALID") {
|
|
799
|
-
data = (0,
|
|
1258
|
+
data = (0, import_node_util8.styleText)(["green"], "\u25CF");
|
|
800
1259
|
} else {
|
|
801
|
-
data = (0,
|
|
1260
|
+
data = (0, import_node_util8.styleText)(["red"], "\u25CF");
|
|
802
1261
|
}
|
|
803
1262
|
return data;
|
|
804
1263
|
}
|
|
805
1264
|
__name(render7, "render");
|
|
806
1265
|
|
|
1266
|
+
// src/components/credential-warning.ts
|
|
1267
|
+
var import_node_util9 = require("util");
|
|
1268
|
+
function CredentialWarningComponent(credentials) {
|
|
1269
|
+
if (!credentials || !credentials.hasCredentials) {
|
|
1270
|
+
return "";
|
|
1271
|
+
}
|
|
1272
|
+
const { riskLevel, credentialVars } = credentials;
|
|
1273
|
+
let riskColor;
|
|
1274
|
+
let riskIcon;
|
|
1275
|
+
switch (riskLevel) {
|
|
1276
|
+
case "high":
|
|
1277
|
+
riskColor = "red";
|
|
1278
|
+
riskIcon = (0, import_node_util9.styleText)(["red"], "\u25CF");
|
|
1279
|
+
break;
|
|
1280
|
+
case "low":
|
|
1281
|
+
riskColor = "blue";
|
|
1282
|
+
riskIcon = (0, import_node_util9.styleText)(["blue"], "\u25CF");
|
|
1283
|
+
break;
|
|
1284
|
+
default:
|
|
1285
|
+
riskColor = "blue";
|
|
1286
|
+
riskIcon = (0, import_node_util9.styleText)(["blue"], "\u25CF");
|
|
1287
|
+
}
|
|
1288
|
+
const riskText = (0, import_node_util9.styleText)([riskColor], `${riskIcon} ${riskLevel.toUpperCase()} RISK`);
|
|
1289
|
+
const credentialSummary = credentialVars.map((cv) => `${cv.name}=${cv.value}`).join(", ");
|
|
1290
|
+
return `${riskText} ${(0, import_node_util9.styleText)(["dim"], `(${credentialVars.length} cred vars: ${credentialSummary})`)}`;
|
|
1291
|
+
}
|
|
1292
|
+
__name(CredentialWarningComponent, "CredentialWarningComponent");
|
|
1293
|
+
|
|
1294
|
+
// src/components/summary.ts
|
|
1295
|
+
var import_node_util10 = require("util");
|
|
1296
|
+
function SummaryComponent(stats) {
|
|
1297
|
+
const { totalServers, runningServers, highRiskCredentials, transportBreakdown } = stats;
|
|
1298
|
+
const runningBar = createProgressBar(runningServers, totalServers, 20, "green");
|
|
1299
|
+
const securityBar = createProgressBar(highRiskCredentials, totalServers, 20, "red");
|
|
1300
|
+
const transportText = `stdio: ${transportBreakdown.stdio} | SSE: ${transportBreakdown.sse} | HTTP: ${transportBreakdown.http}`;
|
|
1301
|
+
const lines = [
|
|
1302
|
+
"SUMMARY",
|
|
1303
|
+
` SERVERS ${runningBar} ${runningServers} / ${totalServers} Running`,
|
|
1304
|
+
` SECURITY ${securityBar} ${highRiskCredentials} / ${totalServers} High Risk Credentials`,
|
|
1305
|
+
` TRANSPORT ${transportText}`
|
|
1306
|
+
];
|
|
1307
|
+
return lines.join("\n");
|
|
1308
|
+
}
|
|
1309
|
+
__name(SummaryComponent, "SummaryComponent");
|
|
1310
|
+
function createProgressBar(count, total, width, color) {
|
|
1311
|
+
if (total === 0) {
|
|
1312
|
+
const emptyBar = "\u2591".repeat(width);
|
|
1313
|
+
return emptyBar;
|
|
1314
|
+
}
|
|
1315
|
+
const progress = Math.min(count / total, 1);
|
|
1316
|
+
const filledWidth = Math.round(progress * width);
|
|
1317
|
+
const emptyWidth = width - filledWidth;
|
|
1318
|
+
let filled;
|
|
1319
|
+
let empty;
|
|
1320
|
+
if (color === "green") {
|
|
1321
|
+
filled = (0, import_node_util10.styleText)(["greenBright"], "\u2588".repeat(filledWidth));
|
|
1322
|
+
empty = (0, import_node_util10.styleText)(["green"], "\u2591".repeat(emptyWidth));
|
|
1323
|
+
} else {
|
|
1324
|
+
filled = (0, import_node_util10.styleText)(["redBright"], "\u2588".repeat(filledWidth));
|
|
1325
|
+
empty = (0, import_node_util10.styleText)(["red"], "\u2591".repeat(emptyWidth));
|
|
1326
|
+
}
|
|
1327
|
+
return `${filled}${empty}`;
|
|
1328
|
+
}
|
|
1329
|
+
__name(createProgressBar, "createProgressBar");
|
|
1330
|
+
|
|
807
1331
|
// src/services/render-service.ts
|
|
808
1332
|
var RenderService = class _RenderService {
|
|
809
1333
|
static {
|
|
@@ -820,8 +1344,8 @@ var RenderService = class _RenderService {
|
|
|
820
1344
|
}
|
|
821
1345
|
static printMcpServers(data) {
|
|
822
1346
|
if (data.length === 0) return;
|
|
823
|
-
const headers = ["STATUS", "NAME", "SOURCE", "TRANSPORT"];
|
|
824
|
-
const keys = ["status", "name", "source", "transport"];
|
|
1347
|
+
const headers = ["STATUS", "NAME", "SOURCE", "TRANSPORT", "CREDENTIALS"];
|
|
1348
|
+
const keys = ["status", "name", "source", "transport", "credentials"];
|
|
825
1349
|
const centerColumns = [0, 2, 3];
|
|
826
1350
|
const leftPadding = " ";
|
|
827
1351
|
const columnWidths = headers.map((header, index) => {
|
|
@@ -840,6 +1364,9 @@ var RenderService = class _RenderService {
|
|
|
840
1364
|
if (keys[index] === "name") {
|
|
841
1365
|
text = render4(text);
|
|
842
1366
|
}
|
|
1367
|
+
if (keys[index] === "credentials") {
|
|
1368
|
+
text = CredentialWarningComponent(row[keys[index]]);
|
|
1369
|
+
}
|
|
843
1370
|
return _RenderService.getVisibleLength(text);
|
|
844
1371
|
}));
|
|
845
1372
|
return Math.max(headerWidth, dataWidth);
|
|
@@ -883,6 +1410,9 @@ var RenderService = class _RenderService {
|
|
|
883
1410
|
if (key === "name") {
|
|
884
1411
|
text = render4(text);
|
|
885
1412
|
}
|
|
1413
|
+
if (key === "credentials") {
|
|
1414
|
+
text = CredentialWarningComponent(row[key]);
|
|
1415
|
+
}
|
|
886
1416
|
if (centerColumns.includes(index)) {
|
|
887
1417
|
return centerText(text, columnWidths[index]);
|
|
888
1418
|
}
|
|
@@ -952,14 +1482,33 @@ var RenderService = class _RenderService {
|
|
|
952
1482
|
let filled;
|
|
953
1483
|
let empty;
|
|
954
1484
|
if (count > 0) {
|
|
955
|
-
filled = (0,
|
|
956
|
-
empty = (0,
|
|
1485
|
+
filled = (0, import_node_util11.styleText)(["greenBright"], "\u2588".repeat(filledWidth));
|
|
1486
|
+
empty = (0, import_node_util11.styleText)(["green"], "\u2591".repeat(emptyWidth));
|
|
957
1487
|
} else {
|
|
958
1488
|
filled = "\u2588".repeat(filledWidth);
|
|
959
1489
|
empty = "\u2591".repeat(emptyWidth);
|
|
960
1490
|
}
|
|
961
1491
|
return `${filled}${empty} ${count} / ${total} ${label}`;
|
|
962
1492
|
}
|
|
1493
|
+
/**
|
|
1494
|
+
* Print summary statistics at the end of the output
|
|
1495
|
+
*/
|
|
1496
|
+
static printSummary(stats) {
|
|
1497
|
+
console.log("\n");
|
|
1498
|
+
console.log(" \u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584");
|
|
1499
|
+
console.log();
|
|
1500
|
+
const summaryOutput = SummaryComponent(stats);
|
|
1501
|
+
const lines = summaryOutput.split("\n");
|
|
1502
|
+
for (const line of lines) {
|
|
1503
|
+
if (line === "SUMMARY") {
|
|
1504
|
+
console.log(" " + line);
|
|
1505
|
+
} else {
|
|
1506
|
+
console.log(" " + line);
|
|
1507
|
+
}
|
|
1508
|
+
}
|
|
1509
|
+
console.log();
|
|
1510
|
+
console.log(" \u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584");
|
|
1511
|
+
}
|
|
963
1512
|
};
|
|
964
1513
|
|
|
965
1514
|
// src/bin/cli.ts
|
|
@@ -972,6 +1521,10 @@ async function init() {
|
|
|
972
1521
|
exitWithError("No configuration for MCP Server applications found.");
|
|
973
1522
|
}
|
|
974
1523
|
let pathIndex = 0;
|
|
1524
|
+
let totalServers = 0;
|
|
1525
|
+
let totalRunning = 0;
|
|
1526
|
+
let totalHighRiskCredentials = 0;
|
|
1527
|
+
const transportCounts = { stdio: 0, sse: 0, http: 0 };
|
|
975
1528
|
for (const groupName of Object.keys(mcpFilesList)) {
|
|
976
1529
|
const group = mcpFilesList[groupName];
|
|
977
1530
|
if (group.paths.length > 0) {
|
|
@@ -983,6 +1536,19 @@ async function init() {
|
|
|
983
1536
|
const mcpServers = filePathData.servers || [];
|
|
984
1537
|
const totalMCPServers = filePathData.servers ? filePathData.servers.length : 0;
|
|
985
1538
|
const totalMCPServersRunning = mcpServers.filter((server) => server.status === "running").length;
|
|
1539
|
+
totalServers += totalMCPServers;
|
|
1540
|
+
totalRunning += totalMCPServersRunning;
|
|
1541
|
+
for (const server of mcpServers) {
|
|
1542
|
+
if (server.transport) {
|
|
1543
|
+
const transport = server.transport.toLowerCase();
|
|
1544
|
+
if (transport in transportCounts) {
|
|
1545
|
+
transportCounts[transport]++;
|
|
1546
|
+
}
|
|
1547
|
+
}
|
|
1548
|
+
if (server.credentials?.hasCredentials && server.credentials?.riskLevel === "high") {
|
|
1549
|
+
totalHighRiskCredentials++;
|
|
1550
|
+
}
|
|
1551
|
+
}
|
|
986
1552
|
const mcpGroupData = [
|
|
987
1553
|
{ key: "PROVIDER", value: group.friendlyName },
|
|
988
1554
|
{ key: "FILE", value: filePath },
|
|
@@ -1001,13 +1567,20 @@ async function init() {
|
|
|
1001
1567
|
if (pathIndex === 0) {
|
|
1002
1568
|
exitWithError("No MCP servers found in known configuration files.");
|
|
1003
1569
|
}
|
|
1570
|
+
const summaryStats = {
|
|
1571
|
+
totalServers,
|
|
1572
|
+
runningServers: totalRunning,
|
|
1573
|
+
highRiskCredentials: totalHighRiskCredentials,
|
|
1574
|
+
transportBreakdown: transportCounts
|
|
1575
|
+
};
|
|
1576
|
+
RenderService.printSummary(summaryStats);
|
|
1004
1577
|
}
|
|
1005
1578
|
__name(init, "init");
|
|
1006
1579
|
init().then(() => {
|
|
1007
1580
|
console.log("\n");
|
|
1008
1581
|
});
|
|
1009
1582
|
function exitWithError(message) {
|
|
1010
|
-
console.error(`${(0,
|
|
1583
|
+
console.error(`${(0, import_node_util12.styleText)(["red"], "\u25CF")} ${message}
|
|
1011
1584
|
`);
|
|
1012
1585
|
process.exit(1);
|
|
1013
1586
|
}
|