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.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 styleText9 } from "util";
6
+ import { styleText as styleText11 } from "util";
7
7
 
8
- // src/main.ts
8
+ // src/services/mcp-config-service.ts
9
+ import { platform } from "os";
10
+ import path2 from "path";
9
11
  import fs2 from "fs/promises";
10
- import { platform as platform2 } from "os";
11
- import path3 from "path";
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-linter-service.ts
169
+ // src/services/mcp-config-parser.ts
14
170
  import fs from "fs/promises";
15
171
  import { parse } from "jsonc-parser";
16
- var MCPConfigLinterService = class {
172
+ var MCPConfigParser = class {
17
173
  static {
18
- __name(this, "MCPConfigLinterService");
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
- async parseFile() {
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
- try {
43
- this.fileContentsData = parse(fileContent);
44
- if (typeof this.fileContentsData === "object") {
45
- this.valid = true;
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.parseFile();
53
- return this.valid;
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 mcpServers = await this.getMCPServers();
61
- return Object.keys(mcpServers).length;
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
- async getMCPServers() {
67
- await this.parseFile();
68
- if (this.fileContentsData?.servers) {
69
- return this.fileContentsData.servers;
337
+ /**
338
+ * Get the raw file content
339
+ */
340
+ async getFileContent() {
341
+ if (this.fileContents) {
342
+ return this.fileContents;
343
+ }
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}`);
349
+ }
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
+ };
428
+ }
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
+ }
70
438
  }
71
- if (this.fileContentsData?.mcp?.servers) {
72
- return this.fileContentsData.mcp.servers;
439
+ const hasCredentials = credentialVars.length > 0;
440
+ const riskLevel = this.calculateOverallRiskLevel(credentialVars);
441
+ return {
442
+ hasCredentials,
443
+ credentialVars,
444
+ riskLevel
445
+ };
446
+ }
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;
73
453
  }
74
- if (this.fileContentsData?.mcpServers) {
75
- return this.fileContentsData.mcpServers;
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";
76
465
  }
77
- if (this.fileContentsData?.context_servers) {
78
- return this.fileContentsData.context_servers;
466
+ if (this.CREDENTIAL_PATTERNS.low.some((pattern) => pattern.test(name))) {
467
+ return "low";
79
468
  }
80
- return {};
469
+ return "high";
81
470
  }
82
- async getFileContent() {
83
- if (this.fileContents) {
84
- return this.fileContents;
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";
85
481
  }
86
- this.fileContents = await fs.readFile(this.filePath, "utf-8");
87
- return this.fileContents;
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
+ }
687
+ }
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 path from "path";
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 (platform() === "win32") {
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 (platform() === "win32") {
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 (platform() === "win32") {
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 = path.basename(fullCommandPath);
303
- if (platform() === "win32") {
304
- baseCommand = path.basename(fullCommandPath, ".exe");
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;
@@ -482,245 +1102,63 @@ var MCPServerManagerService = class {
482
1102
  }
483
1103
  };
484
1104
 
485
- // src/utils/os-paths.ts
486
- import path2 from "path";
487
- var appData = process.env.APPDATA || "";
488
- var localAppData = process.env.LOCALAPPDATA || "";
489
- var homeDir = process.env.HOME || "";
490
- function getWindowsPaths() {
491
- return {
492
- claude: [
493
- { filePath: path2.join(appData, "Claude", "claude_desktop_config.json"), type: "global" }
494
- ],
495
- claude_code: [
496
- { filePath: ".mcp.json", type: "local" }
497
- ],
498
- cursor: [
499
- { filePath: path2.join(homeDir, ".cursor", "mcp.json"), type: "global" },
500
- { filePath: path2.join(".cursor", "mcp.json"), type: "local" }
501
- ],
502
- vscode: [
503
- { filePath: path2.join(".vscode", "mcp.json"), type: "local" },
504
- { filePath: path2.join(appData, "Code", "User", "settings.json"), type: "global" },
505
- { filePath: path2.join(appData, "Code - Insiders", "User", "settings.json"), type: "global" },
506
- { filePath: path2.join(appData, "Code", "User", "mcp.json"), type: "global" },
507
- { filePath: path2.join(appData, "Code - Insiders", "User", "mcp.json"), type: "global" }
508
- ],
509
- cline: [
510
- { filePath: path2.join(appData, "Code", "User", "globalStorage", "saoudrizwan.claude-dev", "settings", "cline_mcp_settings.json"), type: "global" },
511
- { filePath: path2.join(appData, "Code - Insiders", "User", "globalStorage", "saoudrizwan.claude-dev", "settings", "cline_mcp_settings.json"), type: "global" }
512
- ],
513
- windsurf: [
514
- { filePath: path2.join(".codeium", "windsurf", "mcp_config.json"), type: "local" }
515
- ],
516
- roo: [
517
- { filePath: path2.join(appData, "Code", "User", "globalStorage", "rooveterinaryinc.roo-cline", "settings", "cline_mcp_settings.json"), type: "global" },
518
- { filePath: path2.join(appData, "Code - Insiders", "User", "globalStorage", "rooveterinaryinc.roo-cline", "settings", "cline_mcp_settings.json"), type: "global" }
519
- ],
520
- "intellij-github-copilot": [
521
- { filePath: path2.join(localAppData, "github-copilot", "intellij", "mcp.json"), type: "global" }
522
- ],
523
- junie: [
524
- { filePath: path2.join(homeDir, ".junie", "mcp", "mcp.json"), type: "global" }
525
- ],
526
- zed: [
527
- { filePath: path2.join(localAppData, "zed", "settings.json"), type: "global" },
528
- { filePath: path2.join(".zed", "settings.json"), type: "local" }
529
- ],
530
- gemini: [
531
- { filePath: path2.join(homeDir, ".gemini", "settings.json"), type: "global" },
532
- { filePath: path2.join(".gemini", "settings.json"), type: "local" }
533
- ]
534
- };
535
- }
536
- __name(getWindowsPaths, "getWindowsPaths");
537
- function getDarwinPaths() {
538
- return {
539
- claude: [
540
- { filePath: path2.join(homeDir, "Library", "Application Support", "Claude", "claude_desktop_config.json"), type: "global" }
541
- ],
542
- claude_code: [
543
- { filePath: ".mcp.json", type: "local" }
544
- ],
545
- cursor: [
546
- { filePath: path2.join(homeDir, ".cursor", "mcp.json"), type: "global" },
547
- { filePath: path2.join(".cursor", "mcp.json"), type: "local" }
548
- ],
549
- vscode: [
550
- { filePath: path2.join(".vscode", "mcp.json"), type: "local" },
551
- { filePath: path2.join(homeDir, "Library", "Application Support", "Code", "User", "settings.json"), type: "global" },
552
- { filePath: path2.join(homeDir, "Library", "Application Support", "Code", "User", "mcp.json"), type: "global" },
553
- { filePath: path2.join(homeDir, "Library", "Application Support", "Code - Insiders", "User", "settings.json"), type: "global" },
554
- { filePath: path2.join(homeDir, "Library", "Application Support", "Code - Insiders", "User", "mcp.json"), type: "global" }
555
- ],
556
- cline: [
557
- { filePath: path2.join(homeDir, "Library", "Application Support", "Code", "User", "globalStorage", "saoudrizwan.claude-dev", "settings", "cline_mcp_settings.json"), type: "global" },
558
- { filePath: path2.join(homeDir, "Library", "Application Support", "Code - Insiders", "User", "globalStorage", "saoudrizwan.claude-dev", "settings", "cline_mcp_settings.json"), type: "global" }
559
- ],
560
- windsurf: [
561
- { filePath: path2.join(".codeium", "windsurf", "mcp_config.json"), type: "local" }
562
- ],
563
- roo: [
564
- { filePath: path2.join(homeDir, "Library", "Application Support", "Code", "User", "globalStorage", "rooveterinaryinc.roo-cline", "settings", "cline_mcp_settings.json"), type: "global" },
565
- { filePath: path2.join(homeDir, "Library", "Application Support", "Code - Insiders", "User", "globalStorage", "rooveterinaryinc.roo-cline", "settings", "cline_mcp_settings.json"), type: "global" }
566
- ],
567
- "intellij-github-copilot": [
568
- { filePath: path2.join(homeDir, ".config", "github-copilot", "intellij", "mcp.json"), type: "global" }
569
- ],
570
- junie: [
571
- { filePath: path2.join(homeDir, ".junie", "mcp", "mcp.json"), type: "global" },
572
- { filePath: path2.join(".junie", "mcp", "mcp.json"), type: "local" }
573
- ],
574
- zed: [
575
- { filePath: path2.join(homeDir, ".config", "zed", "settings.json"), type: "global" },
576
- { filePath: path2.join(".zed", "settings.json"), type: "local" }
577
- ],
578
- gemini: [
579
- { filePath: path2.join(homeDir, ".gemini", "settings.json"), type: "global" },
580
- { filePath: path2.join(".gemini", "settings.json"), type: "local" }
581
- ]
582
- };
583
- }
584
- __name(getDarwinPaths, "getDarwinPaths");
585
-
586
1105
  // src/main.ts
587
- var osSpecificPaths = {};
588
- if (platform2() === "win32") {
589
- osSpecificPaths = getWindowsPaths();
590
- } else {
591
- osSpecificPaths = getDarwinPaths();
592
- }
593
1106
  var MCPFiles = class {
594
1107
  static {
595
1108
  __name(this, "MCPFiles");
596
1109
  }
597
- mcpFilePathGroups = {
598
- claude: {
599
- name: "claude-desktop",
600
- friendlyName: "Claude Desktop",
601
- paths: osSpecificPaths["claude"]
602
- },
603
- claude_code: {
604
- name: "claude-code",
605
- friendlyName: "Claude Code",
606
- paths: osSpecificPaths["claude_code"]
607
- },
608
- cursor: {
609
- name: "cursor",
610
- friendlyName: "Cursor",
611
- paths: osSpecificPaths["cursor"]
612
- },
613
- vscode: {
614
- name: "vscode",
615
- friendlyName: "VS Code",
616
- paths: osSpecificPaths["vscode"]
617
- },
618
- cline: {
619
- name: "cline",
620
- friendlyName: "Cline",
621
- paths: osSpecificPaths["cline"]
622
- },
623
- windsurf: {
624
- name: "windsurf",
625
- friendlyName: "Windsurf",
626
- paths: osSpecificPaths["windsurf"]
627
- },
628
- roo: {
629
- name: "roo",
630
- friendlyName: "Roo",
631
- paths: osSpecificPaths["roo"]
632
- },
633
- "intellij-github-copilot": {
634
- name: "intellij-github-copilot",
635
- friendlyName: "IntelliJ GitHub Copilot",
636
- paths: osSpecificPaths["intellij-github-copilot"]
637
- },
638
- junie: {
639
- name: "junie",
640
- friendlyName: "IntelliJ Junie",
641
- paths: osSpecificPaths["junie"]
642
- },
643
- zed: {
644
- name: "zed",
645
- friendlyName: "Zed",
646
- paths: osSpecificPaths["zed"]
647
- },
648
- gemini: {
649
- name: "gemini-cli",
650
- friendlyName: "Gemini CLI",
651
- paths: osSpecificPaths.gemini
652
- }
653
- };
654
- constructor(mcpFilePathGroups) {
655
- this.mcpFilePathGroups = mcpFilePathGroups || this.mcpFilePathGroups;
1110
+ mcpConfigService;
1111
+ constructor() {
1112
+ this.mcpConfigService = new MCPConfigService();
656
1113
  }
1114
+ /**
1115
+ * Find and process all MCP configuration files
1116
+ */
657
1117
  async findFiles() {
658
- const mcpFilesPathsData = {};
659
- for (const groupName of Object.keys(this.mcpFilePathGroups)) {
660
- const clientsGroup = this.mcpFilePathGroups[groupName];
661
- mcpFilesPathsData[groupName] = {
662
- name: clientsGroup.name,
663
- friendlyName: clientsGroup.friendlyName,
664
- paths: [],
665
- stats: {}
666
- };
667
- const uniqueFilePaths = /* @__PURE__ */ new Set();
668
- for (const filePathData of clientsGroup.paths) {
669
- const resolvedPath = filePathData.filePath.replace("~", process.env.HOME || "");
670
- const absolutePath = path3.resolve(resolvedPath);
671
- if (uniqueFilePaths.has(absolutePath)) {
672
- continue;
673
- }
674
- uniqueFilePaths.add(absolutePath);
675
- try {
676
- await fs2.access(resolvedPath);
677
- const MCPConfigLinter = new MCPConfigLinterService(resolvedPath);
678
- const parsable = await MCPConfigLinter.isValidSyntax();
679
- filePathData.parsable = parsable;
680
- const mcpServersData = [];
681
- const mcpServersFromConfig = await MCPConfigLinter.getMCPServers();
682
- for (const serverName of Object.keys(mcpServersFromConfig)) {
683
- const serverConfigRaw = mcpServersFromConfig[serverName];
684
- const serverConfig = {
685
- name: serverName,
686
- command: serverConfigRaw.command || "",
687
- args: serverConfigRaw.args,
688
- url: serverConfigRaw.url,
689
- transport: serverConfigRaw.transport,
690
- type: serverConfigRaw.type,
691
- env: serverConfigRaw.env
692
- };
693
- const MCPServerManager = new MCPServerManagerService(serverConfig);
694
- const mcpServerProcessDetection = MCPServerManager.isRunning();
695
- let mcpServerProcess = false;
696
- if (mcpServerProcessDetection) {
697
- if (typeof mcpServerProcessDetection === "object" && mcpServerProcessDetection.estimatedProduct === clientsGroup.name) {
698
- 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
+ }
699
1141
  }
1142
+ server.status = isRunning ? "running" : "stopped";
700
1143
  }
701
- mcpServersData.push({
702
- name: MCPServerManager.getName(),
703
- command: MCPServerManager.getCmd(),
704
- args: MCPServerManager.getArgs(),
705
- source: MCPServerManager.getSource(),
706
- transport: MCPServerManager.getTransport(),
707
- env: MCPServerManager.getEnv(),
708
- status: mcpServerProcess ? "running" : "stopped"
709
- });
710
1144
  }
711
- filePathData.servers = mcpServersData;
712
- mcpFilesPathsData[groupName]["stats"]["serversCount"] = await MCPConfigLinter.countMCPServers();
713
- mcpFilesPathsData[groupName].paths.push(filePathData);
714
- } catch (error) {
715
1145
  }
716
1146
  }
1147
+ return mcpFilesPathsData;
1148
+ } catch (error) {
1149
+ throw new Error(`Failed to find MCP files: ${error instanceof Error ? error.message : "Unknown error"}`);
717
1150
  }
718
- return mcpFilesPathsData;
1151
+ }
1152
+ /**
1153
+ * Get MCP configuration service instance for advanced operations
1154
+ */
1155
+ getMCPConfigService() {
1156
+ return this.mcpConfigService;
719
1157
  }
720
1158
  };
721
1159
 
722
1160
  // src/services/render-service.ts
723
- import { styleText as styleText8 } from "util";
1161
+ import { styleText as styleText10 } from "util";
724
1162
 
725
1163
  // src/components/transport.ts
726
1164
  import { styleText } from "util";
@@ -803,6 +1241,71 @@ function render7(text) {
803
1241
  }
804
1242
  __name(render7, "render");
805
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
+
806
1309
  // src/services/render-service.ts
807
1310
  var RenderService = class _RenderService {
808
1311
  static {
@@ -819,8 +1322,8 @@ var RenderService = class _RenderService {
819
1322
  }
820
1323
  static printMcpServers(data) {
821
1324
  if (data.length === 0) return;
822
- const headers = ["STATUS", "NAME", "SOURCE", "TRANSPORT"];
823
- const keys = ["status", "name", "source", "transport"];
1325
+ const headers = ["STATUS", "NAME", "SOURCE", "TRANSPORT", "CREDENTIALS"];
1326
+ const keys = ["status", "name", "source", "transport", "credentials"];
824
1327
  const centerColumns = [0, 2, 3];
825
1328
  const leftPadding = " ";
826
1329
  const columnWidths = headers.map((header, index) => {
@@ -839,6 +1342,9 @@ var RenderService = class _RenderService {
839
1342
  if (keys[index] === "name") {
840
1343
  text = render4(text);
841
1344
  }
1345
+ if (keys[index] === "credentials") {
1346
+ text = CredentialWarningComponent(row[keys[index]]);
1347
+ }
842
1348
  return _RenderService.getVisibleLength(text);
843
1349
  }));
844
1350
  return Math.max(headerWidth, dataWidth);
@@ -882,6 +1388,9 @@ var RenderService = class _RenderService {
882
1388
  if (key === "name") {
883
1389
  text = render4(text);
884
1390
  }
1391
+ if (key === "credentials") {
1392
+ text = CredentialWarningComponent(row[key]);
1393
+ }
885
1394
  if (centerColumns.includes(index)) {
886
1395
  return centerText(text, columnWidths[index]);
887
1396
  }
@@ -951,14 +1460,33 @@ var RenderService = class _RenderService {
951
1460
  let filled;
952
1461
  let empty;
953
1462
  if (count > 0) {
954
- filled = styleText8(["greenBright"], "\u2588".repeat(filledWidth));
955
- empty = styleText8(["green"], "\u2591".repeat(emptyWidth));
1463
+ filled = styleText10(["greenBright"], "\u2588".repeat(filledWidth));
1464
+ empty = styleText10(["green"], "\u2591".repeat(emptyWidth));
956
1465
  } else {
957
1466
  filled = "\u2588".repeat(filledWidth);
958
1467
  empty = "\u2591".repeat(emptyWidth);
959
1468
  }
960
1469
  return `${filled}${empty} ${count} / ${total} ${label}`;
961
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
+ }
962
1490
  };
963
1491
 
964
1492
  // src/bin/cli.ts
@@ -971,6 +1499,10 @@ async function init() {
971
1499
  exitWithError("No configuration for MCP Server applications found.");
972
1500
  }
973
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 };
974
1506
  for (const groupName of Object.keys(mcpFilesList)) {
975
1507
  const group = mcpFilesList[groupName];
976
1508
  if (group.paths.length > 0) {
@@ -982,6 +1514,19 @@ async function init() {
982
1514
  const mcpServers = filePathData.servers || [];
983
1515
  const totalMCPServers = filePathData.servers ? filePathData.servers.length : 0;
984
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
+ }
985
1530
  const mcpGroupData = [
986
1531
  { key: "PROVIDER", value: group.friendlyName },
987
1532
  { key: "FILE", value: filePath },
@@ -1000,13 +1545,20 @@ async function init() {
1000
1545
  if (pathIndex === 0) {
1001
1546
  exitWithError("No MCP servers found in known configuration files.");
1002
1547
  }
1548
+ const summaryStats = {
1549
+ totalServers,
1550
+ runningServers: totalRunning,
1551
+ highRiskCredentials: totalHighRiskCredentials,
1552
+ transportBreakdown: transportCounts
1553
+ };
1554
+ RenderService.printSummary(summaryStats);
1003
1555
  }
1004
1556
  __name(init, "init");
1005
1557
  init().then(() => {
1006
1558
  console.log("\n");
1007
1559
  });
1008
1560
  function exitWithError(message) {
1009
- console.error(`${styleText9(["red"], "\u25CF")} ${message}
1561
+ console.error(`${styleText11(["red"], "\u25CF")} ${message}
1010
1562
  `);
1011
1563
  process.exit(1);
1012
1564
  }