ls-mcp 1.13.2 → 1.14.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
@@ -7,397 +7,10 @@ import { styleText as styleText12 } from "util";
7
7
 
8
8
  // src/services/mcp-config-service.ts
9
9
  import { platform } from "os";
10
- import path3 from "path";
11
- import fs3 from "fs/promises";
12
- import util from "util";
13
-
14
- // src/services/mcp-path-registry.ts
15
10
  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
- static LINUX_PATHS = {
110
- claude: [
111
- { filePath: path.join(process.env.HOME || "", ".config", "Claude", "claude_desktop_config.json"), type: "global" }
112
- ],
113
- claude_code: [
114
- { filePath: ".mcp.json", type: "local" }
115
- ],
116
- cursor: [
117
- { filePath: path.join(process.env.HOME || "", ".cursor", "mcp.json"), type: "global" },
118
- { filePath: path.join(".cursor", "mcp.json"), type: "local" }
119
- ],
120
- vscode: [
121
- { filePath: path.join(".vscode", "mcp.json"), type: "local" },
122
- { filePath: path.join(process.env.HOME || "", ".config", "Code", "User", "settings.json"), type: "global" },
123
- { filePath: path.join(process.env.HOME || "", ".config", "Code - Insiders", "User", "settings.json"), type: "global" },
124
- { filePath: path.join(process.env.HOME || "", ".config", "Code", "User", "mcp.json"), type: "global" },
125
- { filePath: path.join(process.env.HOME || "", ".config", "Code - Insiders", "User", "mcp.json"), type: "global" },
126
- { filePath: path.join(process.env.HOME || "", ".mcp.json"), type: "global" }
127
- ],
128
- cline: [
129
- { filePath: path.join(process.env.HOME || "", ".config", "Code", "User", "globalStorage", "saoudrizwan.claude-dev", "settings", "cline_mcp_settings.json"), type: "global" },
130
- { filePath: path.join(process.env.HOME || "", ".config", "Code - Insiders", "User", "globalStorage", "saoudrizwan.claude-dev", "settings", "cline_mcp_settings.json"), type: "global" }
131
- ],
132
- windsurf: [
133
- { filePath: path.join(".codeium", "windsurf", "mcp_config.json"), type: "local" }
134
- ],
135
- roo: [
136
- { filePath: path.join(process.env.HOME || "", ".config", "Code", "User", "globalStorage", "rooveterinaryinc.roo-cline", "settings", "cline_mcp_settings.json"), type: "global" },
137
- { filePath: path.join(process.env.HOME || "", ".config", "Code - Insiders", "User", "globalStorage", "rooveterinaryinc.roo-cline", "settings", "cline_mcp_settings.json"), type: "global" }
138
- ],
139
- "intellij-github-copilot": [
140
- { filePath: path.join(process.env.HOME || "", ".config", "github-copilot", "intellij", "mcp.json"), type: "global" }
141
- ],
142
- junie: [
143
- { filePath: path.join(process.env.HOME || "", ".junie", "mcp.json"), type: "global" },
144
- { filePath: path.join(".junie", "mcp", "mcp.json"), type: "local" }
145
- ],
146
- zed: [
147
- { filePath: path.join(process.env.HOME || "", ".config", "zed", "settings.json"), type: "global" },
148
- { filePath: path.join(".zed", "settings.json"), type: "local" }
149
- ],
150
- gemini: [
151
- { filePath: path.join(process.env.HOME || "", ".gemini", "settings.json"), type: "global" },
152
- { filePath: path.join(".gemini", "settings.json"), type: "local" }
153
- ]
154
- };
155
- customApps = /* @__PURE__ */ new Map();
156
- /**
157
- * Get all MCP configuration file paths for a specific operating system
158
- */
159
- getPathsForOS(os) {
160
- switch (os.toLowerCase()) {
161
- case "win32":
162
- case "windows":
163
- return { ..._MCPPathRegistry.WINDOWS_PATHS };
164
- case "darwin":
165
- case "macos":
166
- return { ..._MCPPathRegistry.DARWIN_PATHS };
167
- case "linux":
168
- return { ..._MCPPathRegistry.LINUX_PATHS };
169
- default:
170
- throw new Error(`Unsupported operating system: ${os}`);
171
- }
172
- }
173
- /**
174
- * Get MCP configuration file paths for a specific app on a specific OS
175
- */
176
- getPathsForApp(os, appName) {
177
- const osPaths = this.getPathsForOS(os);
178
- const appPaths = osPaths[appName];
179
- if (!appPaths) {
180
- throw new Error(`App '${appName}' not found for OS '${os}'`);
181
- }
182
- return [...appPaths];
183
- }
184
- /**
185
- * Get all supported app names for a specific OS
186
- */
187
- getSupportedApps(os) {
188
- const osPaths = this.getPathsForOS(os);
189
- return Object.keys(osPaths);
190
- }
191
- /**
192
- * Get all supported operating systems
193
- */
194
- getSupportedOperatingSystems() {
195
- return ["win32", "darwin", "linux"];
196
- }
197
- /**
198
- * Register a custom app with custom paths for a specific OS
199
- */
200
- registerCustomApp(os, appName, paths) {
201
- if (!this.customApps.has(os)) {
202
- this.customApps.set(os, {});
203
- }
204
- const osCustomApps = this.customApps.get(os);
205
- osCustomApps[appName] = [...paths];
206
- }
207
- /**
208
- * Get paths including custom registered apps
209
- */
210
- getPathsForOSWithCustom(os) {
211
- const basePaths = this.getPathsForOS(os);
212
- const customPaths = this.customApps.get(os) || {};
213
- return { ...basePaths, ...customPaths };
214
- }
215
- };
216
-
217
- // src/services/mcp-config-parser.ts
218
11
  import fs from "fs/promises";
