ls-mcp 1.9.1 → 1.11.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 +29 -3
- package/dist/bin/cli.cjs +952 -289
- package/dist/bin/cli.mjs +935 -272
- package/dist/main.cjs +814 -263
- package/dist/main.d.cts +82 -14
- package/dist/main.d.ts +82 -14
- package/dist/main.mjs +814 -265
- 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 +50 -140
- package/src/services/credential-detection-service.ts +166 -0
- package/src/services/directory-bubble-service.ts +82 -0
- package/src/services/mcp-config-linter-service.ts +13 -74
- package/src/services/mcp-config-parser.ts +234 -0
- package/src/services/mcp-config-service.ts +304 -0
- package/src/services/mcp-path-registry.ts +164 -0
- package/src/services/mcp-server-manager-service.ts +5 -4
- package/src/services/render-service.ts +46 -2
- package/src/types/mcp-config-service.types.ts +76 -0
- package/src/types.ts +1 -1
- package/src/utils/url-utils.ts +24 -0
- package/src/utils/os-paths.ts +0 -102
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 import_promises2 = __toESM(require("fs/promises"), 1);
|
|
30
|
+
// src/services/mcp-config-service.ts
|
|
32
31
|
var import_node_os2 = require("os");
|
|
33
32
|
var import_node_path3 = __toESM(require("path"), 1);
|
|
33
|
+
var import_promises3 = __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,630 @@ 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 {};
|
|
71
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
|
+
url: serverConfig.url,
|
|
281
|
+
env
|
|
282
|
+
};
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
return normalized;
|
|
286
|
+
}
|
|
287
|
+
/**
|
|
288
|
+
* Validate type value
|
|
289
|
+
*/
|
|
290
|
+
validateType(type) {
|
|
291
|
+
return ["sse", "http", "stdio", "streamable-http"].includes(type);
|
|
292
|
+
}
|
|
293
|
+
/**
|
|
294
|
+
* Infer transport type from server configuration when type field is not explicitly set
|
|
295
|
+
*/
|
|
296
|
+
inferTransportType(serverConfig) {
|
|
297
|
+
if (serverConfig.url && typeof serverConfig.url === "string") {
|
|
298
|
+
return "http";
|
|
299
|
+
}
|
|
300
|
+
if (Array.isArray(serverConfig.args)) {
|
|
301
|
+
const argsString = serverConfig.args.join(" ").toLowerCase();
|
|
302
|
+
if (argsString.includes("stdio")) {
|
|
303
|
+
return "stdio";
|
|
304
|
+
}
|
|
305
|
+
if (argsString.includes("http")) {
|
|
306
|
+
return "http";
|
|
307
|
+
}
|
|
308
|
+
if (argsString.includes("sse")) {
|
|
309
|
+
return "sse";
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
if (serverConfig.command && typeof serverConfig.command === "string") {
|
|
313
|
+
return "stdio";
|
|
314
|
+
}
|
|
315
|
+
return void 0;
|
|
316
|
+
}
|
|
317
|
+
/**
|
|
318
|
+
* Validate server configuration
|
|
319
|
+
*/
|
|
320
|
+
validateServerConfig(serverConfig) {
|
|
321
|
+
if (!serverConfig || typeof serverConfig !== "object") {
|
|
322
|
+
return false;
|
|
323
|
+
}
|
|
324
|
+
if (!serverConfig.name || typeof serverConfig.name !== "string") {
|
|
325
|
+
return false;
|
|
326
|
+
}
|
|
327
|
+
if (!serverConfig.command || typeof serverConfig.command !== "string") {
|
|
328
|
+
return false;
|
|
329
|
+
}
|
|
330
|
+
return true;
|
|
331
|
+
}
|
|
332
|
+
/**
|
|
333
|
+
* Get supported configuration keys that the parser recognizes
|
|
334
|
+
*/
|
|
335
|
+
getSupportedConfigKeys() {
|
|
336
|
+
return ["servers", "mcp.servers", "mcpServers", "context_servers"];
|
|
337
|
+
}
|
|
338
|
+
/**
|
|
339
|
+
* Check if the configuration file has valid syntax
|
|
340
|
+
*/
|
|
72
341
|
async isValidSyntax() {
|
|
73
342
|
try {
|
|
74
|
-
await this.
|
|
75
|
-
return
|
|
343
|
+
const configData = await this.parseConfigFile();
|
|
344
|
+
return configData.valid;
|
|
76
345
|
} catch (error) {
|
|
77
346
|
return false;
|
|
78
347
|
}
|
|
79
348
|
}
|
|
349
|
+
/**
|
|
350
|
+
* Count the number of MCP servers in the configuration
|
|
351
|
+
*/
|
|
80
352
|
async countMCPServers() {
|
|
81
353
|
try {
|
|
82
|
-
const
|
|
83
|
-
return Object.keys(
|
|
354
|
+
const configData = await this.parseConfigFile();
|
|
355
|
+
return Object.keys(configData.servers).length;
|
|
84
356
|
} catch (error) {
|
|
85
357
|
return 0;
|
|
86
358
|
}
|
|
87
359
|
}
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
360
|
+
/**
|
|
361
|
+
* Get the raw file content
|
|
362
|
+
*/
|
|
363
|
+
async getFileContent() {
|
|
364
|
+
if (this.fileContents) {
|
|
365
|
+
return this.fileContents;
|
|
92
366
|
}
|
|
93
|
-
|
|
94
|
-
|
|
367
|
+
try {
|
|
368
|
+
this.fileContents = await import_promises.default.readFile(this.filePath, "utf-8");
|
|
369
|
+
return this.fileContents;
|
|
370
|
+
} catch (error) {
|
|
371
|
+
throw new Error(`Failed to read file: ${this.filePath}`);
|
|
95
372
|
}
|
|
96
|
-
|
|
97
|
-
|
|
373
|
+
}
|
|
374
|
+
};
|
|
375
|
+
|
|
376
|
+
// src/services/credential-detection-service.ts
|
|
377
|
+
var CredentialDetectionService = class {
|
|
378
|
+
static {
|
|
379
|
+
__name(this, "CredentialDetectionService");
|
|
380
|
+
}
|
|
381
|
+
/**
|
|
382
|
+
* Credential patterns grouped by risk level for easier maintenance
|
|
383
|
+
*/
|
|
384
|
+
static CREDENTIAL_PATTERNS = {
|
|
385
|
+
high: [
|
|
386
|
+
// API Keys and Tokens
|
|
387
|
+
/api[_-]?key/i,
|
|
388
|
+
/api[_-]?token/i,
|
|
389
|
+
/access[_-]?token/i,
|
|
390
|
+
/secret[_-]?key/i,
|
|
391
|
+
/private[_-]?key/i,
|
|
392
|
+
// Authentication Tokens
|
|
393
|
+
/auth[_-]?token/i,
|
|
394
|
+
/bearer[_-]?token/i,
|
|
395
|
+
/jwt[_-]?token/i,
|
|
396
|
+
/oauth[_-]?token/i,
|
|
397
|
+
// Passwords
|
|
398
|
+
/password/i,
|
|
399
|
+
/passwd/i,
|
|
400
|
+
/pwd/i,
|
|
401
|
+
// Credentials
|
|
402
|
+
/credential/i,
|
|
403
|
+
/creds/i,
|
|
404
|
+
// Specific service patterns
|
|
405
|
+
/openai[_-]?api[_-]?key/i,
|
|
406
|
+
/anthropic[_-]?api[_-]?key/i,
|
|
407
|
+
/firecrawl[_-]?api[_-]?key/i,
|
|
408
|
+
/github[_-]?token/i,
|
|
409
|
+
/gitlab[_-]?token/i,
|
|
410
|
+
/bitbucket[_-]?token/i,
|
|
411
|
+
// Database passwords
|
|
412
|
+
/db[_-]?password/i,
|
|
413
|
+
/database[_-]?password/i,
|
|
414
|
+
/redis[_-]?password/i,
|
|
415
|
+
/postgres[_-]?password/i,
|
|
416
|
+
/mysql[_-]?password/i,
|
|
417
|
+
// Cloud services
|
|
418
|
+
/aws[_-]?secret[_-]?access[_-]?key/i,
|
|
419
|
+
/aws[_-]?access[_-]?key[_-]?id/i,
|
|
420
|
+
/azure[_-]?key/i,
|
|
421
|
+
/gcp[_-]?key/i,
|
|
422
|
+
/google[_-]?api[_-]?key/i,
|
|
423
|
+
/gemini[_-]?api[_-]?key/i,
|
|
424
|
+
/claude[_-]?api[_-]?key/i
|
|
425
|
+
],
|
|
426
|
+
low: [
|
|
427
|
+
// Organization and Account IDs
|
|
428
|
+
/org[_-]?id/i,
|
|
429
|
+
/organization[_-]?id/i,
|
|
430
|
+
/account[_-]?id/i,
|
|
431
|
+
/user[_-]?id/i,
|
|
432
|
+
/openai[_-]?org[_-]?id/i
|
|
433
|
+
]
|
|
434
|
+
};
|
|
435
|
+
/**
|
|
436
|
+
* Check if an environment variable name suggests it might contain credentials
|
|
437
|
+
*/
|
|
438
|
+
static isPotentialCredential(envVarName) {
|
|
439
|
+
return this.CREDENTIAL_PATTERNS.high.some((pattern) => pattern.test(envVarName)) || this.CREDENTIAL_PATTERNS.low.some((pattern) => pattern.test(envVarName));
|
|
440
|
+
}
|
|
441
|
+
/**
|
|
442
|
+
* Analyze environment variables and return credential detection results
|
|
443
|
+
*/
|
|
444
|
+
static analyzeEnvironmentVariables(env) {
|
|
445
|
+
if (!env || typeof env !== "object") {
|
|
446
|
+
return {
|
|
447
|
+
hasCredentials: false,
|
|
448
|
+
credentialVars: [],
|
|
449
|
+
riskLevel: "none"
|
|
450
|
+
};
|
|
98
451
|
}
|
|
99
|
-
|
|
100
|
-
|
|
452
|
+
const credentialVars = [];
|
|
453
|
+
for (const [name, value] of Object.entries(env)) {
|
|
454
|
+
if (this.isPotentialCredential(name)) {
|
|
455
|
+
credentialVars.push({
|
|
456
|
+
name,
|
|
457
|
+
value: this.maskValue(value),
|
|
458
|
+
riskLevel: this.assessRiskLevel(name)
|
|
459
|
+
});
|
|
460
|
+
}
|
|
101
461
|
}
|
|
102
|
-
|
|
462
|
+
const hasCredentials = credentialVars.length > 0;
|
|
463
|
+
const riskLevel = this.calculateOverallRiskLevel(credentialVars);
|
|
464
|
+
return {
|
|
465
|
+
hasCredentials,
|
|
466
|
+
credentialVars,
|
|
467
|
+
riskLevel
|
|
468
|
+
};
|
|
103
469
|
}
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
470
|
+
/**
|
|
471
|
+
* Mask sensitive values for display (show only first and last character)
|
|
472
|
+
*/
|
|
473
|
+
static maskValue(value) {
|
|
474
|
+
if (!value || value.length <= 2) {
|
|
475
|
+
return value;
|
|
476
|
+
}
|
|
477
|
+
const first = value.charAt(0);
|
|
478
|
+
const last = value.charAt(value.length - 1);
|
|
479
|
+
const maskedLength = Math.min(value.length - 2, 8);
|
|
480
|
+
return `${first}${"*".repeat(maskedLength)}${last}`;
|
|
481
|
+
}
|
|
482
|
+
/**
|
|
483
|
+
* Assess risk level for a specific credential variable
|
|
484
|
+
*/
|
|
485
|
+
static assessRiskLevel(name) {
|
|
486
|
+
if (this.CREDENTIAL_PATTERNS.high.some((pattern) => pattern.test(name))) {
|
|
487
|
+
return "high";
|
|
488
|
+
}
|
|
489
|
+
if (this.CREDENTIAL_PATTERNS.low.some((pattern) => pattern.test(name))) {
|
|
490
|
+
return "low";
|
|
491
|
+
}
|
|
492
|
+
return "high";
|
|
493
|
+
}
|
|
494
|
+
/**
|
|
495
|
+
* Calculate overall risk level based on all credential variables
|
|
496
|
+
*/
|
|
497
|
+
static calculateOverallRiskLevel(credentialVars) {
|
|
498
|
+
if (credentialVars.length === 0) {
|
|
499
|
+
return "none";
|
|
500
|
+
}
|
|
501
|
+
const hasHighRisk = credentialVars.some((v) => v.riskLevel === "high");
|
|
502
|
+
if (hasHighRisk) {
|
|
503
|
+
return "high";
|
|
504
|
+
}
|
|
505
|
+
return "low";
|
|
506
|
+
}
|
|
507
|
+
};
|
|
508
|
+
|
|
509
|
+
// src/services/directory-bubble-service.ts
|
|
510
|
+
var import_node_path2 = __toESM(require("path"), 1);
|
|
511
|
+
var import_promises2 = __toESM(require("fs/promises"), 1);
|
|
512
|
+
var import_node_os = require("os");
|
|
513
|
+
var DirectoryBubbleService = class {
|
|
514
|
+
static {
|
|
515
|
+
__name(this, "DirectoryBubbleService");
|
|
516
|
+
}
|
|
517
|
+
/**
|
|
518
|
+
* Find a local MCP config file by bubbling up the directory tree
|
|
519
|
+
* @param localPath - The relative path to search for (e.g., '.vscode/mcp.json')
|
|
520
|
+
* @param startDir - The directory to start searching from
|
|
521
|
+
* @returns The absolute path to the found config file, or null if not found
|
|
522
|
+
*/
|
|
523
|
+
async findLocalConfigInParentDirectories(localPath, startDir) {
|
|
524
|
+
try {
|
|
525
|
+
let currentDir = import_node_path2.default.resolve(startDir);
|
|
526
|
+
const homeDir = (0, import_node_os.homedir)();
|
|
527
|
+
const rootDir = "/";
|
|
528
|
+
let iterationCount = 0;
|
|
529
|
+
const maxIterations = 100;
|
|
530
|
+
const startDirResult = await this.checkDirectoryForConfig(currentDir, localPath);
|
|
531
|
+
if (startDirResult) {
|
|
532
|
+
return import_node_path2.default.join(currentDir, localPath);
|
|
533
|
+
}
|
|
534
|
+
while (currentDir !== homeDir && currentDir !== rootDir && iterationCount < maxIterations) {
|
|
535
|
+
const parentDir = this.getParentDirectory(currentDir);
|
|
536
|
+
if (!parentDir || parentDir === currentDir) {
|
|
537
|
+
break;
|
|
538
|
+
}
|
|
539
|
+
if (parentDir === currentDir || parentDir.length >= currentDir.length) {
|
|
540
|
+
break;
|
|
541
|
+
}
|
|
542
|
+
currentDir = parentDir;
|
|
543
|
+
iterationCount++;
|
|
544
|
+
const found = await this.checkDirectoryForConfig(currentDir, localPath);
|
|
545
|
+
if (found) {
|
|
546
|
+
return import_node_path2.default.join(currentDir, localPath);
|
|
547
|
+
}
|
|
548
|
+
}
|
|
549
|
+
return null;
|
|
550
|
+
} catch (error) {
|
|
551
|
+
return null;
|
|
552
|
+
}
|
|
553
|
+
}
|
|
554
|
+
/**
|
|
555
|
+
* Check if a config file exists in the specified directory
|
|
556
|
+
* @param dir - The directory to check
|
|
557
|
+
* @param configPath - The relative path to the config file
|
|
558
|
+
* @returns True if the config file exists and is accessible
|
|
559
|
+
*/
|
|
560
|
+
async checkDirectoryForConfig(dir, configPath) {
|
|
561
|
+
try {
|
|
562
|
+
const fullPath = import_node_path2.default.join(dir, configPath);
|
|
563
|
+
await import_promises2.default.access(fullPath);
|
|
564
|
+
return true;
|
|
565
|
+
} catch (error) {
|
|
566
|
+
return false;
|
|
107
567
|
}
|
|
108
|
-
|
|
109
|
-
|
|
568
|
+
}
|
|
569
|
+
/**
|
|
570
|
+
* Get the parent directory of the specified directory
|
|
571
|
+
* @param dir - The directory to get the parent of
|
|
572
|
+
* @returns The parent directory path, or null if already at root
|
|
573
|
+
*/
|
|
574
|
+
getParentDirectory(dir) {
|
|
575
|
+
const parent = import_node_path2.default.dirname(dir);
|
|
576
|
+
return parent === dir ? null : parent;
|
|
577
|
+
}
|
|
578
|
+
};
|
|
579
|
+
|
|
580
|
+
// src/utils/url-utils.ts
|
|
581
|
+
function extractHostname(urlString) {
|
|
582
|
+
try {
|
|
583
|
+
let urlToParse = urlString;
|
|
584
|
+
if (!urlToParse.includes("://")) {
|
|
585
|
+
urlToParse = `http://${urlToParse}`;
|
|
586
|
+
}
|
|
587
|
+
const url = new URL(urlToParse);
|
|
588
|
+
return url.hostname;
|
|
589
|
+
} catch (error) {
|
|
590
|
+
return urlString;
|
|
591
|
+
}
|
|
592
|
+
}
|
|
593
|
+
__name(extractHostname, "extractHostname");
|
|
594
|
+
|
|
595
|
+
// src/services/mcp-config-service.ts
|
|
596
|
+
var MCPConfigService = class {
|
|
597
|
+
static {
|
|
598
|
+
__name(this, "MCPConfigService");
|
|
599
|
+
}
|
|
600
|
+
pathRegistry;
|
|
601
|
+
currentOS;
|
|
602
|
+
debug;
|
|
603
|
+
directoryBubbleService;
|
|
604
|
+
enableDirectoryBubbling;
|
|
605
|
+
constructor(options = {}) {
|
|
606
|
+
this.pathRegistry = new MCPPathRegistry();
|
|
607
|
+
this.currentOS = (0, import_node_os2.platform)();
|
|
608
|
+
this.debug = import_node_util.default.debuglog("ls-mcp");
|
|
609
|
+
this.directoryBubbleService = new DirectoryBubbleService();
|
|
610
|
+
this.enableDirectoryBubbling = options.enableDirectoryBubbling ?? false;
|
|
611
|
+
}
|
|
612
|
+
/**
|
|
613
|
+
* Get MCP configuration files for a specific AI application on the current OS
|
|
614
|
+
*/
|
|
615
|
+
getConfigFilesPerApp(appName) {
|
|
616
|
+
try {
|
|
617
|
+
return this.pathRegistry.getPathsForApp(this.currentOS, appName);
|
|
618
|
+
} catch (error) {
|
|
619
|
+
throw new Error(`Failed to get config files for app '${appName}': ${error instanceof Error ? error.message : "Unknown error"}`);
|
|
620
|
+
}
|
|
621
|
+
}
|
|
622
|
+
/**
|
|
623
|
+
* Get MCP configuration files for all AI applications on the current OS
|
|
624
|
+
*/
|
|
625
|
+
getAllConfigFiles() {
|
|
626
|
+
try {
|
|
627
|
+
return this.pathRegistry.getPathsForOS(this.currentOS);
|
|
628
|
+
} catch (error) {
|
|
629
|
+
throw new Error(`Failed to get all config files: ${error instanceof Error ? error.message : "Unknown error"}`);
|
|
630
|
+
}
|
|
631
|
+
}
|
|
632
|
+
/**
|
|
633
|
+
* Get MCP servers configured for a specific AI application on the current OS
|
|
634
|
+
*/
|
|
635
|
+
async getMCPServersPerApp(appName) {
|
|
636
|
+
try {
|
|
637
|
+
const appPaths = this.getConfigFilesPerApp(appName);
|
|
638
|
+
const allServers = [];
|
|
639
|
+
for (const filePath of appPaths) {
|
|
640
|
+
const servers = await this.parseConfigFileForServers(filePath.filePath);
|
|
641
|
+
allServers.push(...servers);
|
|
642
|
+
}
|
|
643
|
+
return allServers;
|
|
644
|
+
} catch (error) {
|
|
645
|
+
throw new Error(`Failed to get MCP servers for app '${appName}': ${error instanceof Error ? error.message : "Unknown error"}`);
|
|
646
|
+
}
|
|
647
|
+
}
|
|
648
|
+
/**
|
|
649
|
+
* Get MCP servers configured for all AI applications on the current OS
|
|
650
|
+
*/
|
|
651
|
+
async getAllMCPServers() {
|
|
652
|
+
try {
|
|
653
|
+
const allApps = this.pathRegistry.getSupportedApps(this.currentOS);
|
|
654
|
+
const allServers = {};
|
|
655
|
+
for (const appName of allApps) {
|
|
656
|
+
try {
|
|
657
|
+
allServers[appName] = await this.getMCPServersPerApp(appName);
|
|
658
|
+
} catch (error) {
|
|
659
|
+
this.debug(`Failed to get servers for app '${appName}': ${error instanceof Error ? error.message : "Unknown error"}`);
|
|
660
|
+
allServers[appName] = [];
|
|
661
|
+
}
|
|
662
|
+
}
|
|
663
|
+
return allServers;
|
|
664
|
+
} catch (error) {
|
|
665
|
+
throw new Error(`Failed to get all MCP servers: ${error instanceof Error ? error.message : "Unknown error"}`);
|
|
666
|
+
}
|
|
667
|
+
}
|
|
668
|
+
/**
|
|
669
|
+
* Get metadata for all supported AI applications on the current OS
|
|
670
|
+
*/
|
|
671
|
+
getSupportedApps() {
|
|
672
|
+
try {
|
|
673
|
+
const appNames = this.pathRegistry.getSupportedApps(this.currentOS);
|
|
674
|
+
const appPaths = this.pathRegistry.getPathsForOS(this.currentOS);
|
|
675
|
+
return appNames.map((appName) => ({
|
|
676
|
+
name: appName,
|
|
677
|
+
friendlyName: this.getFriendlyName(appName),
|
|
678
|
+
paths: appPaths[appName] || []
|
|
679
|
+
}));
|
|
680
|
+
} catch (error) {
|
|
681
|
+
throw new Error(`Failed to get supported apps: ${error instanceof Error ? error.message : "Unknown error"}`);
|
|
682
|
+
}
|
|
683
|
+
}
|
|
684
|
+
/**
|
|
685
|
+
* Get all supported operating systems
|
|
686
|
+
*/
|
|
687
|
+
getSupportedOperatingSystems() {
|
|
688
|
+
return this.pathRegistry.getSupportedOperatingSystems();
|
|
689
|
+
}
|
|
690
|
+
/**
|
|
691
|
+
* Validate if a configuration file exists and is parsable
|
|
692
|
+
*/
|
|
693
|
+
async validateConfigFile(filePath) {
|
|
694
|
+
try {
|
|
695
|
+
await import_promises3.default.access(filePath);
|
|
696
|
+
const parser = this.createParser(filePath);
|
|
697
|
+
return await parser.isValidSyntax();
|
|
698
|
+
} catch (error) {
|
|
699
|
+
return false;
|
|
700
|
+
}
|
|
701
|
+
}
|
|
702
|
+
/**
|
|
703
|
+
* Create a parser instance (can be overridden for testing)
|
|
704
|
+
*/
|
|
705
|
+
createParser(filePath) {
|
|
706
|
+
return new MCPConfigParser(filePath);
|
|
707
|
+
}
|
|
708
|
+
/**
|
|
709
|
+
* Get MCP file groups with resolved paths and server information
|
|
710
|
+
*/
|
|
711
|
+
async getMCPFileGroups() {
|
|
712
|
+
try {
|
|
713
|
+
const appPaths = this.getAllConfigFiles();
|
|
714
|
+
const mcpFilesPathsData = {};
|
|
715
|
+
for (const [groupName, paths] of Object.entries(appPaths)) {
|
|
716
|
+
mcpFilesPathsData[groupName] = {
|
|
717
|
+
name: groupName,
|
|
718
|
+
friendlyName: this.getFriendlyName(groupName),
|
|
719
|
+
paths: [],
|
|
720
|
+
stats: { serversCount: 0 }
|
|
721
|
+
};
|
|
722
|
+
const uniqueFilePaths = /* @__PURE__ */ new Set();
|
|
723
|
+
let totalServersCount = 0;
|
|
724
|
+
for (const filePathData of paths) {
|
|
725
|
+
let resolvedPath = filePathData.filePath.replace("~", process.env.HOME || "");
|
|
726
|
+
let absolutePath = import_node_path3.default.resolve(resolvedPath);
|
|
727
|
+
if (filePathData.type === "local" && this.enableDirectoryBubbling) {
|
|
728
|
+
try {
|
|
729
|
+
await import_promises3.default.access(resolvedPath);
|
|
730
|
+
} catch (error) {
|
|
731
|
+
const bubbledPath = await this.directoryBubbleService.findLocalConfigInParentDirectories(
|
|
732
|
+
filePathData.filePath,
|
|
733
|
+
process.cwd()
|
|
734
|
+
);
|
|
735
|
+
if (bubbledPath) {
|
|
736
|
+
resolvedPath = bubbledPath;
|
|
737
|
+
absolutePath = import_node_path3.default.resolve(resolvedPath);
|
|
738
|
+
}
|
|
739
|
+
}
|
|
740
|
+
}
|
|
741
|
+
if (uniqueFilePaths.has(absolutePath)) {
|
|
742
|
+
continue;
|
|
743
|
+
}
|
|
744
|
+
uniqueFilePaths.add(absolutePath);
|
|
745
|
+
try {
|
|
746
|
+
await import_promises3.default.access(resolvedPath);
|
|
747
|
+
const parser = this.createParser(resolvedPath);
|
|
748
|
+
const parsable = await parser.isValidSyntax();
|
|
749
|
+
filePathData.parsable = parsable;
|
|
750
|
+
if (parsable) {
|
|
751
|
+
const configData = await parser.parseConfigFile();
|
|
752
|
+
const servers = await this.convertToMCPServerInfo(configData.servers || {});
|
|
753
|
+
filePathData.servers = servers;
|
|
754
|
+
totalServersCount += servers.length;
|
|
755
|
+
}
|
|
756
|
+
mcpFilesPathsData[groupName].paths.push(filePathData);
|
|
757
|
+
} catch (error) {
|
|
758
|
+
this.debug(`Skipping file ${resolvedPath}: ${error instanceof Error ? error.message : "Unknown error"}`);
|
|
759
|
+
}
|
|
760
|
+
}
|
|
761
|
+
if (mcpFilesPathsData[groupName] && mcpFilesPathsData[groupName].stats) {
|
|
762
|
+
mcpFilesPathsData[groupName].stats.serversCount = totalServersCount;
|
|
763
|
+
}
|
|
764
|
+
}
|
|
765
|
+
return mcpFilesPathsData;
|
|
766
|
+
} catch (error) {
|
|
767
|
+
throw new Error(`Failed to get MCP file groups: ${error instanceof Error ? error.message : "Unknown error"}`);
|
|
768
|
+
}
|
|
769
|
+
}
|
|
770
|
+
/**
|
|
771
|
+
* Register a custom app with custom paths for the current OS
|
|
772
|
+
*/
|
|
773
|
+
registerCustomApp(appName, paths) {
|
|
774
|
+
try {
|
|
775
|
+
this.pathRegistry.registerCustomApp(this.currentOS, appName, paths);
|
|
776
|
+
} catch (error) {
|
|
777
|
+
throw new Error(`Failed to register custom app '${appName}': ${error instanceof Error ? error.message : "Unknown error"}`);
|
|
778
|
+
}
|
|
779
|
+
}
|
|
780
|
+
/**
|
|
781
|
+
* Parse a configuration file and return server information
|
|
782
|
+
*/
|
|
783
|
+
async parseConfigFileForServers(filePath) {
|
|
784
|
+
try {
|
|
785
|
+
const parser = this.createParser(filePath);
|
|
786
|
+
const configData = await parser.parseConfigFile();
|
|
787
|
+
return await this.convertToMCPServerInfo(configData.servers || {});
|
|
788
|
+
} catch (error) {
|
|
789
|
+
this.debug(`Failed to parse config file ${filePath}: ${error instanceof Error ? error.message : "Unknown error"}`);
|
|
790
|
+
return [];
|
|
791
|
+
}
|
|
792
|
+
}
|
|
793
|
+
/**
|
|
794
|
+
* Convert parsed server configs to MCPServerInfo format
|
|
795
|
+
*/
|
|
796
|
+
async convertToMCPServerInfo(servers) {
|
|
797
|
+
const serverInfos = [];
|
|
798
|
+
for (const [serverName, serverConfig] of Object.entries(servers)) {
|
|
799
|
+
if (serverConfig && typeof serverConfig === "object") {
|
|
800
|
+
let source;
|
|
801
|
+
if (serverConfig.url) {
|
|
802
|
+
source = extractHostname(serverConfig.url);
|
|
803
|
+
} else {
|
|
804
|
+
source = serverConfig.command || "";
|
|
805
|
+
}
|
|
806
|
+
serverInfos.push({
|
|
807
|
+
name: serverName,
|
|
808
|
+
command: serverConfig.command || "",
|
|
809
|
+
args: Array.isArray(serverConfig.args) ? serverConfig.args : void 0,
|
|
810
|
+
transport: serverConfig.type === "streamable-http" ? "http" : serverConfig.type,
|
|
811
|
+
// Map streamable-http to http
|
|
812
|
+
type: serverConfig.type,
|
|
813
|
+
source,
|
|
814
|
+
env: serverConfig.env,
|
|
815
|
+
status: "stopped",
|
|
816
|
+
// Default status, will be updated by server manager
|
|
817
|
+
credentials: CredentialDetectionService.analyzeEnvironmentVariables(serverConfig.env)
|
|
818
|
+
});
|
|
819
|
+
}
|
|
820
|
+
}
|
|
821
|
+
return serverInfos;
|
|
822
|
+
}
|
|
823
|
+
/**
|
|
824
|
+
* Get friendly name for an app
|
|
825
|
+
*/
|
|
826
|
+
getFriendlyName(appName) {
|
|
827
|
+
const friendlyNames = {
|
|
828
|
+
claude: "Claude Desktop",
|
|
829
|
+
claude_code: "Claude Code",
|
|
830
|
+
cursor: "Cursor",
|
|
831
|
+
vscode: "VS Code",
|
|
832
|
+
cline: "Cline",
|
|
833
|
+
windsurf: "Windsurf",
|
|
834
|
+
roo: "Roo",
|
|
835
|
+
"intellij-github-copilot": "IntelliJ GitHub Copilot",
|
|
836
|
+
junie: "IntelliJ Junie",
|
|
837
|
+
zed: "Zed",
|
|
838
|
+
gemini: "Gemini CLI"
|
|
839
|
+
};
|
|
840
|
+
return friendlyNames[appName] || appName;
|
|
110
841
|
}
|
|
111
842
|
};
|
|
112
843
|
|
|
113
844
|
// src/services/mcp-server-manager-service.ts
|
|
114
|
-
var
|
|
845
|
+
var import_node_path4 = __toESM(require("path"), 1);
|
|
115
846
|
var import_node_child_process = require("child_process");
|
|
116
|
-
var
|
|
847
|
+
var import_node_os3 = require("os");
|
|
117
848
|
var MCPServerManagerService = class {
|
|
118
849
|
static {
|
|
119
850
|
__name(this, "MCPServerManagerService");
|
|
@@ -133,14 +864,14 @@ var MCPServerManagerService = class {
|
|
|
133
864
|
if (serverConfig?.type && serverConfig.type === "sse") {
|
|
134
865
|
this.transport = "sse";
|
|
135
866
|
}
|
|
136
|
-
if (serverConfig?.type && serverConfig.type === "http") {
|
|
867
|
+
if (serverConfig?.type && (serverConfig.type === "http" || serverConfig.type === "streamable-http")) {
|
|
137
868
|
this.transport = "http";
|
|
138
869
|
}
|
|
139
870
|
if (serverConfig?.type && serverConfig.type === "stdio") {
|
|
140
871
|
this.transport = "stdio";
|
|
141
872
|
}
|
|
142
873
|
if (serverConfig.url) {
|
|
143
|
-
this.source = serverConfig.url;
|
|
874
|
+
this.source = extractHostname(serverConfig.url);
|
|
144
875
|
this.transport = "http";
|
|
145
876
|
} else {
|
|
146
877
|
const fullCommand = [serverConfig.command, ...serverConfig.args || []].join(" ");
|
|
@@ -169,7 +900,7 @@ var MCPServerManagerService = class {
|
|
|
169
900
|
isRunning() {
|
|
170
901
|
try {
|
|
171
902
|
let psOutput;
|
|
172
|
-
if ((0,
|
|
903
|
+
if ((0, import_node_os3.platform)() === "win32") {
|
|
173
904
|
psOutput = (0, import_node_child_process.execSync)('powershell -Command "Get-CimInstance -ClassName Win32_Process | Select-Object ProcessId,Name,CommandLine,ParentProcessId | ConvertTo-Csv -NoTypeInformation"', {
|
|
174
905
|
encoding: "utf8",
|
|
175
906
|
timeout: 5e3
|
|
@@ -187,7 +918,7 @@ var MCPServerManagerService = class {
|
|
|
187
918
|
let pid;
|
|
188
919
|
let ppid;
|
|
189
920
|
let commandLine;
|
|
190
|
-
if ((0,
|
|
921
|
+
if ((0, import_node_os3.platform)() === "win32") {
|
|
191
922
|
if (processLine.startsWith('"ProcessId"') || processLine.startsWith("ProcessId")) continue;
|
|
192
923
|
const parts = this.parseCSVLine(processLine);
|
|
193
924
|
if (parts.length < 4) continue;
|
|
@@ -210,7 +941,7 @@ var MCPServerManagerService = class {
|
|
|
210
941
|
for (const [pid, processData] of processMap) {
|
|
211
942
|
const commandMatchLinux = this.isCommandMatch(processData.commandTokens, pid, processData.ppid);
|
|
212
943
|
let commandMatchWin32 = false;
|
|
213
|
-
if ((0,
|
|
944
|
+
if ((0, import_node_os3.platform)() === "win32") {
|
|
214
945
|
let commandTokensOnWin32 = processData.commandTokens;
|
|
215
946
|
if (commandTokensOnWin32.length > 0 && commandTokensOnWin32[0].toLowerCase().startsWith("cmd")) {
|
|
216
947
|
commandTokensOnWin32 = commandTokensOnWin32.slice(1);
|
|
@@ -321,9 +1052,9 @@ var MCPServerManagerService = class {
|
|
|
321
1052
|
return true;
|
|
322
1053
|
}
|
|
323
1054
|
getBaseCommand(fullCommandPath) {
|
|
324
|
-
let baseCommand =
|
|
325
|
-
if ((0,
|
|
326
|
-
baseCommand =
|
|
1055
|
+
let baseCommand = import_node_path4.default.basename(fullCommandPath);
|
|
1056
|
+
if ((0, import_node_os3.platform)() === "win32") {
|
|
1057
|
+
baseCommand = import_node_path4.default.basename(fullCommandPath, ".exe");
|
|
327
1058
|
}
|
|
328
1059
|
baseCommand = baseCommand.toLowerCase();
|
|
329
1060
|
return baseCommand;
|
|
@@ -504,327 +1235,210 @@ var MCPServerManagerService = class {
|
|
|
504
1235
|
}
|
|
505
1236
|
};
|
|
506
1237
|
|
|
507
|
-
// src/utils/os-paths.ts
|
|
508
|
-
var import_node_path2 = __toESM(require("path"), 1);
|
|
509
|
-
var appData = process.env.APPDATA || "";
|
|
510
|
-
var localAppData = process.env.LOCALAPPDATA || "";
|
|
511
|
-
var homeDir = process.env.HOME || "";
|
|
512
|
-
function getWindowsPaths() {
|
|
513
|
-
return {
|
|
514
|
-
claude: [
|
|
515
|
-
{ filePath: import_node_path2.default.join(appData, "Claude", "claude_desktop_config.json"), type: "global" }
|
|
516
|
-
],
|
|
517
|
-
claude_code: [
|
|
518
|
-
{ filePath: ".mcp.json", type: "local" }
|
|
519
|
-
],
|
|
520
|
-
cursor: [
|
|
521
|
-
{ filePath: import_node_path2.default.join(homeDir, ".cursor", "mcp.json"), type: "global" },
|
|
522
|
-
{ filePath: import_node_path2.default.join(".cursor", "mcp.json"), type: "local" }
|
|
523
|
-
],
|
|
524
|
-
vscode: [
|
|
525
|
-
{ filePath: import_node_path2.default.join(".vscode", "mcp.json"), type: "local" },
|
|
526
|
-
{ filePath: import_node_path2.default.join(appData, "Code", "User", "settings.json"), type: "global" },
|
|
527
|
-
{ filePath: import_node_path2.default.join(appData, "Code - Insiders", "User", "settings.json"), type: "global" },
|
|
528
|
-
{ filePath: import_node_path2.default.join(appData, "Code", "User", "mcp.json"), type: "global" },
|
|
529
|
-
{ filePath: import_node_path2.default.join(appData, "Code - Insiders", "User", "mcp.json"), type: "global" }
|
|
530
|
-
],
|
|
531
|
-
cline: [
|
|
532
|
-
{ filePath: import_node_path2.default.join(appData, "Code", "User", "globalStorage", "saoudrizwan.claude-dev", "settings", "cline_mcp_settings.json"), type: "global" },
|
|
533
|
-
{ filePath: import_node_path2.default.join(appData, "Code - Insiders", "User", "globalStorage", "saoudrizwan.claude-dev", "settings", "cline_mcp_settings.json"), type: "global" }
|
|
534
|
-
],
|
|
535
|
-
windsurf: [
|
|
536
|
-
{ filePath: import_node_path2.default.join(".codeium", "windsurf", "mcp_config.json"), type: "local" }
|
|
537
|
-
],
|
|
538
|
-
roo: [
|
|
539
|
-
{ filePath: import_node_path2.default.join(appData, "Code", "User", "globalStorage", "rooveterinaryinc.roo-cline", "settings", "cline_mcp_settings.json"), type: "global" },
|
|
540
|
-
{ filePath: import_node_path2.default.join(appData, "Code - Insiders", "User", "globalStorage", "rooveterinaryinc.roo-cline", "settings", "cline_mcp_settings.json"), type: "global" }
|
|
541
|
-
],
|
|
542
|
-
"intellij-github-copilot": [
|
|
543
|
-
{ filePath: import_node_path2.default.join(localAppData, "github-copilot", "intellij", "mcp.json"), type: "global" }
|
|
544
|
-
],
|
|
545
|
-
junie: [
|
|
546
|
-
{ filePath: import_node_path2.default.join(homeDir, ".junie", "mcp", "mcp.json"), type: "global" }
|
|
547
|
-
],
|
|
548
|
-
zed: [
|
|
549
|
-
{ filePath: import_node_path2.default.join(localAppData, "zed", "settings.json"), type: "global" },
|
|
550
|
-
{ filePath: import_node_path2.default.join(".zed", "settings.json"), type: "local" }
|
|
551
|
-
],
|
|
552
|
-
gemini: [
|
|
553
|
-
{ filePath: import_node_path2.default.join(homeDir, ".gemini", "settings.json"), type: "global" },
|
|
554
|
-
{ filePath: import_node_path2.default.join(".gemini", "settings.json"), type: "local" }
|
|
555
|
-
]
|
|
556
|
-
};
|
|
557
|
-
}
|
|
558
|
-
__name(getWindowsPaths, "getWindowsPaths");
|
|
559
|
-
function getDarwinPaths() {
|
|
560
|
-
return {
|
|
561
|
-
claude: [
|
|
562
|
-
{ filePath: import_node_path2.default.join(homeDir, "Library", "Application Support", "Claude", "claude_desktop_config.json"), type: "global" }
|
|
563
|
-
],
|
|
564
|
-
claude_code: [
|
|
565
|
-
{ filePath: ".mcp.json", type: "local" }
|
|
566
|
-
],
|
|
567
|
-
cursor: [
|
|
568
|
-
{ filePath: import_node_path2.default.join(homeDir, ".cursor", "mcp.json"), type: "global" },
|
|
569
|
-
{ filePath: import_node_path2.default.join(".cursor", "mcp.json"), type: "local" }
|
|
570
|
-
],
|
|
571
|
-
vscode: [
|
|
572
|
-
{ filePath: import_node_path2.default.join(".vscode", "mcp.json"), type: "local" },
|
|
573
|
-
{ filePath: import_node_path2.default.join(homeDir, "Library", "Application Support", "Code", "User", "settings.json"), type: "global" },
|
|
574
|
-
{ filePath: import_node_path2.default.join(homeDir, "Library", "Application Support", "Code", "User", "mcp.json"), type: "global" },
|
|
575
|
-
{ filePath: import_node_path2.default.join(homeDir, "Library", "Application Support", "Code - Insiders", "User", "settings.json"), type: "global" },
|
|
576
|
-
{ filePath: import_node_path2.default.join(homeDir, "Library", "Application Support", "Code - Insiders", "User", "mcp.json"), type: "global" }
|
|
577
|
-
],
|
|
578
|
-
cline: [
|
|
579
|
-
{ filePath: import_node_path2.default.join(homeDir, "Library", "Application Support", "Code", "User", "globalStorage", "saoudrizwan.claude-dev", "settings", "cline_mcp_settings.json"), type: "global" },
|
|
580
|
-
{ filePath: import_node_path2.default.join(homeDir, "Library", "Application Support", "Code - Insiders", "User", "globalStorage", "saoudrizwan.claude-dev", "settings", "cline_mcp_settings.json"), type: "global" }
|
|
581
|
-
],
|
|
582
|
-
windsurf: [
|
|
583
|
-
{ filePath: import_node_path2.default.join(".codeium", "windsurf", "mcp_config.json"), type: "local" }
|
|
584
|
-
],
|
|
585
|
-
roo: [
|
|
586
|
-
{ filePath: import_node_path2.default.join(homeDir, "Library", "Application Support", "Code", "User", "globalStorage", "rooveterinaryinc.roo-cline", "settings", "cline_mcp_settings.json"), type: "global" },
|
|
587
|
-
{ filePath: import_node_path2.default.join(homeDir, "Library", "Application Support", "Code - Insiders", "User", "globalStorage", "rooveterinaryinc.roo-cline", "settings", "cline_mcp_settings.json"), type: "global" }
|
|
588
|
-
],
|
|
589
|
-
"intellij-github-copilot": [
|
|
590
|
-
{ filePath: import_node_path2.default.join(homeDir, ".config", "github-copilot", "intellij", "mcp.json"), type: "global" }
|
|
591
|
-
],
|
|
592
|
-
junie: [
|
|
593
|
-
{ filePath: import_node_path2.default.join(homeDir, ".junie", "mcp", "mcp.json"), type: "global" },
|
|
594
|
-
{ filePath: import_node_path2.default.join(".junie", "mcp", "mcp.json"), type: "local" }
|
|
595
|
-
],
|
|
596
|
-
zed: [
|
|
597
|
-
{ filePath: import_node_path2.default.join(homeDir, ".config", "zed", "settings.json"), type: "global" },
|
|
598
|
-
{ filePath: import_node_path2.default.join(".zed", "settings.json"), type: "local" }
|
|
599
|
-
],
|
|
600
|
-
gemini: [
|
|
601
|
-
{ filePath: import_node_path2.default.join(homeDir, ".gemini", "settings.json"), type: "global" },
|
|
602
|
-
{ filePath: import_node_path2.default.join(".gemini", "settings.json"), type: "local" }
|
|
603
|
-
]
|
|
604
|
-
};
|
|
605
|
-
}
|
|
606
|
-
__name(getDarwinPaths, "getDarwinPaths");
|
|
607
|
-
|
|
608
1238
|
// src/main.ts
|
|
609
|
-
var osSpecificPaths = {};
|
|
610
|
-
if ((0, import_node_os2.platform)() === "win32") {
|
|
611
|
-
osSpecificPaths = getWindowsPaths();
|
|
612
|
-
} else {
|
|
613
|
-
osSpecificPaths = getDarwinPaths();
|
|
614
|
-
}
|
|
615
1239
|
var MCPFiles = class {
|
|
616
1240
|
static {
|
|
617
1241
|
__name(this, "MCPFiles");
|
|
618
1242
|
}
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
friendlyName: "Claude Desktop",
|
|
623
|
-
paths: osSpecificPaths["claude"]
|
|
624
|
-
},
|
|
625
|
-
claude_code: {
|
|
626
|
-
name: "claude-code",
|
|
627
|
-
friendlyName: "Claude Code",
|
|
628
|
-
paths: osSpecificPaths["claude_code"]
|
|
629
|
-
},
|
|
630
|
-
cursor: {
|
|
631
|
-
name: "cursor",
|
|
632
|
-
friendlyName: "Cursor",
|
|
633
|
-
paths: osSpecificPaths["cursor"]
|
|
634
|
-
},
|
|
635
|
-
vscode: {
|
|
636
|
-
name: "vscode",
|
|
637
|
-
friendlyName: "VS Code",
|
|
638
|
-
paths: osSpecificPaths["vscode"]
|
|
639
|
-
},
|
|
640
|
-
cline: {
|
|
641
|
-
name: "cline",
|
|
642
|
-
friendlyName: "Cline",
|
|
643
|
-
paths: osSpecificPaths["cline"]
|
|
644
|
-
},
|
|
645
|
-
windsurf: {
|
|
646
|
-
name: "windsurf",
|
|
647
|
-
friendlyName: "Windsurf",
|
|
648
|
-
paths: osSpecificPaths["windsurf"]
|
|
649
|
-
},
|
|
650
|
-
roo: {
|
|
651
|
-
name: "roo",
|
|
652
|
-
friendlyName: "Roo",
|
|
653
|
-
paths: osSpecificPaths["roo"]
|
|
654
|
-
},
|
|
655
|
-
"intellij-github-copilot": {
|
|
656
|
-
name: "intellij-github-copilot",
|
|
657
|
-
friendlyName: "IntelliJ GitHub Copilot",
|
|
658
|
-
paths: osSpecificPaths["intellij-github-copilot"]
|
|
659
|
-
},
|
|
660
|
-
junie: {
|
|
661
|
-
name: "junie",
|
|
662
|
-
friendlyName: "IntelliJ Junie",
|
|
663
|
-
paths: osSpecificPaths["junie"]
|
|
664
|
-
},
|
|
665
|
-
zed: {
|
|
666
|
-
name: "zed",
|
|
667
|
-
friendlyName: "Zed",
|
|
668
|
-
paths: osSpecificPaths["zed"]
|
|
669
|
-
},
|
|
670
|
-
gemini: {
|
|
671
|
-
name: "gemini-cli",
|
|
672
|
-
friendlyName: "Gemini CLI",
|
|
673
|
-
paths: osSpecificPaths.gemini
|
|
674
|
-
}
|
|
675
|
-
};
|
|
676
|
-
constructor(mcpFilePathGroups) {
|
|
677
|
-
this.mcpFilePathGroups = mcpFilePathGroups || this.mcpFilePathGroups;
|
|
1243
|
+
mcpConfigService;
|
|
1244
|
+
constructor() {
|
|
1245
|
+
this.mcpConfigService = new MCPConfigService({ enableDirectoryBubbling: true });
|
|
678
1246
|
}
|
|
1247
|
+
/**
|
|
1248
|
+
* Find and process all MCP configuration files
|
|
1249
|
+
*/
|
|
679
1250
|
async findFiles() {
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
const
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
const mcpServersFromConfig = await MCPConfigLinter.getMCPServers();
|
|
704
|
-
for (const serverName of Object.keys(mcpServersFromConfig)) {
|
|
705
|
-
const serverConfigRaw = mcpServersFromConfig[serverName];
|
|
706
|
-
const serverConfig = {
|
|
707
|
-
name: serverName,
|
|
708
|
-
command: serverConfigRaw.command || "",
|
|
709
|
-
args: serverConfigRaw.args,
|
|
710
|
-
url: serverConfigRaw.url,
|
|
711
|
-
transport: serverConfigRaw.transport,
|
|
712
|
-
type: serverConfigRaw.type,
|
|
713
|
-
env: serverConfigRaw.env
|
|
714
|
-
};
|
|
715
|
-
const MCPServerManager = new MCPServerManagerService(serverConfig);
|
|
716
|
-
const mcpServerProcessDetection = MCPServerManager.isRunning();
|
|
717
|
-
let mcpServerProcess = false;
|
|
718
|
-
if (mcpServerProcessDetection) {
|
|
719
|
-
if (typeof mcpServerProcessDetection === "object" && mcpServerProcessDetection.estimatedProduct === clientsGroup.name) {
|
|
720
|
-
mcpServerProcess = true;
|
|
1251
|
+
try {
|
|
1252
|
+
const mcpFilesPathsData = await this.mcpConfigService.getMCPFileGroups();
|
|
1253
|
+
for (const groupName of Object.keys(mcpFilesPathsData)) {
|
|
1254
|
+
const group = mcpFilesPathsData[groupName];
|
|
1255
|
+
for (const filePathData of group.paths) {
|
|
1256
|
+
if (filePathData.servers && filePathData.servers.length > 0) {
|
|
1257
|
+
for (const server of filePathData.servers) {
|
|
1258
|
+
const serverConfig = {
|
|
1259
|
+
name: server.name,
|
|
1260
|
+
command: server.command,
|
|
1261
|
+
args: server.args,
|
|
1262
|
+
transport: server.transport,
|
|
1263
|
+
// transport is always populated from type in the data layer
|
|
1264
|
+
type: server.type,
|
|
1265
|
+
env: server.env
|
|
1266
|
+
};
|
|
1267
|
+
const serverManager = new MCPServerManagerService(serverConfig);
|
|
1268
|
+
const processDetection = serverManager.isRunning();
|
|
1269
|
+
let isRunning = false;
|
|
1270
|
+
if (processDetection) {
|
|
1271
|
+
if (typeof processDetection === "object" && processDetection.estimatedProduct === group.name) {
|
|
1272
|
+
isRunning = true;
|
|
1273
|
+
}
|
|
721
1274
|
}
|
|
1275
|
+
server.status = isRunning ? "running" : "stopped";
|
|
722
1276
|
}
|
|
723
|
-
mcpServersData.push({
|
|
724
|
-
name: MCPServerManager.getName(),
|
|
725
|
-
command: MCPServerManager.getCmd(),
|
|
726
|
-
args: MCPServerManager.getArgs(),
|
|
727
|
-
source: MCPServerManager.getSource(),
|
|
728
|
-
transport: MCPServerManager.getTransport(),
|
|
729
|
-
env: MCPServerManager.getEnv(),
|
|
730
|
-
status: mcpServerProcess ? "running" : "stopped"
|
|
731
|
-
});
|
|
732
1277
|
}
|
|
733
|
-
filePathData.servers = mcpServersData;
|
|
734
|
-
mcpFilesPathsData[groupName]["stats"]["serversCount"] = await MCPConfigLinter.countMCPServers();
|
|
735
|
-
mcpFilesPathsData[groupName].paths.push(filePathData);
|
|
736
|
-
} catch (error) {
|
|
737
1278
|
}
|
|
738
1279
|
}
|
|
1280
|
+
return mcpFilesPathsData;
|
|
1281
|
+
} catch (error) {
|
|
1282
|
+
throw new Error(`Failed to find MCP files: ${error instanceof Error ? error.message : "Unknown error"}`);
|
|
739
1283
|
}
|
|
740
|
-
|
|
1284
|
+
}
|
|
1285
|
+
/**
|
|
1286
|
+
* Get MCP configuration service instance for advanced operations
|
|
1287
|
+
*/
|
|
1288
|
+
getMCPConfigService() {
|
|
1289
|
+
return this.mcpConfigService;
|
|
741
1290
|
}
|
|
742
1291
|
};
|
|
743
1292
|
|
|
744
1293
|
// src/services/render-service.ts
|
|
745
|
-
var
|
|
1294
|
+
var import_node_util11 = require("util");
|
|
746
1295
|
|
|
747
1296
|
// src/components/transport.ts
|
|
748
|
-
var
|
|
1297
|
+
var import_node_util2 = require("util");
|
|
749
1298
|
function render(text) {
|
|
750
1299
|
const formattedText = text.toUpperCase();
|
|
751
1300
|
let data = "";
|
|
752
1301
|
if (formattedText === "STDIO") {
|
|
753
|
-
data = (0,
|
|
1302
|
+
data = (0, import_node_util2.styleText)(["magenta"], formattedText);
|
|
754
1303
|
}
|
|
755
1304
|
if (formattedText === "SSE") {
|
|
756
|
-
data = (0,
|
|
1305
|
+
data = (0, import_node_util2.styleText)(["blue"], formattedText);
|
|
757
1306
|
}
|
|
758
1307
|
if (formattedText === "HTTP") {
|
|
759
|
-
data = (0,
|
|
1308
|
+
data = (0, import_node_util2.styleText)(["blue"], formattedText);
|
|
760
1309
|
}
|
|
761
1310
|
return data;
|
|
762
1311
|
}
|
|
763
1312
|
__name(render, "render");
|
|
764
1313
|
|
|
765
1314
|
// src/components/column-name.ts
|
|
766
|
-
var
|
|
1315
|
+
var import_node_util3 = require("util");
|
|
767
1316
|
function render2(text) {
|
|
768
1317
|
const formattedText = String(text).toUpperCase();
|
|
769
|
-
const data = (0,
|
|
1318
|
+
const data = (0, import_node_util3.styleText)(["dim"], formattedText);
|
|
770
1319
|
return data;
|
|
771
1320
|
}
|
|
772
1321
|
__name(render2, "render");
|
|
773
1322
|
|
|
774
1323
|
// src/components/mcp-server-status.ts
|
|
775
|
-
var
|
|
1324
|
+
var import_node_util4 = require("util");
|
|
776
1325
|
function render3(text) {
|
|
777
1326
|
const formattedText = text.toLowerCase();
|
|
778
1327
|
let data = "";
|
|
779
1328
|
if (formattedText === "running") {
|
|
780
|
-
data = (0,
|
|
1329
|
+
data = (0, import_node_util4.styleText)(["green"], "\u25CF");
|
|
781
1330
|
} else {
|
|
782
|
-
data = (0,
|
|
1331
|
+
data = (0, import_node_util4.styleText)(["red"], "\u25CF");
|
|
783
1332
|
}
|
|
784
1333
|
return data;
|
|
785
1334
|
}
|
|
786
1335
|
__name(render3, "render");
|
|
787
1336
|
|
|
788
1337
|
// src/components/mcp-server-name.ts
|
|
789
|
-
var
|
|
1338
|
+
var import_node_util5 = require("util");
|
|
790
1339
|
function render4(text) {
|
|
791
1340
|
const formattedText = text.toLowerCase();
|
|
792
|
-
const data = (0,
|
|
1341
|
+
const data = (0, import_node_util5.styleText)(["bold", "white"], formattedText);
|
|
793
1342
|
return data;
|
|
794
1343
|
}
|
|
795
1344
|
__name(render4, "render");
|
|
796
1345
|
|
|
797
1346
|
// src/components/mcp-server-source.ts
|
|
798
|
-
var
|
|
1347
|
+
var import_node_util6 = require("util");
|
|
799
1348
|
function render5(text) {
|
|
800
1349
|
const formattedText = String(text).trim();
|
|
801
|
-
return (0,
|
|
1350
|
+
return (0, import_node_util6.styleText)(["gray"], formattedText);
|
|
802
1351
|
}
|
|
803
1352
|
__name(render5, "render");
|
|
804
1353
|
|
|
805
1354
|
// src/components/file-path.ts
|
|
806
|
-
var
|
|
1355
|
+
var import_node_util7 = require("util");
|
|
807
1356
|
function render6(text) {
|
|
808
1357
|
const formattedText = text;
|
|
809
|
-
const data = (0,
|
|
1358
|
+
const data = (0, import_node_util7.styleText)(["underline"], formattedText);
|
|
810
1359
|
return data;
|
|
811
1360
|
}
|
|
812
1361
|
__name(render6, "render");
|
|
813
1362
|
|
|
814
1363
|
// src/components/mcp-servers-config-parsable.ts
|
|
815
|
-
var
|
|
1364
|
+
var import_node_util8 = require("util");
|
|
816
1365
|
function render7(text) {
|
|
817
1366
|
const formattedText = text.toUpperCase().replace(/_/g, " ");
|
|
818
1367
|
let data = formattedText;
|
|
819
1368
|
if (formattedText === "VALID") {
|
|
820
|
-
data = (0,
|
|
1369
|
+
data = (0, import_node_util8.styleText)(["green"], "\u25CF");
|
|
821
1370
|
} else {
|
|
822
|
-
data = (0,
|
|
1371
|
+
data = (0, import_node_util8.styleText)(["red"], "\u25CF");
|
|
823
1372
|
}
|
|
824
1373
|
return data;
|
|
825
1374
|
}
|
|
826
1375
|
__name(render7, "render");
|
|
827
1376
|
|
|
1377
|
+
// src/components/credential-warning.ts
|
|
1378
|
+
var import_node_util9 = require("util");
|
|
1379
|
+
function CredentialWarningComponent(credentials) {
|
|
1380
|
+
if (!credentials || !credentials.hasCredentials) {
|
|
1381
|
+
return "";
|
|
1382
|
+
}
|
|
1383
|
+
const { riskLevel, credentialVars } = credentials;
|
|
1384
|
+
let riskColor;
|
|
1385
|
+
let riskIcon;
|
|
1386
|
+
switch (riskLevel) {
|
|
1387
|
+
case "high":
|
|
1388
|
+
riskColor = "red";
|
|
1389
|
+
riskIcon = (0, import_node_util9.styleText)(["red"], "\u25CF");
|
|
1390
|
+
break;
|
|
1391
|
+
case "low":
|
|
1392
|
+
riskColor = "blue";
|
|
1393
|
+
riskIcon = (0, import_node_util9.styleText)(["blue"], "\u25CF");
|
|
1394
|
+
break;
|
|
1395
|
+
default:
|
|
1396
|
+
riskColor = "blue";
|
|
1397
|
+
riskIcon = (0, import_node_util9.styleText)(["blue"], "\u25CF");
|
|
1398
|
+
}
|
|
1399
|
+
const riskText = (0, import_node_util9.styleText)([riskColor], `${riskIcon} ${riskLevel.toUpperCase()} RISK`);
|
|
1400
|
+
const credentialSummary = credentialVars.map((cv) => `${cv.name}=${cv.value}`).join(", ");
|
|
1401
|
+
return `${riskText} ${(0, import_node_util9.styleText)(["dim"], `(${credentialVars.length} cred vars: ${credentialSummary})`)}`;
|
|
1402
|
+
}
|
|
1403
|
+
__name(CredentialWarningComponent, "CredentialWarningComponent");
|
|
1404
|
+
|
|
1405
|
+
// src/components/summary.ts
|
|
1406
|
+
var import_node_util10 = require("util");
|
|
1407
|
+
function SummaryComponent(stats) {
|
|
1408
|
+
const { totalServers, runningServers, highRiskCredentials, transportBreakdown } = stats;
|
|
1409
|
+
const runningBar = createProgressBar(runningServers, totalServers, 20, "green");
|
|
1410
|
+
const securityBar = createProgressBar(highRiskCredentials, totalServers, 20, "red");
|
|
1411
|
+
const transportText = `stdio: ${transportBreakdown.stdio} | SSE: ${transportBreakdown.sse} | HTTP: ${transportBreakdown.http}`;
|
|
1412
|
+
const lines = [
|
|
1413
|
+
"SUMMARY",
|
|
1414
|
+
` SERVERS ${runningBar} ${runningServers} / ${totalServers} Running`,
|
|
1415
|
+
` SECURITY ${securityBar} ${highRiskCredentials} / ${totalServers} High Risk Credentials`,
|
|
1416
|
+
` TRANSPORT ${transportText}`
|
|
1417
|
+
];
|
|
1418
|
+
return lines.join("\n");
|
|
1419
|
+
}
|
|
1420
|
+
__name(SummaryComponent, "SummaryComponent");
|
|
1421
|
+
function createProgressBar(count, total, width, color) {
|
|
1422
|
+
if (total === 0) {
|
|
1423
|
+
const emptyBar = "\u2591".repeat(width);
|
|
1424
|
+
return emptyBar;
|
|
1425
|
+
}
|
|
1426
|
+
const progress = Math.min(count / total, 1);
|
|
1427
|
+
const filledWidth = Math.round(progress * width);
|
|
1428
|
+
const emptyWidth = width - filledWidth;
|
|
1429
|
+
let filled;
|
|
1430
|
+
let empty;
|
|
1431
|
+
if (color === "green") {
|
|
1432
|
+
filled = (0, import_node_util10.styleText)(["greenBright"], "\u2588".repeat(filledWidth));
|
|
1433
|
+
empty = (0, import_node_util10.styleText)(["green"], "\u2591".repeat(emptyWidth));
|
|
1434
|
+
} else {
|
|
1435
|
+
filled = (0, import_node_util10.styleText)(["redBright"], "\u2588".repeat(filledWidth));
|
|
1436
|
+
empty = (0, import_node_util10.styleText)(["red"], "\u2591".repeat(emptyWidth));
|
|
1437
|
+
}
|
|
1438
|
+
return `${filled}${empty}`;
|
|
1439
|
+
}
|
|
1440
|
+
__name(createProgressBar, "createProgressBar");
|
|
1441
|
+
|
|
828
1442
|
// src/services/render-service.ts
|
|
829
1443
|
var RenderService = class _RenderService {
|
|
830
1444
|
static {
|
|
@@ -841,8 +1455,8 @@ var RenderService = class _RenderService {
|
|
|
841
1455
|
}
|
|
842
1456
|
static printMcpServers(data) {
|
|
843
1457
|
if (data.length === 0) return;
|
|
844
|
-
const headers = ["STATUS", "NAME", "SOURCE", "TRANSPORT"];
|
|
845
|
-
const keys = ["status", "name", "source", "transport"];
|
|
1458
|
+
const headers = ["STATUS", "NAME", "SOURCE", "TRANSPORT", "CREDENTIALS"];
|
|
1459
|
+
const keys = ["status", "name", "source", "transport", "credentials"];
|
|
846
1460
|
const centerColumns = [0, 2, 3];
|
|
847
1461
|
const leftPadding = " ";
|
|
848
1462
|
const columnWidths = headers.map((header, index) => {
|
|
@@ -861,6 +1475,9 @@ var RenderService = class _RenderService {
|
|
|
861
1475
|
if (keys[index] === "name") {
|
|
862
1476
|
text = render4(text);
|
|
863
1477
|
}
|
|
1478
|
+
if (keys[index] === "credentials") {
|
|
1479
|
+
text = CredentialWarningComponent(row[keys[index]]);
|
|
1480
|
+
}
|
|
864
1481
|
return _RenderService.getVisibleLength(text);
|
|
865
1482
|
}));
|
|
866
1483
|
return Math.max(headerWidth, dataWidth);
|
|
@@ -904,6 +1521,9 @@ var RenderService = class _RenderService {
|
|
|
904
1521
|
if (key === "name") {
|
|
905
1522
|
text = render4(text);
|
|
906
1523
|
}
|
|
1524
|
+
if (key === "credentials") {
|
|
1525
|
+
text = CredentialWarningComponent(row[key]);
|
|
1526
|
+
}
|
|
907
1527
|
if (centerColumns.includes(index)) {
|
|
908
1528
|
return centerText(text, columnWidths[index]);
|
|
909
1529
|
}
|
|
@@ -973,14 +1593,33 @@ var RenderService = class _RenderService {
|
|
|
973
1593
|
let filled;
|
|
974
1594
|
let empty;
|
|
975
1595
|
if (count > 0) {
|
|
976
|
-
filled = (0,
|
|
977
|
-
empty = (0,
|
|
1596
|
+
filled = (0, import_node_util11.styleText)(["greenBright"], "\u2588".repeat(filledWidth));
|
|
1597
|
+
empty = (0, import_node_util11.styleText)(["green"], "\u2591".repeat(emptyWidth));
|
|
978
1598
|
} else {
|
|
979
1599
|
filled = "\u2588".repeat(filledWidth);
|
|
980
1600
|
empty = "\u2591".repeat(emptyWidth);
|
|
981
1601
|
}
|
|
982
1602
|
return `${filled}${empty} ${count} / ${total} ${label}`;
|
|
983
1603
|
}
|
|
1604
|
+
/**
|
|
1605
|
+
* Print summary statistics at the end of the output
|
|
1606
|
+
*/
|
|
1607
|
+
static printSummary(stats) {
|
|
1608
|
+
console.log("\n");
|
|
1609
|
+
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");
|
|
1610
|
+
console.log();
|
|
1611
|
+
const summaryOutput = SummaryComponent(stats);
|
|
1612
|
+
const lines = summaryOutput.split("\n");
|
|
1613
|
+
for (const line of lines) {
|
|
1614
|
+
if (line === "SUMMARY") {
|
|
1615
|
+
console.log(" " + line);
|
|
1616
|
+
} else {
|
|
1617
|
+
console.log(" " + line);
|
|
1618
|
+
}
|
|
1619
|
+
}
|
|
1620
|
+
console.log();
|
|
1621
|
+
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");
|
|
1622
|
+
}
|
|
984
1623
|
};
|
|
985
1624
|
|
|
986
1625
|
// src/bin/cli.ts
|
|
@@ -993,6 +1632,10 @@ async function init() {
|
|
|
993
1632
|
exitWithError("No configuration for MCP Server applications found.");
|
|
994
1633
|
}
|
|
995
1634
|
let pathIndex = 0;
|
|
1635
|
+
let totalServers = 0;
|
|
1636
|
+
let totalRunning = 0;
|
|
1637
|
+
let totalHighRiskCredentials = 0;
|
|
1638
|
+
const transportCounts = { stdio: 0, sse: 0, http: 0 };
|
|
996
1639
|
for (const groupName of Object.keys(mcpFilesList)) {
|
|
997
1640
|
const group = mcpFilesList[groupName];
|
|
998
1641
|
if (group.paths.length > 0) {
|
|
@@ -1004,6 +1647,19 @@ async function init() {
|
|
|
1004
1647
|
const mcpServers = filePathData.servers || [];
|
|
1005
1648
|
const totalMCPServers = filePathData.servers ? filePathData.servers.length : 0;
|
|
1006
1649
|
const totalMCPServersRunning = mcpServers.filter((server) => server.status === "running").length;
|
|
1650
|
+
totalServers += totalMCPServers;
|
|
1651
|
+
totalRunning += totalMCPServersRunning;
|
|
1652
|
+
for (const server of mcpServers) {
|
|
1653
|
+
if (server.transport) {
|
|
1654
|
+
const transport = server.transport.toLowerCase();
|
|
1655
|
+
if (transport in transportCounts) {
|
|
1656
|
+
transportCounts[transport]++;
|
|
1657
|
+
}
|
|
1658
|
+
}
|
|
1659
|
+
if (server.credentials?.hasCredentials && server.credentials?.riskLevel === "high") {
|
|
1660
|
+
totalHighRiskCredentials++;
|
|
1661
|
+
}
|
|
1662
|
+
}
|
|
1007
1663
|
const mcpGroupData = [
|
|
1008
1664
|
{ key: "PROVIDER", value: group.friendlyName },
|
|
1009
1665
|
{ key: "FILE", value: filePath },
|
|
@@ -1022,13 +1678,20 @@ async function init() {
|
|
|
1022
1678
|
if (pathIndex === 0) {
|
|
1023
1679
|
exitWithError("No MCP servers found in known configuration files.");
|
|
1024
1680
|
}
|
|
1681
|
+
const summaryStats = {
|
|
1682
|
+
totalServers,
|
|
1683
|
+
runningServers: totalRunning,
|
|
1684
|
+
highRiskCredentials: totalHighRiskCredentials,
|
|
1685
|
+
transportBreakdown: transportCounts
|
|
1686
|
+
};
|
|
1687
|
+
RenderService.printSummary(summaryStats);
|
|
1025
1688
|
}
|
|
1026
1689
|
__name(init, "init");
|
|
1027
1690
|
init().then(() => {
|
|
1028
1691
|
console.log("\n");
|
|
1029
1692
|
});
|
|
1030
1693
|
function exitWithError(message) {
|
|
1031
|
-
console.error(`${(0,
|
|
1694
|
+
console.error(`${(0, import_node_util12.styleText)(["red"], "\u25CF")} ${message}
|
|
1032
1695
|
`);
|
|
1033
1696
|
process.exit(1);
|
|
1034
1697
|
}
|