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