219
- import { parse } from "jsonc-parser";
220
- var MCPConfigParser = class {
221
- static {
222
- __name(this, "MCPConfigParser");
223
- }
224
- filePath;
225
- fileContents = null;
226
- parsed = false;
227
- valid = false;
228
- fileContentsData = null;
229
- constructor(filePath) {
230
- this.filePath = filePath;
231
- }
232
- /**
233
- * Parse the configuration file and return structured data
234
- */
235
- async parseConfigFile() {
236
- if (this.parsed) {
237
- return {
238
- raw: this.fileContentsData,
239
- parsed: this.parsed,
240
- valid: this.valid,
241
- servers: await this.extractMCPServers(this.fileContentsData)
242
- };
243
- }
244
- this.parsed = true;
245
- const fileContent = await this.getFileContent();
246
- try {
247
- this.fileContentsData = JSON.parse(fileContent);
248
- if (typeof this.fileContentsData === "object") {
249
- this.valid = true;
250
- }
251
- } catch (e) {
252
- }
253
- if (!this.valid) {
254
- try {
255
- this.fileContentsData = parse(fileContent);
256
- if (typeof this.fileContentsData === "object") {
257
- this.valid = true;
258
- }
259
- } catch (error) {
260
- }
261
- }
262
- if (!this.valid) {
263
- throw new Error(`Failed to parse configuration file: ${this.filePath}`);
264
- }
265
- return {
266
- raw: this.fileContentsData,
267
- parsed: this.parsed,
268
- valid: this.valid,
269
- servers: await this.extractMCPServers(this.fileContentsData)
270
- };
271
- }
272
- /**
273
- * Extract MCP servers from parsed configuration data
274
- */
275
- async extractMCPServers(configData) {
276
- if (!configData || typeof configData !== "object") {
277
- return {};
278
- }
279
- if (configData.servers && typeof configData.servers === "object") {
280
- return this.normalizeServerConfigs(configData.servers);
281
- }
282
- if (configData.mcp?.servers && typeof configData.mcp.servers === "object") {
283
- return this.normalizeServerConfigs(configData.mcp.servers);
284
- }
285
- if (configData.mcpServers && typeof configData.mcpServers === "object") {
286
- return this.normalizeServerConfigs(configData.mcpServers);
287
- }
288
- if (configData.context_servers && typeof configData.context_servers === "object") {
289
- return this.normalizeServerConfigs(configData.context_servers);
290
- }
291
- return {};
292
- }
293
- /**
294
- * Normalize server configurations to ensure consistent structure
295
- */
296
- normalizeServerConfigs(servers) {
297
- const normalized = {};
298
- for (const [serverName, serverConfig] of Object.entries(servers)) {
299
- if (serverConfig && typeof serverConfig === "object") {
300
- const env = serverConfig.env && typeof serverConfig.env === "object" ? serverConfig.env : void 0;
301
- normalized[serverName] = {
302
- name: serverName,
303
- command: serverConfig.command || "",
304
- args: Array.isArray(serverConfig.args) ? serverConfig.args : void 0,
305
- type: this.validateType(serverConfig.type) ? serverConfig.type : this.inferTransportType(serverConfig),
306
- url: serverConfig.url,
307
- env
308
- };
309
- }
310
- }
311
- return normalized;
312
- }
313
- /**
314
- * Validate type value
315
- */
316
- validateType(type) {
317
- return ["sse", "http", "stdio", "streamable-http"].includes(type);
318
- }
319
- /**
320
- * Infer transport type from server configuration when type field is not explicitly set
321
- */
322
- inferTransportType(serverConfig) {
323
- if (serverConfig.url && typeof serverConfig.url === "string") {
324
- return "http";
325
- }
326
- if (Array.isArray(serverConfig.args)) {
327
- const argsString = serverConfig.args.join(" ").toLowerCase();
328
- if (argsString.includes("stdio")) {
329
- return "stdio";
330
- }
331
- if (argsString.includes("http")) {
332
- return "http";
333
- }
334
- if (argsString.includes("sse")) {
335
- return "sse";
336
- }
337
- }
338
- if (serverConfig.command && typeof serverConfig.command === "string") {
339
- return "stdio";
340
- }
341
- return void 0;
342
- }
343
- /**
344
- * Validate server configuration
345
- */
346
- validateServerConfig(serverConfig) {
347
- if (!serverConfig || typeof serverConfig !== "object") {
348
- return false;
349
- }
350
- if (!serverConfig.name || typeof serverConfig.name !== "string") {
351
- return false;
352
- }
353
- if (!serverConfig.command || typeof serverConfig.command !== "string") {
354
- return false;
355
- }
356
- return true;
357
- }
358
- /**
359
- * Get supported configuration keys that the parser recognizes
360
- */
361
- getSupportedConfigKeys() {
362
- return ["servers", "mcp.servers", "mcpServers", "context_servers"];
363
- }
364
- /**
365
- * Check if the configuration file has valid syntax
366
- */
367
- async isValidSyntax() {
368
- try {
369
- const configData = await this.parseConfigFile();
370
- return configData.valid;
371
- } catch (error) {
372
- return false;
373
- }
374
- }
375
- /**
376
- * Count the number of MCP servers in the configuration
377
- */
378
- async countMCPServers() {
379
- try {
380
- const configData = await this.parseConfigFile();
381
- return Object.keys(configData.servers).length;
382
- } catch (error) {
383
- return 0;
384
- }
385
- }
386
- /**
387
- * Get the raw file content
388
- */
389
- async getFileContent() {
390
- if (this.fileContents) {
391
- return this.fileContents;
392
- }
393
- try {
394
- this.fileContents = await fs.readFile(this.filePath, "utf-8");
395
- return this.fileContents;
396
- } catch (error) {
397
- throw new Error(`Failed to read file: ${this.filePath}`);
398
- }
399
- }
400
- };
12
+ import util from "util";
13
+ import { MCPPathRegistry, MCPConfigParser, DirectoryBubbleService } from "agent-files";
401
14
 
