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.mjs
CHANGED
|
@@ -3,19 +3,175 @@ var __defProp = Object.defineProperty;
|
|
|
3
3
|
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
4
4
|
|
|
5
5
|
// src/bin/cli.ts
|
|
6
|
-
import { styleText as
|
|
6
|
+
import { styleText as styleText11 } from "util";
|
|
7
7
|
|
|
8
|
-
// src/
|
|
9
|
-
import
|
|
10
|
-
import { platform as platform2 } from "os";
|
|
8
|
+
// src/services/mcp-config-service.ts
|
|
9
|
+
import { platform } from "os";
|
|
11
10
|
import path2 from "path";
|
|
11
|
+
import fs2 from "fs/promises";
|
|
12
|
+
import util from "util";
|
|
13
|
+
|
|
14
|
+
// src/services/mcp-path-registry.ts
|
|
15
|
+
import path from "path";
|
|
16
|
+
var MCPPathRegistry = class _MCPPathRegistry {
|
|
17
|
+
static {
|
|
18
|
+
__name(this, "MCPPathRegistry");
|
|
19
|
+
}
|
|
20
|
+
static WINDOWS_PATHS = {
|
|
21
|
+
claude: [
|
|
22
|
+
{ filePath: path.join(process.env.APPDATA || "", "Claude", "claude_desktop_config.json"), type: "global" }
|
|
23
|
+
],
|
|
24
|
+
claude_code: [
|
|
25
|
+
{ filePath: ".mcp.json", type: "local" }
|
|
26
|
+
],
|
|
27
|
+
cursor: [
|
|
28
|
+
{ filePath: path.join(process.env.HOME || "", ".cursor", "mcp.json"), type: "global" },
|
|
29
|
+
{ filePath: path.join(".cursor", "mcp.json"), type: "local" }
|
|
30
|
+
],
|
|
31
|
+
vscode: [
|
|
32
|
+
{ filePath: path.join(".vscode", "mcp.json"), type: "local" },
|
|
33
|
+
{ filePath: path.join(process.env.APPDATA || "", "Code", "User", "settings.json"), type: "global" },
|
|
34
|
+
{ filePath: path.join(process.env.APPDATA || "", "Code - Insiders", "User", "settings.json"), type: "global" },
|
|
35
|
+
{ filePath: path.join(process.env.APPDATA || "", "Code", "User", "mcp.json"), type: "global" },
|
|
36
|
+
{ filePath: path.join(process.env.APPDATA || "", "Code - Insiders", "User", "mcp.json"), type: "global" }
|
|
37
|
+
],
|
|
38
|
+
cline: [
|
|
39
|
+
{ filePath: path.join(process.env.APPDATA || "", "Code", "User", "globalStorage", "saoudrizwan.claude-dev", "settings", "cline_mcp_settings.json"), type: "global" },
|
|
40
|
+
{ filePath: path.join(process.env.APPDATA || "", "Code - Insiders", "User", "globalStorage", "saoudrizwan.claude-dev", "settings", "cline_mcp_settings.json"), type: "global" }
|
|
41
|
+
],
|
|
42
|
+
windsurf: [
|
|
43
|
+
{ filePath: path.join(".codeium", "windsurf", "mcp_config.json"), type: "local" }
|
|
44
|
+
],
|
|
45
|
+
roo: [
|
|
46
|
+
{ filePath: path.join(process.env.APPDATA || "", "Code", "User", "globalStorage", "rooveterinaryinc.roo-cline", "settings", "cline_mcp_settings.json"), type: "global" },
|
|
47
|
+
{ filePath: path.join(process.env.APPDATA || "", "Code - Insiders", "User", "globalStorage", "rooveterinaryinc.roo-cline", "settings", "cline_mcp_settings.json"), type: "global" }
|
|
48
|
+
],
|
|
49
|
+
"intellij-github-copilot": [
|
|
50
|
+
{ filePath: path.join(process.env.LOCALAPPDATA || "", "github-copilot", "intellij", "mcp.json"), type: "global" }
|
|
51
|
+
],
|
|
52
|
+
junie: [
|
|
53
|
+
{ filePath: path.join(process.env.HOME || "", ".junie", "mcp", "mcp.json"), type: "global" }
|
|
54
|
+
],
|
|
55
|
+
zed: [
|
|
56
|
+
{ filePath: path.join(process.env.LOCALAPPDATA || "", "zed", "settings.json"), type: "global" },
|
|
57
|
+
{ filePath: path.join(".zed", "settings.json"), type: "local" }
|
|
58
|
+
],
|
|
59
|
+
gemini: [
|
|
60
|
+
{ filePath: path.join(process.env.HOME || "", ".gemini", "settings.json"), type: "global" },
|
|
61
|
+
{ filePath: path.join(".gemini", "settings.json"), type: "local" }
|
|
62
|
+
]
|
|
63
|
+
};
|
|
64
|
+
static DARWIN_PATHS = {
|
|
65
|
+
claude: [
|
|
66
|
+
{ filePath: path.join(process.env.HOME || "", "Library", "Application Support", "Claude", "claude_desktop_config.json"), type: "global" }
|
|
67
|
+
],
|
|
68
|
+
claude_code: [
|
|
69
|
+
{ filePath: ".mcp.json", type: "local" }
|
|
70
|
+
],
|
|
71
|
+
cursor: [
|
|
72
|
+
{ filePath: path.join(process.env.HOME || "", ".cursor", "mcp.json"), type: "global" },
|
|
73
|
+
{ filePath: path.join(".cursor", "mcp.json"), type: "local" }
|
|
74
|
+
],
|
|
75
|
+
vscode: [
|
|
76
|
+
{ filePath: path.join(".vscode", "mcp.json"), type: "local" },
|
|
77
|
+
{ filePath: path.join(process.env.HOME || "", "Library", "Application Support", "Code", "User", "settings.json"), type: "global" },
|
|
78
|
+
{ filePath: path.join(process.env.HOME || "", "Library", "Application Support", "Code", "User", "mcp.json"), type: "global" },
|
|
79
|
+
{ filePath: path.join(process.env.HOME || "", "Library", "Application Support", "Code - Insiders", "User", "settings.json"), type: "global" },
|
|
80
|
+
{ filePath: path.join(process.env.HOME || "", "Library", "Application Support", "Code - Insiders", "User", "mcp.json"), type: "global" }
|
|
81
|
+
],
|
|
82
|
+
cline: [
|
|
83
|
+
{ filePath: path.join(process.env.HOME || "", "Library", "Application Support", "Code", "User", "globalStorage", "saoudrizwan.claude-dev", "settings", "cline_mcp_settings.json"), type: "global" },
|
|
84
|
+
{ filePath: path.join(process.env.HOME || "", "Library", "Application Support", "Code - Insiders", "User", "globalStorage", "saoudrizwan.claude-dev", "settings", "cline_mcp_settings.json"), type: "global" }
|
|
85
|
+
],
|
|
86
|
+
windsurf: [
|
|
87
|
+
{ filePath: path.join(".codeium", "windsurf", "mcp_config.json"), type: "local" }
|
|
88
|
+
],
|
|
89
|
+
roo: [
|
|
90
|
+
{ filePath: path.join(process.env.HOME || "", "Library", "Application Support", "Code", "User", "globalStorage", "rooveterinaryinc.roo-cline", "settings", "cline_mcp_settings.json"), type: "global" },
|
|
91
|
+
{ filePath: path.join(process.env.HOME || "", "Library", "Application Support", "Code - Insiders", "User", "globalStorage", "rooveterinaryinc.roo-cline", "settings", "cline_mcp_settings.json"), type: "global" }
|
|
92
|
+
],
|
|
93
|
+
"intellij-github-copilot": [
|
|
94
|
+
{ filePath: path.join(process.env.HOME || "", ".config", "github-copilot", "intellij", "mcp.json"), type: "global" }
|
|
95
|
+
],
|
|
96
|
+
junie: [
|
|
97
|
+
{ filePath: path.join(process.env.HOME || "", ".junie", "mcp", "mcp.json"), type: "global" },
|
|
98
|
+
{ filePath: path.join(".junie", "mcp", "mcp.json"), type: "local" }
|
|
99
|
+
],
|
|
100
|
+
zed: [
|
|
101
|
+
{ filePath: path.join(process.env.HOME || "", ".config", "zed", "settings.json"), type: "global" },
|
|
102
|
+
{ filePath: path.join(".zed", "settings.json"), type: "local" }
|
|
103
|
+
],
|
|
104
|
+
gemini: [
|
|
105
|
+
{ filePath: path.join(process.env.HOME || "", ".gemini", "settings.json"), type: "global" },
|
|
106
|
+
{ filePath: path.join(".gemini", "settings.json"), type: "local" }
|
|
107
|
+
]
|
|
108
|
+
};
|
|
109
|
+
customApps = /* @__PURE__ */ new Map();
|
|
110
|
+
/**
|
|
111
|
+
* Get all MCP configuration file paths for a specific operating system
|
|
112
|
+
*/
|
|
113
|
+
getPathsForOS(os) {
|
|
114
|
+
switch (os.toLowerCase()) {
|
|
115
|
+
case "win32":
|
|
116
|
+
case "windows":
|
|
117
|
+
return { ..._MCPPathRegistry.WINDOWS_PATHS };
|
|
118
|
+
case "darwin":
|
|
119
|
+
case "macos":
|
|
120
|
+
return { ..._MCPPathRegistry.DARWIN_PATHS };
|
|
121
|
+
default:
|
|
122
|
+
throw new Error(`Unsupported operating system: ${os}`);
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Get MCP configuration file paths for a specific app on a specific OS
|
|
127
|
+
*/
|
|
128
|
+
getPathsForApp(os, appName) {
|
|
129
|
+
const osPaths = this.getPathsForOS(os);
|
|
130
|
+
const appPaths = osPaths[appName];
|
|
131
|
+
if (!appPaths) {
|
|
132
|
+
throw new Error(`App '${appName}' not found for OS '${os}'`);
|
|
133
|
+
}
|
|
134
|
+
return [...appPaths];
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* Get all supported app names for a specific OS
|
|
138
|
+
*/
|
|
139
|
+
getSupportedApps(os) {
|
|
140
|
+
const osPaths = this.getPathsForOS(os);
|
|
141
|
+
return Object.keys(osPaths);
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* Get all supported operating systems
|
|
145
|
+
*/
|
|
146
|
+
getSupportedOperatingSystems() {
|
|
147
|
+
return ["win32", "darwin"];
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* Register a custom app with custom paths for a specific OS
|
|
151
|
+
*/
|
|
152
|
+
registerCustomApp(os, appName, paths) {
|
|
153
|
+
if (!this.customApps.has(os)) {
|
|
154
|
+
this.customApps.set(os, {});
|
|
155
|
+
}
|
|
156
|
+
const osCustomApps = this.customApps.get(os);
|
|
157
|
+
osCustomApps[appName] = [...paths];
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* Get paths including custom registered apps
|
|
161
|
+
*/
|
|
162
|
+
getPathsForOSWithCustom(os) {
|
|
163
|
+
const basePaths = this.getPathsForOS(os);
|
|
164
|
+
const customPaths = this.customApps.get(os) || {};
|
|
165
|
+
return { ...basePaths, ...customPaths };
|
|
166
|
+
}
|
|
167
|
+
};
|
|
12
168
|
|
|
13
|
-
// src/services/mcp-config-
|
|
169
|
+
// src/services/mcp-config-parser.ts
|
|
14
170
|
import fs from "fs/promises";
|
|
15
171
|
import { parse } from "jsonc-parser";
|
|
16
|
-
var
|
|
172
|
+
var MCPConfigParser = class {
|
|
17
173
|
static {
|
|
18
|
-
__name(this, "
|
|
174
|
+
__name(this, "MCPConfigParser");
|
|
19
175
|
}
|
|
20
176
|
filePath;
|
|
21
177
|
fileContents = null;
|
|
@@ -25,9 +181,17 @@ var MCPConfigLinterService = class {
|
|
|
25
181
|
constructor(filePath) {
|
|
26
182
|
this.filePath = filePath;
|
|
27
183
|
}
|
|
28
|
-
|
|
184
|
+
/**
|
|
185
|
+
* Parse the configuration file and return structured data
|
|
186
|
+
*/
|
|
187
|
+
async parseConfigFile() {
|
|
29
188
|
if (this.parsed) {
|
|
30
|
-
return
|
|
189
|
+
return {
|
|
190
|
+
raw: this.fileContentsData,
|
|
191
|
+
parsed: this.parsed,
|
|
192
|
+
valid: this.valid,
|
|
193
|
+
servers: await this.extractMCPServers(this.fileContentsData)
|
|
194
|
+
};
|
|
31
195
|
}
|
|
32
196
|
this.parsed = true;
|
|
33
197
|
const fileContent = await this.getFileContent();
|
|
@@ -35,63 +199,519 @@ var MCPConfigLinterService = class {
|
|
|
35
199
|
this.fileContentsData = JSON.parse(fileContent);
|
|
36
200
|
if (typeof this.fileContentsData === "object") {
|
|
37
201
|
this.valid = true;
|
|
38
|
-
return;
|
|
39
202
|
}
|
|
40
203
|
} catch (e) {
|
|
41
204
|
}
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
this.
|
|
205
|
+
if (!this.valid) {
|
|
206
|
+
try {
|
|
207
|
+
this.fileContentsData = parse(fileContent);
|
|
208
|
+
if (typeof this.fileContentsData === "object") {
|
|
209
|
+
this.valid = true;
|
|
210
|
+
}
|
|
211
|
+
} catch (error) {
|
|
46
212
|
}
|
|
47
|
-
} catch (error) {
|
|
48
213
|
}
|
|
214
|
+
if (!this.valid) {
|
|
215
|
+
throw new Error(`Failed to parse configuration file: ${this.filePath}`);
|
|
216
|
+
}
|
|
217
|
+
return {
|
|
218
|
+
raw: this.fileContentsData,
|
|
219
|
+
parsed: this.parsed,
|
|
220
|
+
valid: this.valid,
|
|
221
|
+
servers: await this.extractMCPServers(this.fileContentsData)
|
|
222
|
+
};
|
|
223
|
+
}
|
|
224
|
+
/**
|
|
225
|
+
* Extract MCP servers from parsed configuration data
|
|
226
|
+
*/
|
|
227
|
+
async extractMCPServers(configData) {
|
|
228
|
+
if (!configData || typeof configData !== "object") {
|
|
229
|
+
return {};
|
|
230
|
+
}
|
|
231
|
+
if (configData.servers && typeof configData.servers === "object") {
|
|
232
|
+
return this.normalizeServerConfigs(configData.servers);
|
|
233
|
+
}
|
|
234
|
+
if (configData.mcp?.servers && typeof configData.mcp.servers === "object") {
|
|
235
|
+
return this.normalizeServerConfigs(configData.mcp.servers);
|
|
236
|
+
}
|
|
237
|
+
if (configData.mcpServers && typeof configData.mcpServers === "object") {
|
|
238
|
+
return this.normalizeServerConfigs(configData.mcpServers);
|
|
239
|
+
}
|
|
240
|
+
if (configData.context_servers && typeof configData.context_servers === "object") {
|
|
241
|
+
return this.normalizeServerConfigs(configData.context_servers);
|
|
242
|
+
}
|
|
243
|
+
return {};
|
|
244
|
+
}
|
|
245
|
+
/**
|
|
246
|
+
* Normalize server configurations to ensure consistent structure
|
|
247
|
+
*/
|
|
248
|
+
normalizeServerConfigs(servers) {
|
|
249
|
+
const normalized = {};
|
|
250
|
+
for (const [serverName, serverConfig] of Object.entries(servers)) {
|
|
251
|
+
if (serverConfig && typeof serverConfig === "object") {
|
|
252
|
+
const env = serverConfig.env && typeof serverConfig.env === "object" ? serverConfig.env : void 0;
|
|
253
|
+
normalized[serverName] = {
|
|
254
|
+
name: serverName,
|
|
255
|
+
command: serverConfig.command || "",
|
|
256
|
+
args: Array.isArray(serverConfig.args) ? serverConfig.args : void 0,
|
|
257
|
+
type: this.validateType(serverConfig.type) ? serverConfig.type : this.inferTransportType(serverConfig),
|
|
258
|
+
env
|
|
259
|
+
};
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
return normalized;
|
|
263
|
+
}
|
|
264
|
+
/**
|
|
265
|
+
* Validate type value
|
|
266
|
+
*/
|
|
267
|
+
validateType(type) {
|
|
268
|
+
return ["sse", "http", "stdio", "streamable-http"].includes(type);
|
|
269
|
+
}
|
|
270
|
+
/**
|
|
271
|
+
* Infer transport type from server configuration when type field is not explicitly set
|
|
272
|
+
*/
|
|
273
|
+
inferTransportType(serverConfig) {
|
|
274
|
+
if (serverConfig.url && typeof serverConfig.url === "string") {
|
|
275
|
+
return "http";
|
|
276
|
+
}
|
|
277
|
+
if (Array.isArray(serverConfig.args)) {
|
|
278
|
+
const argsString = serverConfig.args.join(" ").toLowerCase();
|
|
279
|
+
if (argsString.includes("stdio")) {
|
|
280
|
+
return "stdio";
|
|
281
|
+
}
|
|
282
|
+
if (argsString.includes("http")) {
|
|
283
|
+
return "http";
|
|
284
|
+
}
|
|
285
|
+
if (argsString.includes("sse")) {
|
|
286
|
+
return "sse";
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
if (serverConfig.command && typeof serverConfig.command === "string") {
|
|
290
|
+
return "stdio";
|
|
291
|
+
}
|
|
292
|
+
return void 0;
|
|
293
|
+
}
|
|
294
|
+
/**
|
|
295
|
+
* Validate server configuration
|
|
296
|
+
*/
|
|
297
|
+
validateServerConfig(serverConfig) {
|
|
298
|
+
if (!serverConfig || typeof serverConfig !== "object") {
|
|
299
|
+
return false;
|
|
300
|
+
}
|
|
301
|
+
if (!serverConfig.name || typeof serverConfig.name !== "string") {
|
|
302
|
+
return false;
|
|
303
|
+
}
|
|
304
|
+
if (!serverConfig.command || typeof serverConfig.command !== "string") {
|
|
305
|
+
return false;
|
|
306
|
+
}
|
|
307
|
+
return true;
|
|
308
|
+
}
|
|
309
|
+
/**
|
|
310
|
+
* Get supported configuration keys that the parser recognizes
|
|
311
|
+
*/
|
|
312
|
+
getSupportedConfigKeys() {
|
|
313
|
+
return ["servers", "mcp.servers", "mcpServers", "context_servers"];
|
|
49
314
|
}
|
|
315
|
+
/**
|
|
316
|
+
* Check if the configuration file has valid syntax
|
|
317
|
+
*/
|
|
50
318
|
async isValidSyntax() {
|
|
51
319
|
try {
|
|
52
|
-
await this.
|
|
53
|
-
return
|
|
320
|
+
const configData = await this.parseConfigFile();
|
|
321
|
+
return configData.valid;
|
|
54
322
|
} catch (error) {
|
|
55
323
|
return false;
|
|
56
324
|
}
|
|
57
325
|
}
|
|
326
|
+
/**
|
|
327
|
+
* Count the number of MCP servers in the configuration
|
|
328
|
+
*/
|
|
58
329
|
async countMCPServers() {
|
|
59
330
|
try {
|
|
60
|
-
const
|
|
61
|
-
return Object.keys(
|
|
331
|
+
const configData = await this.parseConfigFile();
|
|
332
|
+
return Object.keys(configData.servers).length;
|
|
62
333
|
} catch (error) {
|
|
63
334
|
return 0;
|
|
64
335
|
}
|
|
65
336
|
}
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
337
|
+
/**
|
|
338
|
+
* Get the raw file content
|
|
339
|
+
*/
|
|
340
|
+
async getFileContent() {
|
|
341
|
+
if (this.fileContents) {
|
|
342
|
+
return this.fileContents;
|
|
70
343
|
}
|
|
71
|
-
|
|
72
|
-
|
|
344
|
+
try {
|
|
345
|
+
this.fileContents = await fs.readFile(this.filePath, "utf-8");
|
|
346
|
+
return this.fileContents;
|
|
347
|
+
} catch (error) {
|
|
348
|
+
throw new Error(`Failed to read file: ${this.filePath}`);
|
|
73
349
|
}
|
|
74
|
-
|
|
75
|
-
|
|
350
|
+
}
|
|
351
|
+
};
|
|
352
|
+
|
|
353
|
+
// src/services/credential-detection-service.ts
|
|
354
|
+
var CredentialDetectionService = class {
|
|
355
|
+
static {
|
|
356
|
+
__name(this, "CredentialDetectionService");
|
|
357
|
+
}
|
|
358
|
+
/**
|
|
359
|
+
* Credential patterns grouped by risk level for easier maintenance
|
|
360
|
+
*/
|
|
361
|
+
static CREDENTIAL_PATTERNS = {
|
|
362
|
+
high: [
|
|
363
|
+
// API Keys and Tokens
|
|
364
|
+
/api[_-]?key/i,
|
|
365
|
+
/api[_-]?token/i,
|
|
366
|
+
/access[_-]?token/i,
|
|
367
|
+
/secret[_-]?key/i,
|
|
368
|
+
/private[_-]?key/i,
|
|
369
|
+
// Authentication Tokens
|
|
370
|
+
/auth[_-]?token/i,
|
|
371
|
+
/bearer[_-]?token/i,
|
|
372
|
+
/jwt[_-]?token/i,
|
|
373
|
+
/oauth[_-]?token/i,
|
|
374
|
+
// Passwords
|
|
375
|
+
/password/i,
|
|
376
|
+
/passwd/i,
|
|
377
|
+
/pwd/i,
|
|
378
|
+
// Credentials
|
|
379
|
+
/credential/i,
|
|
380
|
+
/creds/i,
|
|
381
|
+
// Specific service patterns
|
|
382
|
+
/openai[_-]?api[_-]?key/i,
|
|
383
|
+
/anthropic[_-]?api[_-]?key/i,
|
|
384
|
+
/firecrawl[_-]?api[_-]?key/i,
|
|
385
|
+
/github[_-]?token/i,
|
|
386
|
+
/gitlab[_-]?token/i,
|
|
387
|
+
/bitbucket[_-]?token/i,
|
|
388
|
+
// Database passwords
|
|
389
|
+
/db[_-]?password/i,
|
|
390
|
+
/database[_-]?password/i,
|
|
391
|
+
/redis[_-]?password/i,
|
|
392
|
+
/postgres[_-]?password/i,
|
|
393
|
+
/mysql[_-]?password/i,
|
|
394
|
+
// Cloud services
|
|
395
|
+
/aws[_-]?secret[_-]?access[_-]?key/i,
|
|
396
|
+
/aws[_-]?access[_-]?key[_-]?id/i,
|
|
397
|
+
/azure[_-]?key/i,
|
|
398
|
+
/gcp[_-]?key/i,
|
|
399
|
+
/google[_-]?api[_-]?key/i,
|
|
400
|
+
/gemini[_-]?api[_-]?key/i,
|
|
401
|
+
/claude[_-]?api[_-]?key/i
|
|
402
|
+
],
|
|
403
|
+
low: [
|
|
404
|
+
// Organization and Account IDs
|
|
405
|
+
/org[_-]?id/i,
|
|
406
|
+
/organization[_-]?id/i,
|
|
407
|
+
/account[_-]?id/i,
|
|
408
|
+
/user[_-]?id/i,
|
|
409
|
+
/openai[_-]?org[_-]?id/i
|
|
410
|
+
]
|
|
411
|
+
};
|
|
412
|
+
/**
|
|
413
|
+
* Check if an environment variable name suggests it might contain credentials
|
|
414
|
+
*/
|
|
415
|
+
static isPotentialCredential(envVarName) {
|
|
416
|
+
return this.CREDENTIAL_PATTERNS.high.some((pattern) => pattern.test(envVarName)) || this.CREDENTIAL_PATTERNS.low.some((pattern) => pattern.test(envVarName));
|
|
417
|
+
}
|
|
418
|
+
/**
|
|
419
|
+
* Analyze environment variables and return credential detection results
|
|
420
|
+
*/
|
|
421
|
+
static analyzeEnvironmentVariables(env) {
|
|
422
|
+
if (!env || typeof env !== "object") {
|
|
423
|
+
return {
|
|
424
|
+
hasCredentials: false,
|
|
425
|
+
credentialVars: [],
|
|
426
|
+
riskLevel: "none"
|
|
427
|
+
};
|
|
76
428
|
}
|
|
77
|
-
|
|
78
|
-
|
|
429
|
+
const credentialVars = [];
|
|
430
|
+
for (const [name, value] of Object.entries(env)) {
|
|
431
|
+
if (this.isPotentialCredential(name)) {
|
|
432
|
+
credentialVars.push({
|
|
433
|
+
name,
|
|
434
|
+
value: this.maskValue(value),
|
|
435
|
+
riskLevel: this.assessRiskLevel(name)
|
|
436
|
+
});
|
|
437
|
+
}
|
|
79
438
|
}
|
|
80
|
-
|
|
439
|
+
const hasCredentials = credentialVars.length > 0;
|
|
440
|
+
const riskLevel = this.calculateOverallRiskLevel(credentialVars);
|
|
441
|
+
return {
|
|
442
|
+
hasCredentials,
|
|
443
|
+
credentialVars,
|
|
444
|
+
riskLevel
|
|
445
|
+
};
|
|
81
446
|
}
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
447
|
+
/**
|
|
448
|
+
* Mask sensitive values for display (show only first and last character)
|
|
449
|
+
*/
|
|
450
|
+
static maskValue(value) {
|
|
451
|
+
if (!value || value.length <= 2) {
|
|
452
|
+
return value;
|
|
453
|
+
}
|
|
454
|
+
const first = value.charAt(0);
|
|
455
|
+
const last = value.charAt(value.length - 1);
|
|
456
|
+
const maskedLength = Math.min(value.length - 2, 8);
|
|
457
|
+
return `${first}${"*".repeat(maskedLength)}${last}`;
|
|
458
|
+
}
|
|
459
|
+
/**
|
|
460
|
+
* Assess risk level for a specific credential variable
|
|
461
|
+
*/
|
|
462
|
+
static assessRiskLevel(name) {
|
|
463
|
+
if (this.CREDENTIAL_PATTERNS.high.some((pattern) => pattern.test(name))) {
|
|
464
|
+
return "high";
|
|
465
|
+
}
|
|
466
|
+
if (this.CREDENTIAL_PATTERNS.low.some((pattern) => pattern.test(name))) {
|
|
467
|
+
return "low";
|
|
468
|
+
}
|
|
469
|
+
return "high";
|
|
470
|
+
}
|
|
471
|
+
/**
|
|
472
|
+
* Calculate overall risk level based on all credential variables
|
|
473
|
+
*/
|
|
474
|
+
static calculateOverallRiskLevel(credentialVars) {
|
|
475
|
+
if (credentialVars.length === 0) {
|
|
476
|
+
return "none";
|
|
477
|
+
}
|
|
478
|
+
const hasHighRisk = credentialVars.some((v) => v.riskLevel === "high");
|
|
479
|
+
if (hasHighRisk) {
|
|
480
|
+
return "high";
|
|
481
|
+
}
|
|
482
|
+
return "low";
|
|
483
|
+
}
|
|
484
|
+
};
|
|
485
|
+
|
|
486
|
+
// src/services/mcp-config-service.ts
|
|
487
|
+
var MCPConfigService = class {
|
|
488
|
+
static {
|
|
489
|
+
__name(this, "MCPConfigService");
|
|
490
|
+
}
|
|
491
|
+
pathRegistry;
|
|
492
|
+
currentOS;
|
|
493
|
+
debug;
|
|
494
|
+
constructor() {
|
|
495
|
+
this.pathRegistry = new MCPPathRegistry();
|
|
496
|
+
this.currentOS = platform();
|
|
497
|
+
this.debug = util.debuglog("ls-mcp");
|
|
498
|
+
}
|
|
499
|
+
/**
|
|
500
|
+
* Get MCP configuration files for a specific AI application on the current OS
|
|
501
|
+
*/
|
|
502
|
+
getConfigFilesPerApp(appName) {
|
|
503
|
+
try {
|
|
504
|
+
return this.pathRegistry.getPathsForApp(this.currentOS, appName);
|
|
505
|
+
} catch (error) {
|
|
506
|
+
throw new Error(`Failed to get config files for app '${appName}': ${error instanceof Error ? error.message : "Unknown error"}`);
|
|
507
|
+
}
|
|
508
|
+
}
|
|
509
|
+
/**
|
|
510
|
+
* Get MCP configuration files for all AI applications on the current OS
|
|
511
|
+
*/
|
|
512
|
+
getAllConfigFiles() {
|
|
513
|
+
try {
|
|
514
|
+
return this.pathRegistry.getPathsForOS(this.currentOS);
|
|
515
|
+
} catch (error) {
|
|
516
|
+
throw new Error(`Failed to get all config files: ${error instanceof Error ? error.message : "Unknown error"}`);
|
|
517
|
+
}
|
|
518
|
+
}
|
|
519
|
+
/**
|
|
520
|
+
* Get MCP servers configured for a specific AI application on the current OS
|
|
521
|
+
*/
|
|
522
|
+
async getMCPServersPerApp(appName) {
|
|
523
|
+
try {
|
|
524
|
+
const appPaths = this.getConfigFilesPerApp(appName);
|
|
525
|
+
const allServers = [];
|
|
526
|
+
for (const filePath of appPaths) {
|
|
527
|
+
const servers = await this.parseConfigFileForServers(filePath.filePath);
|
|
528
|
+
allServers.push(...servers);
|
|
529
|
+
}
|
|
530
|
+
return allServers;
|
|
531
|
+
} catch (error) {
|
|
532
|
+
throw new Error(`Failed to get MCP servers for app '${appName}': ${error instanceof Error ? error.message : "Unknown error"}`);
|
|
533
|
+
}
|
|
534
|
+
}
|
|
535
|
+
/**
|
|
536
|
+
* Get MCP servers configured for all AI applications on the current OS
|
|
537
|
+
*/
|
|
538
|
+
async getAllMCPServers() {
|
|
539
|
+
try {
|
|
540
|
+
const allApps = this.pathRegistry.getSupportedApps(this.currentOS);
|
|
541
|
+
const allServers = {};
|
|
542
|
+
for (const appName of allApps) {
|
|
543
|
+
try {
|
|
544
|
+
allServers[appName] = await this.getMCPServersPerApp(appName);
|
|
545
|
+
} catch (error) {
|
|
546
|
+
this.debug(`Failed to get servers for app '${appName}': ${error instanceof Error ? error.message : "Unknown error"}`);
|
|
547
|
+
allServers[appName] = [];
|
|
548
|
+
}
|
|
549
|
+
}
|
|
550
|
+
return allServers;
|
|
551
|
+
} catch (error) {
|
|
552
|
+
throw new Error(`Failed to get all MCP servers: ${error instanceof Error ? error.message : "Unknown error"}`);
|
|
553
|
+
}
|
|
554
|
+
}
|
|
555
|
+
/**
|
|
556
|
+
* Get metadata for all supported AI applications on the current OS
|
|
557
|
+
*/
|
|
558
|
+
getSupportedApps() {
|
|
559
|
+
try {
|
|
560
|
+
const appNames = this.pathRegistry.getSupportedApps(this.currentOS);
|
|
561
|
+
const appPaths = this.pathRegistry.getPathsForOS(this.currentOS);
|
|
562
|
+
return appNames.map((appName) => ({
|
|
563
|
+
name: appName,
|
|
564
|
+
friendlyName: this.getFriendlyName(appName),
|
|
565
|
+
paths: appPaths[appName] || []
|
|
566
|
+
}));
|
|
567
|
+
} catch (error) {
|
|
568
|
+
throw new Error(`Failed to get supported apps: ${error instanceof Error ? error.message : "Unknown error"}`);
|
|
569
|
+
}
|
|
570
|
+
}
|
|
571
|
+
/**
|
|
572
|
+
* Get all supported operating systems
|
|
573
|
+
*/
|
|
574
|
+
getSupportedOperatingSystems() {
|
|
575
|
+
return this.pathRegistry.getSupportedOperatingSystems();
|
|
576
|
+
}
|
|
577
|
+
/**
|
|
578
|
+
* Validate if a configuration file exists and is parsable
|
|
579
|
+
*/
|
|
580
|
+
async validateConfigFile(filePath) {
|
|
581
|
+
try {
|
|
582
|
+
await fs2.access(filePath);
|
|
583
|
+
const parser = this.createParser(filePath);
|
|
584
|
+
return await parser.isValidSyntax();
|
|
585
|
+
} catch (error) {
|
|
586
|
+
return false;
|
|
587
|
+
}
|
|
588
|
+
}
|
|
589
|
+
/**
|
|
590
|
+
* Create a parser instance (can be overridden for testing)
|
|
591
|
+
*/
|
|
592
|
+
createParser(filePath) {
|
|
593
|
+
return new MCPConfigParser(filePath);
|
|
594
|
+
}
|
|
595
|
+
/**
|
|
596
|
+
* Get MCP file groups with resolved paths and server information
|
|
597
|
+
*/
|
|
598
|
+
async getMCPFileGroups() {
|
|
599
|
+
try {
|
|
600
|
+
const appPaths = this.getAllConfigFiles();
|
|
601
|
+
const mcpFilesPathsData = {};
|
|
602
|
+
for (const [groupName, paths] of Object.entries(appPaths)) {
|
|
603
|
+
mcpFilesPathsData[groupName] = {
|
|
604
|
+
name: groupName,
|
|
605
|
+
friendlyName: this.getFriendlyName(groupName),
|
|
606
|
+
paths: [],
|
|
607
|
+
stats: { serversCount: 0 }
|
|
608
|
+
};
|
|
609
|
+
const uniqueFilePaths = /* @__PURE__ */ new Set();
|
|
610
|
+
let totalServersCount = 0;
|
|
611
|
+
for (const filePathData of paths) {
|
|
612
|
+
const resolvedPath = filePathData.filePath.replace("~", process.env.HOME || "");
|
|
613
|
+
const absolutePath = path2.resolve(resolvedPath);
|
|
614
|
+
if (uniqueFilePaths.has(absolutePath)) {
|
|
615
|
+
continue;
|
|
616
|
+
}
|
|
617
|
+
uniqueFilePaths.add(absolutePath);
|
|
618
|
+
try {
|
|
619
|
+
await fs2.access(resolvedPath);
|
|
620
|
+
const parser = this.createParser(resolvedPath);
|
|
621
|
+
const parsable = await parser.isValidSyntax();
|
|
622
|
+
filePathData.parsable = parsable;
|
|
623
|
+
if (parsable) {
|
|
624
|
+
const configData = await parser.parseConfigFile();
|
|
625
|
+
const servers = await this.convertToMCPServerInfo(configData.servers || {});
|
|
626
|
+
filePathData.servers = servers;
|
|
627
|
+
totalServersCount += servers.length;
|
|
628
|
+
}
|
|
629
|
+
mcpFilesPathsData[groupName].paths.push(filePathData);
|
|
630
|
+
} catch (error) {
|
|
631
|
+
this.debug(`Skipping file ${resolvedPath}: ${error instanceof Error ? error.message : "Unknown error"}`);
|
|
632
|
+
}
|
|
633
|
+
}
|
|
634
|
+
if (mcpFilesPathsData[groupName] && mcpFilesPathsData[groupName].stats) {
|
|
635
|
+
mcpFilesPathsData[groupName].stats.serversCount = totalServersCount;
|
|
636
|
+
}
|
|
637
|
+
}
|
|
638
|
+
return mcpFilesPathsData;
|
|
639
|
+
} catch (error) {
|
|
640
|
+
throw new Error(`Failed to get MCP file groups: ${error instanceof Error ? error.message : "Unknown error"}`);
|
|
641
|
+
}
|
|
642
|
+
}
|
|
643
|
+
/**
|
|
644
|
+
* Register a custom app with custom paths for the current OS
|
|
645
|
+
*/
|
|
646
|
+
registerCustomApp(appName, paths) {
|
|
647
|
+
try {
|
|
648
|
+
this.pathRegistry.registerCustomApp(this.currentOS, appName, paths);
|
|
649
|
+
} catch (error) {
|
|
650
|
+
throw new Error(`Failed to register custom app '${appName}': ${error instanceof Error ? error.message : "Unknown error"}`);
|
|
651
|
+
}
|
|
652
|
+
}
|
|
653
|
+
/**
|
|
654
|
+
* Parse a configuration file and return server information
|
|
655
|
+
*/
|
|
656
|
+
async parseConfigFileForServers(filePath) {
|
|
657
|
+
try {
|
|
658
|
+
const parser = this.createParser(filePath);
|
|
659
|
+
const configData = await parser.parseConfigFile();
|
|
660
|
+
return await this.convertToMCPServerInfo(configData.servers || {});
|
|
661
|
+
} catch (error) {
|
|
662
|
+
this.debug(`Failed to parse config file ${filePath}: ${error instanceof Error ? error.message : "Unknown error"}`);
|
|
663
|
+
return [];
|
|
664
|
+
}
|
|
665
|
+
}
|
|
666
|
+
/**
|
|
667
|
+
* Convert parsed server configs to MCPServerInfo format
|
|
668
|
+
*/
|
|
669
|
+
async convertToMCPServerInfo(servers) {
|
|
670
|
+
const serverInfos = [];
|
|
671
|
+
for (const [serverName, serverConfig] of Object.entries(servers)) {
|
|
672
|
+
if (serverConfig && typeof serverConfig === "object") {
|
|
673
|
+
serverInfos.push({
|
|
674
|
+
name: serverName,
|
|
675
|
+
command: serverConfig.command || "",
|
|
676
|
+
args: Array.isArray(serverConfig.args) ? serverConfig.args : void 0,
|
|
677
|
+
transport: serverConfig.type === "streamable-http" ? "http" : serverConfig.type,
|
|
678
|
+
// Map streamable-http to http
|
|
679
|
+
type: serverConfig.type,
|
|
680
|
+
source: serverConfig.command || "",
|
|
681
|
+
env: serverConfig.env,
|
|
682
|
+
status: "stopped",
|
|
683
|
+
// Default status, will be updated by server manager
|
|
684
|
+
credentials: CredentialDetectionService.analyzeEnvironmentVariables(serverConfig.env)
|
|
685
|
+
});
|
|
686
|
+
}
|
|
85
687
|
}
|
|
86
|
-
|
|
87
|
-
|
|
688
|
+
return serverInfos;
|
|
689
|
+
}
|
|
690
|
+
/**
|
|
691
|
+
* Get friendly name for an app
|
|
692
|
+
*/
|
|
693
|
+
getFriendlyName(appName) {
|
|
694
|
+
const friendlyNames = {
|
|
695
|
+
claude: "Claude Desktop",
|
|
696
|
+
claude_code: "Claude Code",
|
|
697
|
+
cursor: "Cursor",
|
|
698
|
+
vscode: "VS Code",
|
|
699
|
+
cline: "Cline",
|
|
700
|
+
windsurf: "Windsurf",
|
|
701
|
+
roo: "Roo",
|
|
702
|
+
"intellij-github-copilot": "IntelliJ GitHub Copilot",
|
|
703
|
+
junie: "IntelliJ Junie",
|
|
704
|
+
zed: "Zed",
|
|
705
|
+
gemini: "Gemini CLI"
|
|
706
|
+
};
|
|
707
|
+
return friendlyNames[appName] || appName;
|
|
88
708
|
}
|
|
89
709
|
};
|
|
90
710
|
|
|
91
711
|
// src/services/mcp-server-manager-service.ts
|
|
92
|
-
import
|
|
712
|
+
import path3 from "path";
|
|
93
713
|
import { execSync } from "child_process";
|
|
94
|
-
import { platform } from "os";
|
|
714
|
+
import { platform as platform2 } from "os";
|
|
95
715
|
var MCPServerManagerService = class {
|
|
96
716
|
static {
|
|
97
717
|
__name(this, "MCPServerManagerService");
|
|
@@ -111,7 +731,7 @@ var MCPServerManagerService = class {
|
|
|
111
731
|
if (serverConfig?.type && serverConfig.type === "sse") {
|
|
112
732
|
this.transport = "sse";
|
|
113
733
|
}
|
|
114
|
-
if (serverConfig?.type && serverConfig.type === "http") {
|
|
734
|
+
if (serverConfig?.type && (serverConfig.type === "http" || serverConfig.type === "streamable-http")) {
|
|
115
735
|
this.transport = "http";
|
|
116
736
|
}
|
|
117
737
|
if (serverConfig?.type && serverConfig.type === "stdio") {
|
|
@@ -147,7 +767,7 @@ var MCPServerManagerService = class {
|
|
|
147
767
|
isRunning() {
|
|
148
768
|
try {
|
|
149
769
|
let psOutput;
|
|
150
|
-
if (
|
|
770
|
+
if (platform2() === "win32") {
|
|
151
771
|
psOutput = execSync('powershell -Command "Get-CimInstance -ClassName Win32_Process | Select-Object ProcessId,Name,CommandLine,ParentProcessId | ConvertTo-Csv -NoTypeInformation"', {
|
|
152
772
|
encoding: "utf8",
|
|
153
773
|
timeout: 5e3
|
|
@@ -165,7 +785,7 @@ var MCPServerManagerService = class {
|
|
|
165
785
|
let pid;
|
|
166
786
|
let ppid;
|
|
167
787
|
let commandLine;
|
|
168
|
-
if (
|
|
788
|
+
if (platform2() === "win32") {
|
|
169
789
|
if (processLine.startsWith('"ProcessId"') || processLine.startsWith("ProcessId")) continue;
|
|
170
790
|
const parts = this.parseCSVLine(processLine);
|
|
171
791
|
if (parts.length < 4) continue;
|
|
@@ -188,7 +808,7 @@ var MCPServerManagerService = class {
|
|
|
188
808
|
for (const [pid, processData] of processMap) {
|
|
189
809
|
const commandMatchLinux = this.isCommandMatch(processData.commandTokens, pid, processData.ppid);
|
|
190
810
|
let commandMatchWin32 = false;
|
|
191
|
-
if (
|
|
811
|
+
if (platform2() === "win32") {
|
|
192
812
|
let commandTokensOnWin32 = processData.commandTokens;
|
|
193
813
|
if (commandTokensOnWin32.length > 0 && commandTokensOnWin32[0].toLowerCase().startsWith("cmd")) {
|
|
194
814
|
commandTokensOnWin32 = commandTokensOnWin32.slice(1);
|
|
@@ -299,9 +919,9 @@ var MCPServerManagerService = class {
|
|
|
299
919
|
return true;
|
|
300
920
|
}
|
|
301
921
|
getBaseCommand(fullCommandPath) {
|
|
302
|
-
let baseCommand =
|
|
303
|
-
if (
|
|
304
|
-
baseCommand =
|
|
922
|
+
let baseCommand = path3.basename(fullCommandPath);
|
|
923
|
+
if (platform2() === "win32") {
|
|
924
|
+
baseCommand = path3.basename(fullCommandPath, ".exe");
|
|
305
925
|
}
|
|
306
926
|
baseCommand = baseCommand.toLowerCase();
|
|
307
927
|
return baseCommand;
|
|
@@ -483,223 +1103,62 @@ var MCPServerManagerService = class {
|
|
|
483
1103
|
};
|
|
484
1104
|
|
|
485
1105
|
// src/main.ts
|
|
486
|
-
var osSpecificPaths = {
|
|
487
|
-
claude: [],
|
|
488
|
-
claude_code: [],
|
|
489
|
-
cursor: [],
|
|
490
|
-
vscode: [],
|
|
491
|
-
cline: [],
|
|
492
|
-
windsurf: [],
|
|
493
|
-
roo: [],
|
|
494
|
-
"intellij-github-copilot": [],
|
|
495
|
-
junie: []
|
|
496
|
-
};
|
|
497
|
-
if (platform2() === "win32") {
|
|
498
|
-
osSpecificPaths["claude"] = [
|
|
499
|
-
{ filePath: `${process.env.APPDATA}\\Claude\\claude_desktop_config.json`, type: "global" }
|
|
500
|
-
];
|
|
501
|
-
osSpecificPaths["claude_code"] = [
|
|
502
|
-
{ filePath: ".mcp.json", type: "local" }
|
|
503
|
-
];
|
|
504
|
-
osSpecificPaths["cursor"] = [
|
|
505
|
-
{ filePath: "~\\.cursor\\mcp.json", type: "global" },
|
|
506
|
-
{ filePath: ".cursor\\mcp.json", type: "local" }
|
|
507
|
-
];
|
|
508
|
-
osSpecificPaths["vscode"] = [
|
|
509
|
-
{ filePath: ".vscode\\mcp.json", type: "local" },
|
|
510
|
-
{ filePath: `${process.env.APPDATA}\\Code\\User\\settings.json`, type: "global" },
|
|
511
|
-
{ filePath: `${process.env.APPDATA}\\Code - Insiders\\User\\settings.json`, type: "global" },
|
|
512
|
-
{ filePath: `${process.env.APPDATA}\\Code\\User\\mcp.json`, type: "global" },
|
|
513
|
-
{ filePath: `${process.env.APPDATA}\\Code - Insiders\\User\\mcp.json`, type: "global" }
|
|
514
|
-
];
|
|
515
|
-
osSpecificPaths["cline"] = [
|
|
516
|
-
{ filePath: `${process.env.APPDATA}\\Code\\User\\globalStorage\\saoudrizwan.claude-dev\\settings\\cline_mcp_settings.json`, type: "global" },
|
|
517
|
-
{ filePath: `${process.env.APPDATA}\\Code - Insiders\\User\\globalStorage\\saoudrizwan.claude-dev\\settings\\cline_mcp_settings.json`, type: "global" }
|
|
518
|
-
];
|
|
519
|
-
osSpecificPaths["windsurf"] = [
|
|
520
|
-
{ filePath: ".codeium\\windsurf\\mcp_config.json", type: "local" }
|
|
521
|
-
];
|
|
522
|
-
osSpecificPaths["roo"] = [
|
|
523
|
-
{ filePath: `${process.env.APPDATA}\\Code\\User\\globalStorage\\rooveterinaryinc.roo-cline\\settings\\cline_mcp_settings.json`, type: "global" },
|
|
524
|
-
{ filePath: `${process.env.APPDATA}\\Code - Insiders\\User\\globalStorage\\rooveterinaryinc.roo-cline\\settings\\cline_mcp_settings.json`, type: "global" }
|
|
525
|
-
];
|
|
526
|
-
osSpecificPaths["intellij-github-copilot"] = [
|
|
527
|
-
{ filePath: `${process.env.LOCALAPPDATA}\\github-copilot\\intellij\\mcp.json`, type: "global" }
|
|
528
|
-
];
|
|
529
|
-
osSpecificPaths["junie"] = [
|
|
530
|
-
{ filePath: "~\\.junie\\mcp\\mcp.json", type: "global" }
|
|
531
|
-
];
|
|
532
|
-
osSpecificPaths["zed"] = [
|
|
533
|
-
{ filePath: `${process.env.LOCALAPPDATA}\\zed\\settings.json`, type: "global" },
|
|
534
|
-
{ filePath: ".zed\\settings.json", type: "local" }
|
|
535
|
-
];
|
|
536
|
-
} else {
|
|
537
|
-
osSpecificPaths["claude"] = [
|
|
538
|
-
{ filePath: "~/Library/Application Support/Claude/claude_desktop_config.json", type: "global" }
|
|
539
|
-
];
|
|
540
|
-
osSpecificPaths["claude_code"] = [
|
|
541
|
-
{ filePath: ".mcp.json", type: "local" }
|
|
542
|
-
];
|
|
543
|
-
osSpecificPaths["cursor"] = [
|
|
544
|
-
{ filePath: "~/.cursor/mcp.json", type: "global" },
|
|
545
|
-
{ filePath: ".cursor/mcp.json", type: "local" }
|
|
546
|
-
];
|
|
547
|
-
osSpecificPaths["vscode"] = [
|
|
548
|
-
{ filePath: ".vscode/mcp.json", type: "local" },
|
|
549
|
-
{ filePath: "~/Library/Application Support/Code/User/settings.json", type: "global" },
|
|
550
|
-
{ filePath: "~/Library/Application Support/Code/User/mcp.json", type: "global" },
|
|
551
|
-
{ filePath: "~/Library/Application Support/Code - Insiders/User/settings.json", type: "global" },
|
|
552
|
-
{ filePath: "~/Library/Application Support/Code - Insiders/User/mcp.json", type: "global" }
|
|
553
|
-
];
|
|
554
|
-
osSpecificPaths["cline"] = [
|
|
555
|
-
{ filePath: "~/Library/Application Support/Code/User/globalStorage/saoudrizwan.claude-dev/settings/cline_mcp_settings.json", type: "global" },
|
|
556
|
-
{ filePath: "~/Library/Application Support/Code - Insiders/User/globalStorage/saoudrizwan.claude-dev/settings/cline_mcp_settings.json", type: "global" }
|
|
557
|
-
];
|
|
558
|
-
osSpecificPaths["windsurf"] = [
|
|
559
|
-
{ filePath: ".codeium/windsurf/mcp_config.json", type: "local" }
|
|
560
|
-
];
|
|
561
|
-
osSpecificPaths["roo"] = [
|
|
562
|
-
{ filePath: "~/Library/Application Support/Code/User/globalStorage/rooveterinaryinc.roo-cline/settings/cline_mcp_settings.json", type: "global" },
|
|
563
|
-
{ filePath: "~/Library/Application Support/Code - Insiders/User/globalStorage/rooveterinaryinc.roo-cline/settings/cline_mcp_settings.json", type: "global" }
|
|
564
|
-
];
|
|
565
|
-
osSpecificPaths["intellij-github-copilot"] = [
|
|
566
|
-
{ filePath: "~/.config/github-copilot/intellij/mcp.json", type: "global" }
|
|
567
|
-
];
|
|
568
|
-
osSpecificPaths["junie"] = [
|
|
569
|
-
{ filePath: "~/.junie/mcp/mcp.json", type: "global" },
|
|
570
|
-
{ filePath: ".junie/mcp/mcp.json", type: "local" }
|
|
571
|
-
];
|
|
572
|
-
osSpecificPaths["zed"] = [
|
|
573
|
-
{ filePath: "~/.config/zed/settings.json", type: "global" },
|
|
574
|
-
{ filePath: ".zed/settings.json", type: "local" }
|
|
575
|
-
];
|
|
576
|
-
}
|
|
577
1106
|
var MCPFiles = class {
|
|
578
1107
|
static {
|
|
579
1108
|
__name(this, "MCPFiles");
|
|
580
1109
|
}
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
friendlyName: "Claude Desktop",
|
|
585
|
-
paths: osSpecificPaths["claude"]
|
|
586
|
-
},
|
|
587
|
-
claude_code: {
|
|
588
|
-
name: "claude-code",
|
|
589
|
-
friendlyName: "Claude Code",
|
|
590
|
-
paths: osSpecificPaths["claude_code"]
|
|
591
|
-
},
|
|
592
|
-
cursor: {
|
|
593
|
-
name: "cursor",
|
|
594
|
-
friendlyName: "Cursor",
|
|
595
|
-
paths: osSpecificPaths["cursor"]
|
|
596
|
-
},
|
|
597
|
-
vscode: {
|
|
598
|
-
name: "vscode",
|
|
599
|
-
friendlyName: "VS Code",
|
|
600
|
-
paths: osSpecificPaths["vscode"]
|
|
601
|
-
},
|
|
602
|
-
cline: {
|
|
603
|
-
name: "cline",
|
|
604
|
-
friendlyName: "Cline",
|
|
605
|
-
paths: osSpecificPaths["cline"]
|
|
606
|
-
},
|
|
607
|
-
windsurf: {
|
|
608
|
-
name: "windsurf",
|
|
609
|
-
friendlyName: "Windsurf",
|
|
610
|
-
paths: osSpecificPaths["windsurf"]
|
|
611
|
-
},
|
|
612
|
-
roo: {
|
|
613
|
-
name: "roo",
|
|
614
|
-
friendlyName: "Roo",
|
|
615
|
-
paths: osSpecificPaths["roo"]
|
|
616
|
-
},
|
|
617
|
-
"intellij-github-copilot": {
|
|
618
|
-
name: "intellij-github-copilot",
|
|
619
|
-
friendlyName: "IntelliJ GitHub Copilot",
|
|
620
|
-
paths: osSpecificPaths["intellij-github-copilot"]
|
|
621
|
-
},
|
|
622
|
-
junie: {
|
|
623
|
-
name: "junie",
|
|
624
|
-
friendlyName: "IntelliJ Junie",
|
|
625
|
-
paths: osSpecificPaths["junie"]
|
|
626
|
-
},
|
|
627
|
-
zed: {
|
|
628
|
-
name: "zed",
|
|
629
|
-
friendlyName: "Zed",
|
|
630
|
-
paths: osSpecificPaths["zed"]
|
|
631
|
-
}
|
|
632
|
-
};
|
|
633
|
-
constructor(mcpFilePathGroups) {
|
|
634
|
-
this.mcpFilePathGroups = mcpFilePathGroups || this.mcpFilePathGroups;
|
|
1110
|
+
mcpConfigService;
|
|
1111
|
+
constructor() {
|
|
1112
|
+
this.mcpConfigService = new MCPConfigService();
|
|
635
1113
|
}
|
|
1114
|
+
/**
|
|
1115
|
+
* Find and process all MCP configuration files
|
|
1116
|
+
*/
|
|
636
1117
|
async findFiles() {
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
const
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
const mcpServersFromConfig = await MCPConfigLinter.getMCPServers();
|
|
661
|
-
for (const serverName of Object.keys(mcpServersFromConfig)) {
|
|
662
|
-
const serverConfigRaw = mcpServersFromConfig[serverName];
|
|
663
|
-
const serverConfig = {
|
|
664
|
-
name: serverName,
|
|
665
|
-
command: serverConfigRaw.command || "",
|
|
666
|
-
args: serverConfigRaw.args,
|
|
667
|
-
url: serverConfigRaw.url,
|
|
668
|
-
transport: serverConfigRaw.transport,
|
|
669
|
-
type: serverConfigRaw.type,
|
|
670
|
-
env: serverConfigRaw.env
|
|
671
|
-
};
|
|
672
|
-
const MCPServerManager = new MCPServerManagerService(serverConfig);
|
|
673
|
-
const mcpServerProcessDetection = MCPServerManager.isRunning();
|
|
674
|
-
let mcpServerProcess = false;
|
|
675
|
-
if (mcpServerProcessDetection) {
|
|
676
|
-
if (typeof mcpServerProcessDetection === "object" && mcpServerProcessDetection.estimatedProduct === clientsGroup.name) {
|
|
677
|
-
mcpServerProcess = true;
|
|
1118
|
+
try {
|
|
1119
|
+
const mcpFilesPathsData = await this.mcpConfigService.getMCPFileGroups();
|
|
1120
|
+
for (const groupName of Object.keys(mcpFilesPathsData)) {
|
|
1121
|
+
const group = mcpFilesPathsData[groupName];
|
|
1122
|
+
for (const filePathData of group.paths) {
|
|
1123
|
+
if (filePathData.servers && filePathData.servers.length > 0) {
|
|
1124
|
+
for (const server of filePathData.servers) {
|
|
1125
|
+
const serverConfig = {
|
|
1126
|
+
name: server.name,
|
|
1127
|
+
command: server.command,
|
|
1128
|
+
args: server.args,
|
|
1129
|
+
transport: server.transport,
|
|
1130
|
+
// transport is always populated from type in the data layer
|
|
1131
|
+
type: server.type,
|
|
1132
|
+
env: server.env
|
|
1133
|
+
};
|
|
1134
|
+
const serverManager = new MCPServerManagerService(serverConfig);
|
|
1135
|
+
const processDetection = serverManager.isRunning();
|
|
1136
|
+
let isRunning = false;
|
|
1137
|
+
if (processDetection) {
|
|
1138
|
+
if (typeof processDetection === "object" && processDetection.estimatedProduct === group.name) {
|
|
1139
|
+
isRunning = true;
|
|
1140
|
+
}
|
|
678
1141
|
}
|
|
1142
|
+
server.status = isRunning ? "running" : "stopped";
|
|
679
1143
|
}
|
|
680
|
-
mcpServersData.push({
|
|
681
|
-
name: MCPServerManager.getName(),
|
|
682
|
-
command: MCPServerManager.getCmd(),
|
|
683
|
-
args: MCPServerManager.getArgs(),
|
|
684
|
-
source: MCPServerManager.getSource(),
|
|
685
|
-
transport: MCPServerManager.getTransport(),
|
|
686
|
-
env: MCPServerManager.getEnv(),
|
|
687
|
-
status: mcpServerProcess ? "running" : "stopped"
|
|
688
|
-
});
|
|
689
1144
|
}
|
|
690
|
-
filePathData.servers = mcpServersData;
|
|
691
|
-
mcpFilesPathsData[groupName]["stats"]["serversCount"] = await MCPConfigLinter.countMCPServers();
|
|
692
|
-
mcpFilesPathsData[groupName].paths.push(filePathData);
|
|
693
|
-
} catch (error) {
|
|
694
1145
|
}
|
|
695
1146
|
}
|
|
1147
|
+
return mcpFilesPathsData;
|
|
1148
|
+
} catch (error) {
|
|
1149
|
+
throw new Error(`Failed to find MCP files: ${error instanceof Error ? error.message : "Unknown error"}`);
|
|
696
1150
|
}
|
|
697
|
-
|
|
1151
|
+
}
|
|
1152
|
+
/**
|
|
1153
|
+
* Get MCP configuration service instance for advanced operations
|
|
1154
|
+
*/
|
|
1155
|
+
getMCPConfigService() {
|
|
1156
|
+
return this.mcpConfigService;
|
|
698
1157
|
}
|
|
699
1158
|
};
|
|
700
1159
|
|
|
701
1160
|
// src/services/render-service.ts
|
|
702
|
-
import { styleText as
|
|
1161
|
+
import { styleText as styleText10 } from "util";
|
|
703
1162
|
|
|
704
1163
|
// src/components/transport.ts
|
|
705
1164
|
import { styleText } from "util";
|
|
@@ -782,6 +1241,71 @@ function render7(text) {
|
|
|
782
1241
|
}
|
|
783
1242
|
__name(render7, "render");
|
|
784
1243
|
|
|
1244
|
+
// src/components/credential-warning.ts
|
|
1245
|
+
import { styleText as styleText8 } from "util";
|
|
1246
|
+
function CredentialWarningComponent(credentials) {
|
|
1247
|
+
if (!credentials || !credentials.hasCredentials) {
|
|
1248
|
+
return "";
|
|
1249
|
+
}
|
|
1250
|
+
const { riskLevel, credentialVars } = credentials;
|
|
1251
|
+
let riskColor;
|
|
1252
|
+
let riskIcon;
|
|
1253
|
+
switch (riskLevel) {
|
|
1254
|
+
case "high":
|
|
1255
|
+
riskColor = "red";
|
|
1256
|
+
riskIcon = styleText8(["red"], "\u25CF");
|
|
1257
|
+
break;
|
|
1258
|
+
case "low":
|
|
1259
|
+
riskColor = "blue";
|
|
1260
|
+
riskIcon = styleText8(["blue"], "\u25CF");
|
|
1261
|
+
break;
|
|
1262
|
+
default:
|
|
1263
|
+
riskColor = "blue";
|
|
1264
|
+
riskIcon = styleText8(["blue"], "\u25CF");
|
|
1265
|
+
}
|
|
1266
|
+
const riskText = styleText8([riskColor], `${riskIcon} ${riskLevel.toUpperCase()} RISK`);
|
|
1267
|
+
const credentialSummary = credentialVars.map((cv) => `${cv.name}=${cv.value}`).join(", ");
|
|
1268
|
+
return `${riskText} ${styleText8(["dim"], `(${credentialVars.length} cred vars: ${credentialSummary})`)}`;
|
|
1269
|
+
}
|
|
1270
|
+
__name(CredentialWarningComponent, "CredentialWarningComponent");
|
|
1271
|
+
|
|
1272
|
+
// src/components/summary.ts
|
|
1273
|
+
import { styleText as styleText9 } from "util";
|
|
1274
|
+
function SummaryComponent(stats) {
|
|
1275
|
+
const { totalServers, runningServers, highRiskCredentials, transportBreakdown } = stats;
|
|
1276
|
+
const runningBar = createProgressBar(runningServers, totalServers, 20, "green");
|
|
1277
|
+
const securityBar = createProgressBar(highRiskCredentials, totalServers, 20, "red");
|
|
1278
|
+
const transportText = `stdio: ${transportBreakdown.stdio} | SSE: ${transportBreakdown.sse} | HTTP: ${transportBreakdown.http}`;
|
|
1279
|
+
const lines = [
|
|
1280
|
+
"SUMMARY",
|
|
1281
|
+
` SERVERS ${runningBar} ${runningServers} / ${totalServers} Running`,
|
|
1282
|
+
` SECURITY ${securityBar} ${highRiskCredentials} / ${totalServers} High Risk Credentials`,
|
|
1283
|
+
` TRANSPORT ${transportText}`
|
|
1284
|
+
];
|
|
1285
|
+
return lines.join("\n");
|
|
1286
|
+
}
|
|
1287
|
+
__name(SummaryComponent, "SummaryComponent");
|
|
1288
|
+
function createProgressBar(count, total, width, color) {
|
|
1289
|
+
if (total === 0) {
|
|
1290
|
+
const emptyBar = "\u2591".repeat(width);
|
|
1291
|
+
return emptyBar;
|
|
1292
|
+
}
|
|
1293
|
+
const progress = Math.min(count / total, 1);
|
|
1294
|
+
const filledWidth = Math.round(progress * width);
|
|
1295
|
+
const emptyWidth = width - filledWidth;
|
|
1296
|
+
let filled;
|
|
1297
|
+
let empty;
|
|
1298
|
+
if (color === "green") {
|
|
1299
|
+
filled = styleText9(["greenBright"], "\u2588".repeat(filledWidth));
|
|
1300
|
+
empty = styleText9(["green"], "\u2591".repeat(emptyWidth));
|
|
1301
|
+
} else {
|
|
1302
|
+
filled = styleText9(["redBright"], "\u2588".repeat(filledWidth));
|
|
1303
|
+
empty = styleText9(["red"], "\u2591".repeat(emptyWidth));
|
|
1304
|
+
}
|
|
1305
|
+
return `${filled}${empty}`;
|
|
1306
|
+
}
|
|
1307
|
+
__name(createProgressBar, "createProgressBar");
|
|
1308
|
+
|
|
785
1309
|
// src/services/render-service.ts
|
|
786
1310
|
var RenderService = class _RenderService {
|
|
787
1311
|
static {
|
|
@@ -798,8 +1322,8 @@ var RenderService = class _RenderService {
|
|
|
798
1322
|
}
|
|
799
1323
|
static printMcpServers(data) {
|
|
800
1324
|
if (data.length === 0) return;
|
|
801
|
-
const headers = ["STATUS", "NAME", "SOURCE", "TRANSPORT"];
|
|
802
|
-
const keys = ["status", "name", "source", "transport"];
|
|
1325
|
+
const headers = ["STATUS", "NAME", "SOURCE", "TRANSPORT", "CREDENTIALS"];
|
|
1326
|
+
const keys = ["status", "name", "source", "transport", "credentials"];
|
|
803
1327
|
const centerColumns = [0, 2, 3];
|
|
804
1328
|
const leftPadding = " ";
|
|
805
1329
|
const columnWidths = headers.map((header, index) => {
|
|
@@ -818,6 +1342,9 @@ var RenderService = class _RenderService {
|
|
|
818
1342
|
if (keys[index] === "name") {
|
|
819
1343
|
text = render4(text);
|
|
820
1344
|
}
|
|
1345
|
+
if (keys[index] === "credentials") {
|
|
1346
|
+
text = CredentialWarningComponent(row[keys[index]]);
|
|
1347
|
+
}
|
|
821
1348
|
return _RenderService.getVisibleLength(text);
|
|
822
1349
|
}));
|
|
823
1350
|
return Math.max(headerWidth, dataWidth);
|
|
@@ -861,6 +1388,9 @@ var RenderService = class _RenderService {
|
|
|
861
1388
|
if (key === "name") {
|
|
862
1389
|
text = render4(text);
|
|
863
1390
|
}
|
|
1391
|
+
if (key === "credentials") {
|
|
1392
|
+
text = CredentialWarningComponent(row[key]);
|
|
1393
|
+
}
|
|
864
1394
|
if (centerColumns.includes(index)) {
|
|
865
1395
|
return centerText(text, columnWidths[index]);
|
|
866
1396
|
}
|
|
@@ -930,14 +1460,33 @@ var RenderService = class _RenderService {
|
|
|
930
1460
|
let filled;
|
|
931
1461
|
let empty;
|
|
932
1462
|
if (count > 0) {
|
|
933
|
-
filled =
|
|
934
|
-
empty =
|
|
1463
|
+
filled = styleText10(["greenBright"], "\u2588".repeat(filledWidth));
|
|
1464
|
+
empty = styleText10(["green"], "\u2591".repeat(emptyWidth));
|
|
935
1465
|
} else {
|
|
936
1466
|
filled = "\u2588".repeat(filledWidth);
|
|
937
1467
|
empty = "\u2591".repeat(emptyWidth);
|
|
938
1468
|
}
|
|
939
1469
|
return `${filled}${empty} ${count} / ${total} ${label}`;
|
|
940
1470
|
}
|
|
1471
|
+
/**
|
|
1472
|
+
* Print summary statistics at the end of the output
|
|
1473
|
+
*/
|
|
1474
|
+
static printSummary(stats) {
|
|
1475
|
+
console.log("\n");
|
|
1476
|
+
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");
|
|
1477
|
+
console.log();
|
|
1478
|
+
const summaryOutput = SummaryComponent(stats);
|
|
1479
|
+
const lines = summaryOutput.split("\n");
|
|
1480
|
+
for (const line of lines) {
|
|
1481
|
+
if (line === "SUMMARY") {
|
|
1482
|
+
console.log(" " + line);
|
|
1483
|
+
} else {
|
|
1484
|
+
console.log(" " + line);
|
|
1485
|
+
}
|
|
1486
|
+
}
|
|
1487
|
+
console.log();
|
|
1488
|
+
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");
|
|
1489
|
+
}
|
|
941
1490
|
};
|
|
942
1491
|
|
|
943
1492
|
// src/bin/cli.ts
|
|
@@ -950,6 +1499,10 @@ async function init() {
|
|
|
950
1499
|
exitWithError("No configuration for MCP Server applications found.");
|
|
951
1500
|
}
|
|
952
1501
|
let pathIndex = 0;
|
|
1502
|
+
let totalServers = 0;
|
|
1503
|
+
let totalRunning = 0;
|
|
1504
|
+
let totalHighRiskCredentials = 0;
|
|
1505
|
+
const transportCounts = { stdio: 0, sse: 0, http: 0 };
|
|
953
1506
|
for (const groupName of Object.keys(mcpFilesList)) {
|
|
954
1507
|
const group = mcpFilesList[groupName];
|
|
955
1508
|
if (group.paths.length > 0) {
|
|
@@ -961,6 +1514,19 @@ async function init() {
|
|
|
961
1514
|
const mcpServers = filePathData.servers || [];
|
|
962
1515
|
const totalMCPServers = filePathData.servers ? filePathData.servers.length : 0;
|
|
963
1516
|
const totalMCPServersRunning = mcpServers.filter((server) => server.status === "running").length;
|
|
1517
|
+
totalServers += totalMCPServers;
|
|
1518
|
+
totalRunning += totalMCPServersRunning;
|
|
1519
|
+
for (const server of mcpServers) {
|
|
1520
|
+
if (server.transport) {
|
|
1521
|
+
const transport = server.transport.toLowerCase();
|
|
1522
|
+
if (transport in transportCounts) {
|
|
1523
|
+
transportCounts[transport]++;
|
|
1524
|
+
}
|
|
1525
|
+
}
|
|
1526
|
+
if (server.credentials?.hasCredentials && server.credentials?.riskLevel === "high") {
|
|
1527
|
+
totalHighRiskCredentials++;
|
|
1528
|
+
}
|
|
1529
|
+
}
|
|
964
1530
|
const mcpGroupData = [
|
|
965
1531
|
{ key: "PROVIDER", value: group.friendlyName },
|
|
966
1532
|
{ key: "FILE", value: filePath },
|
|
@@ -979,13 +1545,20 @@ async function init() {
|
|
|
979
1545
|
if (pathIndex === 0) {
|
|
980
1546
|
exitWithError("No MCP servers found in known configuration files.");
|
|
981
1547
|
}
|
|
1548
|
+
const summaryStats = {
|
|
1549
|
+
totalServers,
|
|
1550
|
+
runningServers: totalRunning,
|
|
1551
|
+
highRiskCredentials: totalHighRiskCredentials,
|
|
1552
|
+
transportBreakdown: transportCounts
|
|
1553
|
+
};
|
|
1554
|
+
RenderService.printSummary(summaryStats);
|
|
982
1555
|
}
|
|
983
1556
|
__name(init, "init");
|
|
984
1557
|
init().then(() => {
|
|
985
1558
|
console.log("\n");
|
|
986
1559
|
});
|
|
987
1560
|
function exitWithError(message) {
|
|
988
|
-
console.error(`${
|
|
1561
|
+
console.error(`${styleText11(["red"], "\u25CF")} ${message}
|
|
989
1562
|
`);
|
|
990
1563
|
process.exit(1);
|
|
991
1564
|
}
|