402
15
  // src/services/credential-detection-service.ts
403
16
  var CredentialDetectionService = class {
@@ -680,77 +293,6 @@ var CredentialDetectionService = class {
680
293
  }
681
294
  };
682
295
 
683
- // src/services/directory-bubble-service.ts
684
- import path2 from "path";
685
- import fs2 from "fs/promises";
686
- import { homedir } from "os";
687
- var DirectoryBubbleService = class {
688
- static {
689
- __name(this, "DirectoryBubbleService");
690
- }
691
- /**
692
- * Find a local MCP config file by bubbling up the directory tree
693
- * @param localPath - The relative path to search for (e.g., '.vscode/mcp.json')
694
- * @param startDir - The directory to start searching from
695
- * @returns The absolute path to the found config file, or null if not found
696
- */
697
- async findLocalConfigInParentDirectories(localPath, startDir) {
698
- try {
699
- let currentDir = path2.resolve(startDir);
700
- const homeDir = homedir();
701
- const rootDir = "/";
702
- let iterationCount = 0;
703
- const maxIterations = 100;
704
- const startDirResult = await this.checkDirectoryForConfig(currentDir, localPath);
705
- if (startDirResult) {
706
- return path2.join(currentDir, localPath);
707
- }
708
- while (currentDir !== homeDir && currentDir !== rootDir && iterationCount < maxIterations) {
709
- const parentDir = this.getParentDirectory(currentDir);
710
- if (!parentDir || parentDir === currentDir) {
711
- break;
712
- }
713
- if (parentDir === currentDir || parentDir.length >= currentDir.length) {
714
- break;
715
- }
716
- currentDir = parentDir;
717
- iterationCount++;
718
- const found = await this.checkDirectoryForConfig(currentDir, localPath);
719
- if (found) {
720
- return path2.join(currentDir, localPath);
721
- }
722
- }
723
- return null;
724
- } catch (error) {
725
- return null;
726
- }
727
- }
728
- /**
729
- * Check if a config file exists in the specified directory
730
- * @param dir - The directory to check
731
- * @param configPath - The relative path to the config file
732
- * @returns True if the config file exists and is accessible
733
- */
734
- async checkDirectoryForConfig(dir, configPath) {
735
- try {
736
- const fullPath = path2.join(dir, configPath);
737
- await fs2.access(fullPath);
738
- return true;
739
- } catch (error) {
740
- return false;
741
- }
742
- }
743
- /**
744
- * Get the parent directory of the specified directory
745
- * @param dir - The directory to get the parent of
746
- * @returns The parent directory path, or null if already at root
747
- */
748
- getParentDirectory(dir) {
749
- const parent = path2.dirname(dir);
750
- return parent === dir ? null : parent;
751
- }
752
- };
753
-
754
296
  // src/services/mcp-version-detection-service.ts
755
297
  var MCPVersionDetectionService = class {
756
298
  static {
@@ -1019,7 +561,7 @@ var MCPConfigService = class {
1019
561
  */
1020
562
  async validateConfigFile(filePath) {
1021
563
  try {
1022
- await fs3.access(filePath);
564
+ await fs.access(filePath);
1023
565
  const parser = this.createParser(filePath);
1024
566
  return await parser.isValidSyntax();
1025
567
  } catch (error) {
@@ -1039,7 +581,8 @@ var MCPConfigService = class {
1039
581
  try {
1040
582
  const appPaths = this.getAllConfigFiles();
1041
583
  const mcpFilesPathsData = {};
1042
- for (const [groupName, paths] of Object.entries(appPaths)) {
584
+ for (const groupName of Object.keys(appPaths)) {
585
+ const paths = appPaths[groupName];
1043
586
  mcpFilesPathsData[groupName] = {
1044
587
  name: groupName,
1045
588
  friendlyName: this.getFriendlyName(groupName),
@@ -1050,10 +593,10 @@ var MCPConfigService = class {
1050
593
  let totalServersCount = 0;
1051
594
  for (const filePathData of paths) {
1052
595
  let resolvedPath = filePathData.filePath.replace("~", process.env.HOME || "");
1053
- let absolutePath = path3.resolve(resolvedPath);
596
+ let absolutePath = path.resolve(resolvedPath);
1054
597
  if (filePathData.type === "local" && this.enableDirectoryBubbling) {
1055
598
  try {
1056
- await fs3.access(resolvedPath);
599
+ await fs.access(resolvedPath);
1057
600
  } catch (error) {
1058
601
  const bubbledPath = await this.directoryBubbleService.findLocalConfigInParentDirectories(
1059
602
  filePathData.filePath,
@@ -1061,7 +604,7 @@ var MCPConfigService = class {
1061
604
  );
1062
605
  if (bubbledPath) {
1063
606
  resolvedPath = bubbledPath;
1064
- absolutePath = path3.resolve(resolvedPath);
607
+ absolutePath = path.resolve(resolvedPath);
1065
608
  }
1066
609
  }
1067
610
  }
@@ -1070,7 +613,7 @@ var MCPConfigService = class {
1070
613
  }
1071
614
  uniqueFilePaths.add(absolutePath);
1072
615
  try {
1073
- await fs3.access(resolvedPath);
616
+ await fs.access(resolvedPath);
1074
617
  const parser = this.createParser(resolvedPath);
1075
618
  const parsable = await parser.isValidSyntax();
1076
619
  filePathData.parsable = parsable;
@@ -1094,6 +637,61 @@ var MCPConfigService = class {
1094
637
  throw new Error(`Failed to get MCP file groups: ${error instanceof Error ? error.message : "Unknown error"}`);
1095
638
  }
1096
639
  }
640
+ /**
641
+ * Parse custom configuration files provided by the user
642
+ * This method processes files independently of standard app-based discovery
643
+ */
644
+ async parseCustomFiles(filePaths) {
645
+ try {
646
+ const mcpFilesPathsData = {
647
+ custom: {
648
+ name: "custom",
649
+ friendlyName: "Custom Files",
650
+ paths: [],
651
+ stats: { serversCount: 0 }
652
+ }
653
+ };
654
+ let totalServersCount = 0;
655
+ for (const filePath of filePaths) {
656
+ const resolvedPath = filePath.replace("~", process.env.HOME || "");
657
+ const absolutePath = path.resolve(resolvedPath);
658
+ try {
659
+ await fs.access(absolutePath);
660
+ const parser = this.createParser(absolutePath);
661
+ const parsable = await parser.isValidSyntax();
662
+ const filePathData = {
663
+ filePath: absolutePath,
664
+ type: "local",
665
+ parsable
666
+ };
667
+ if (parsable) {
668
+ const configData = await parser.parseConfigFile();
669
+ const servers = await this.convertToMCPServerInfo(configData.servers || {});
670
+ filePathData.servers = servers;
671
+ totalServersCount += servers.length;
672
+ } else {
673
+ this.debug(`File ${absolutePath} has invalid syntax`);
674
+ filePathData.servers = [];
675
+ }
676
+ mcpFilesPathsData.custom.paths.push(filePathData);
677
+ } catch (error) {
678
+ this.debug(`Skipping file ${absolutePath}: ${error instanceof Error ? error.message : "Unknown error"}`);
679
+ mcpFilesPathsData.custom.paths.push({
680
+ filePath: absolutePath,
681
+ type: "local",
682
+ parsable: false,
683
+ servers: []
684
+ });
685
+ }
686
+ }
687
+ if (mcpFilesPathsData.custom.stats) {
688
+ mcpFilesPathsData.custom.stats.serversCount = totalServersCount;
689
+ }
690
+ return mcpFilesPathsData;
691
+ } catch (error) {
692
+ throw new Error(`Failed to parse custom files: ${error instanceof Error ? error.message : "Unknown error"}`);
693
+ }
694
+ }
1097
695
  /**
1098
696
  * Register a custom app with custom paths for the current OS
1099
697
  */
@@ -1179,7 +777,7 @@ var MCPConfigService = class {
1179
777
  };
1180
778
 
1181
779
  // src/services/mcp-server-manager-service.ts
1182
- import path4 from "path";
780
+ import path2 from "path";
1183
781
  import { execSync } from "child_process";
1184
782
  import { platform as platform2 } from "os";
1185
783
  var MCPServerManagerService = class {
@@ -1389,9 +987,9 @@ var MCPServerManagerService = class {
1389
987
  return true;
1390
988
  }
1391
989
  getBaseCommand(fullCommandPath) {
1392
- let baseCommand = path4.basename(fullCommandPath);
990
+ let baseCommand = path2.basename(fullCommandPath);
1393
991
  if (platform2() === "win32") {
1394
- baseCommand = path4.basename(fullCommandPath, ".exe");
992
+ baseCommand = path2.basename(fullCommandPath, ".exe");
1395
993
  }
1396
994
  baseCommand = baseCommand.toLowerCase();
1397
995
  return baseCommand;
@@ -1578,14 +1176,47 @@ var MCPFiles = class {
1578
1176
  __name(this, "MCPFiles");
1579
1177
  }
1580
1178
  mcpConfigService;
1581
- constructor() {
1179
+ customFiles;
1180
+ constructor(customFiles2) {
1582
1181
  this.mcpConfigService = new MCPConfigService({ enableDirectoryBubbling: true });
1182
+ this.customFiles = customFiles2;
1583
1183
  }
1584
1184
  /**
1585
1185
  * Find and process all MCP configuration files
1186
+ * If customFiles are provided, only those files are processed (replaces automatic discovery)
1586
1187
  */
1587
1188
  async findFiles() {
1588
1189
  try {
1190
+ if (this.customFiles && this.customFiles.length > 0) {
1191
+ const mcpFilesPathsData2 = await this.mcpConfigService.parseCustomFiles(this.customFiles);
1192
+ for (const groupName of Object.keys(mcpFilesPathsData2)) {
1193
+ const group = mcpFilesPathsData2[groupName];
1194
+ for (const filePathData of group.paths) {
1195
+ if (filePathData.servers && filePathData.servers.length > 0) {
1196
+ for (const server of filePathData.servers) {
1197
+ const serverConfig = {
1198
+ name: server.name,
1199
+ command: server.command,
1200
+ args: server.args,
1201
+ transport: server.transport,
1202
+ type: server.type,
1203
+ env: server.env
1204
+ };
1205
+ const serverManager = new MCPServerManagerService(serverConfig);
1206
+ const processDetection = serverManager.isRunning();
1207
+ let isRunning = false;
1208
+ if (processDetection) {
1209
+ if (typeof processDetection === "object" && processDetection.estimatedProduct === group.name) {
1210
+ isRunning = true;
1211
+ }
1212
+ }
1213
+ server.status = isRunning ? "running" : "stopped";
1214
+ }
1215
+ }
1216
+ }
1217
+ }
1218
+ return mcpFilesPathsData2;
1219
+ }
1589
1220
  const mcpFilesPathsData = await this.mcpConfigService.getMCPFileGroups();
1590
1221
  for (const groupName of Object.keys(mcpFilesPathsData)) {
1591
1222
  const group = mcpFilesPathsData[groupName];
@@ -2019,12 +1650,30 @@ var RenderService = class _RenderService {
2019
1650
  // src/bin/cli.ts
2020
1651
  var args = process.argv.slice(2);
2021
1652
  var jsonOutput = args.includes("--json");
1653
+ var customFiles;
1654
+ var filesIndex = args.findIndex((arg) => arg === "--files");
1655
+ if (filesIndex !== -1 && filesIndex < args.length - 1) {
1656
+ const fileArgs = [];
1657
+ for (let i = filesIndex + 1; i < args.length; i++) {
1658
+ if (args[i].startsWith("--")) {
1659
+ break;
1660
+ }
1661
+ fileArgs.push(args[i]);
1662
+ }
1663
+ customFiles = fileArgs.flatMap(
1664
+ (arg) => arg.includes(",") ? arg.split(",").map((f) => f.trim()) : [arg.trim()]
1665
+ ).filter((f) => f.length > 0);
1666
+ }
2022
1667
  async function init() {
2023
1668
  if (!jsonOutput) {
2024
1669
  console.log();
2025
- console.log("[+] Detecting MCP Server configurations...");
1670
+ if (customFiles && customFiles.length > 0) {
1671
+ console.log("[+] Analyzing specified MCP configuration files...");
1672
+ } else {
1673
+ console.log("[+] Detecting MCP Server configurations...");
1674
+ }
2026
1675
  }
2027
- const mcpFilesManager = new MCPFiles();
1676
+ const mcpFilesManager = new MCPFiles(customFiles);
2028
1677
  const mcpFilesList = await mcpFilesManager.findFiles();
2029
1678
  if (Object.keys(mcpFilesList).length === 0) {
2030
1679
  exitWithError("No configuration for MCP Server applications found.");