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/main.cjs CHANGED
@@ -36,398 +36,11 @@ __export(main_exports, {
36
36
  module.exports = __toCommonJS(main_exports);
37
37
 
38
38
  // src/services/mcp-config-service.ts
39
- var import_node_os2 = require("os");
40
- var import_node_path3 = __toESM(require("path"), 1);
41
- var import_promises3 = __toESM(require("fs/promises"), 1);
42
- var import_node_util = __toESM(require("util"), 1);
43
-
44
- // src/services/mcp-path-registry.ts
39
+ var import_node_os = require("os");
45
40
  var import_node_path = __toESM(require("path"), 1);
46
- var MCPPathRegistry = class _MCPPathRegistry {
47
- static {
48
- __name(this, "MCPPathRegistry");
49
- }
50
- static WINDOWS_PATHS = {
51
- claude: [
52
- { filePath: import_node_path.default.join(process.env.APPDATA || "", "Claude", "claude_desktop_config.json"), type: "global" }
53
- ],
54
- claude_code: [
55
- { filePath: ".mcp.json", type: "local" }
56
- ],
57
- cursor: [
58
- { filePath: import_node_path.default.join(process.env.HOME || "", ".cursor", "mcp.json"), type: "global" },
59
- { filePath: import_node_path.default.join(".cursor", "mcp.json"), type: "local" }
60
- ],
61
- vscode: [
62
- { filePath: import_node_path.default.join(".vscode", "mcp.json"), type: "local" },
63
- { filePath: import_node_path.default.join(process.env.APPDATA || "", "Code", "User", "settings.json"), type: "global" },
64
- { filePath: import_node_path.default.join(process.env.APPDATA || "", "Code - Insiders", "User", "settings.json"), type: "global" },
65
- { filePath: import_node_path.default.join(process.env.APPDATA || "", "Code", "User", "mcp.json"), type: "global" },
66
- { filePath: import_node_path.default.join(process.env.APPDATA || "", "Code - Insiders", "User", "mcp.json"), type: "global" }
67
- ],
68
- cline: [
69
- { filePath: import_node_path.default.join(process.env.APPDATA || "", "Code", "User", "globalStorage", "saoudrizwan.claude-dev", "settings", "cline_mcp_settings.json"), type: "global" },
70
- { filePath: import_node_path.default.join(process.env.APPDATA || "", "Code - Insiders", "User", "globalStorage", "saoudrizwan.claude-dev", "settings", "cline_mcp_settings.json"), type: "global" }
71
- ],
72
- windsurf: [
73
- { filePath: import_node_path.default.join(".codeium", "windsurf", "mcp_config.json"), type: "local" }
74
- ],
75
- roo: [
76
- { filePath: import_node_path.default.join(process.env.APPDATA || "", "Code", "User", "globalStorage", "rooveterinaryinc.roo-cline", "settings", "cline_mcp_settings.json"), type: "global" },
77
- { filePath: import_node_path.default.join(process.env.APPDATA || "", "Code - Insiders", "User", "globalStorage", "rooveterinaryinc.roo-cline", "settings", "cline_mcp_settings.json"), type: "global" }
78
- ],
79
- "intellij-github-copilot": [
80
- { filePath: import_node_path.default.join(process.env.LOCALAPPDATA || "", "github-copilot", "intellij", "mcp.json"), type: "global" }
81
- ],
82
- junie: [
83
- { filePath: import_node_path.default.join(process.env.HOME || "", ".junie", "mcp", "mcp.json"), type: "global" }
84
- ],
85
- zed: [
86
- { filePath: import_node_path.default.join(process.env.LOCALAPPDATA || "", "zed", "settings.json"), type: "global" },
87
- { filePath: import_node_path.default.join(".zed", "settings.json"), type: "local" }
88
- ],
89
- gemini: [
90
- { filePath: import_node_path.default.join(process.env.HOME || "", ".gemini", "settings.json"), type: "global" },
91
- { filePath: import_node_path.default.join(".gemini", "settings.json"), type: "local" }
92
- ]
93
- };
94
- static DARWIN_PATHS = {
95
- claude: [
96
- { filePath: import_node_path.default.join(process.env.HOME || "", "Library", "Application Support", "Claude", "claude_desktop_config.json"), type: "global" }
97
- ],
98
- claude_code: [
99
- { filePath: ".mcp.json", type: "local" }
100
- ],
101
- cursor: [
102
- { filePath: import_node_path.default.join(process.env.HOME || "", ".cursor", "mcp.json"), type: "global" },
103
- { filePath: import_node_path.default.join(".cursor", "mcp.json"), type: "local" }
104
- ],
105
- vscode: [
106
- { filePath: import_node_path.default.join(".vscode", "mcp.json"), type: "local" },
107
- { filePath: import_node_path.default.join(process.env.HOME || "", "Library", "Application Support", "Code", "User", "settings.json"), type: "global" },
108
- { filePath: import_node_path.default.join(process.env.HOME || "", "Library", "Application Support", "Code", "User", "mcp.json"), type: "global" },
109
- { filePath: import_node_path.default.join(process.env.HOME || "", "Library", "Application Support", "Code - Insiders", "User", "settings.json"), type: "global" },
110
- { filePath: import_node_path.default.join(process.env.HOME || "", "Library", "Application Support", "Code - Insiders", "User", "mcp.json"), type: "global" }
111
- ],
112
- cline: [
113
- { 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" },
114
- { 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" }
115
- ],
116
- windsurf: [
117
- { filePath: import_node_path.default.join(".codeium", "windsurf", "mcp_config.json"), type: "local" }
118
- ],
119
- roo: [
120
- { 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" },
121
- { 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" }
122
- ],
123
- "intellij-github-copilot": [
124
- { filePath: import_node_path.default.join(process.env.HOME || "", ".config", "github-copilot", "intellij", "mcp.json"), type: "global" }
125
- ],
126
- junie: [
127
- { filePath: import_node_path.default.join(process.env.HOME || "", ".junie", "mcp", "mcp.json"), type: "global" },
128
- { filePath: import_node_path.default.join(".junie", "mcp", "mcp.json"), type: "local" }
129
- ],
130
- zed: [
131
- { filePath: import_node_path.default.join(process.env.HOME || "", ".config", "zed", "settings.json"), type: "global" },
132
- { filePath: import_node_path.default.join(".zed", "settings.json"), type: "local" }
133
- ],
134
- gemini: [
135
- { filePath: import_node_path.default.join(process.env.HOME || "", ".gemini", "settings.json"), type: "global" },
136
- { filePath: import_node_path.default.join(".gemini", "settings.json"), type: "local" }
137
- ]
138
- };
139
- static LINUX_PATHS = {
140
- claude: [
141
- { filePath: import_node_path.default.join(process.env.HOME || "", ".config", "Claude", "claude_desktop_config.json"), type: "global" }
142
- ],
143
- claude_code: [
144
- { filePath: ".mcp.json", type: "local" }
145
- ],
146
- cursor: [
147
- { filePath: import_node_path.default.join(process.env.HOME || "", ".cursor", "mcp.json"), type: "global" },
148
- { filePath: import_node_path.default.join(".cursor", "mcp.json"), type: "local" }
149
- ],
150
- vscode: [
151
- { filePath: import_node_path.default.join(".vscode", "mcp.json"), type: "local" },
152
- { filePath: import_node_path.default.join(process.env.HOME || "", ".config", "Code", "User", "settings.json"), type: "global" },
153
- { filePath: import_node_path.default.join(process.env.HOME || "", ".config", "Code - Insiders", "User", "settings.json"), type: "global" },
154
- { filePath: import_node_path.default.join(process.env.HOME || "", ".config", "Code", "User", "mcp.json"), type: "global" },
155
- { filePath: import_node_path.default.join(process.env.HOME || "", ".config", "Code - Insiders", "User", "mcp.json"), type: "global" },
156
- { filePath: import_node_path.default.join(process.env.HOME || "", ".mcp.json"), type: "global" }
157
- ],
158
- cline: [
159
- { filePath: import_node_path.default.join(process.env.HOME || "", ".config", "Code", "User", "globalStorage", "saoudrizwan.claude-dev", "settings", "cline_mcp_settings.json"), type: "global" },
160
- { filePath: import_node_path.default.join(process.env.HOME || "", ".config", "Code - Insiders", "User", "globalStorage", "saoudrizwan.claude-dev", "settings", "cline_mcp_settings.json"), type: "global" }
161
- ],
162
- windsurf: [
163
- { filePath: import_node_path.default.join(".codeium", "windsurf", "mcp_config.json"), type: "local" }
164
- ],
165
- roo: [
166
- { filePath: import_node_path.default.join(process.env.HOME || "", ".config", "Code", "User", "globalStorage", "rooveterinaryinc.roo-cline", "settings", "cline_mcp_settings.json"), type: "global" },
167
- { filePath: import_node_path.default.join(process.env.HOME || "", ".config", "Code - Insiders", "User", "globalStorage", "rooveterinaryinc.roo-cline", "settings", "cline_mcp_settings.json"), type: "global" }
168
- ],
169
- "intellij-github-copilot": [
170
- { filePath: import_node_path.default.join(process.env.HOME || "", ".config", "github-copilot", "intellij", "mcp.json"), type: "global" }
171
- ],
172
- junie: [
173
- { filePath: import_node_path.default.join(process.env.HOME || "", ".junie", "mcp.json"), type: "global" },
174
- { filePath: import_node_path.default.join(".junie", "mcp", "mcp.json"), type: "local" }
175
- ],
176
- zed: [
177
- { filePath: import_node_path.default.join(process.env.HOME || "", ".config", "zed", "settings.json"), type: "global" },
178
- { filePath: import_node_path.default.join(".zed", "settings.json"), type: "local" }
179
- ],
180
- gemini: [
181
- { filePath: import_node_path.default.join(process.env.HOME || "", ".gemini", "settings.json"), type: "global" },
182
- { filePath: import_node_path.default.join(".gemini", "settings.json"), type: "local" }
183
- ]
184
- };
185
- customApps = /* @__PURE__ */ new Map();
186
- /**
187
- * Get all MCP configuration file paths for a specific operating system
188
- */
189
- getPathsForOS(os) {
190
- switch (os.toLowerCase()) {
191
- case "win32":
192
- case "windows":
193
- return { ..._MCPPathRegistry.WINDOWS_PATHS };
194
- case "darwin":
195
- case "macos":
196
- return { ..._MCPPathRegistry.DARWIN_PATHS };
197
- case "linux":
198
- return { ..._MCPPathRegistry.LINUX_PATHS };
199
- default:
200
- throw new Error(`Unsupported operating system: ${os}`);
201
- }
202
- }
203
- /**
204
- * Get MCP configuration file paths for a specific app on a specific OS
205
- */
206
- getPathsForApp(os, appName) {
207
- const osPaths = this.getPathsForOS(os);
208
- const appPaths = osPaths[appName];
209
- if (!appPaths) {
210
- throw new Error(`App '${appName}' not found for OS '${os}'`);
211
- }
212
- return [...appPaths];
213
- }
214
- /**
215
- * Get all supported app names for a specific OS
216
- */
217
- getSupportedApps(os) {
218
- const osPaths = this.getPathsForOS(os);
219
- return Object.keys(osPaths);
220
- }
221
- /**
222
- * Get all supported operating systems
223
- */
224
- getSupportedOperatingSystems() {
225
- return ["win32", "darwin", "linux"];
226
- }
227
- /**
228
- * Register a custom app with custom paths for a specific OS
229
- */
230
- registerCustomApp(os, appName, paths) {
231
- if (!this.customApps.has(os)) {
232
- this.customApps.set(os, {});
233
- }
234
- const osCustomApps = this.customApps.get(os);
235
- osCustomApps[appName] = [...paths];
236
- }
237
- /**
238
- * Get paths including custom registered apps
239
- */
240
- getPathsForOSWithCustom(os) {
241
- const basePaths = this.getPathsForOS(os);
242
- const customPaths = this.customApps.get(os) || {};
243
- return { ...basePaths, ...customPaths };
244
- }
245
- };
246
-
247
- // src/services/mcp-config-parser.ts
248
41
  var import_promises = __toESM(require("fs/promises"), 1);
249
- var import_jsonc_parser = require("jsonc-parser");
250
- var MCPConfigParser = class {
251
- static {
252
- __name(this, "MCPConfigParser");
253
- }
254
- filePath;
255
- fileContents = null;
256
- parsed = false;
257
- valid = false;
258
- fileContentsData = null;
259
- constructor(filePath) {
260
- this.filePath = filePath;
261
- }
262
- /**
263
- * Parse the configuration file and return structured data
264
- */
265
- async parseConfigFile() {
266
- if (this.parsed) {
267
- return {
268
- raw: this.fileContentsData,
269
- parsed: this.parsed,
270
- valid: this.valid,
271
- servers: await this.extractMCPServers(this.fileContentsData)
272
- };
273
- }
274
- this.parsed = true;
275
- const fileContent = await this.getFileContent();
276
- try {
277
- this.fileContentsData = JSON.parse(fileContent);
278
- if (typeof this.fileContentsData === "object") {
279
- this.valid = true;
280
- }
281
- } catch (e) {
282
- }
283
- if (!this.valid) {
284
- try {
285
- this.fileContentsData = (0, import_jsonc_parser.parse)(fileContent);
286
- if (typeof this.fileContentsData === "object") {
287
- this.valid = true;
288
- }
289
- } catch (error) {
290
- }
291
- }
292
- if (!this.valid) {
293
- throw new Error(`Failed to parse configuration file: ${this.filePath}`);
294
- }
295
- return {
296
- raw: this.fileContentsData,
297
- parsed: this.parsed,
298
- valid: this.valid,
299
- servers: await this.extractMCPServers(this.fileContentsData)
300
- };
301
- }
302
- /**
303
- * Extract MCP servers from parsed configuration data
304
- */
305
- async extractMCPServers(configData) {
306
- if (!configData || typeof configData !== "object") {
307
- return {};
308
- }
309
- if (configData.servers && typeof configData.servers === "object") {
310
- return this.normalizeServerConfigs(configData.servers);
311
- }
312
- if (configData.mcp?.servers && typeof configData.mcp.servers === "object") {
313
- return this.normalizeServerConfigs(configData.mcp.servers);
314
- }
315
- if (configData.mcpServers && typeof configData.mcpServers === "object") {
316
- return this.normalizeServerConfigs(configData.mcpServers);
317
- }
318
- if (configData.context_servers && typeof configData.context_servers === "object") {
319
- return this.normalizeServerConfigs(configData.context_servers);
320
- }
321
- return {};
322
- }
323
- /**
324
- * Normalize server configurations to ensure consistent structure
325
- */
326
- normalizeServerConfigs(servers) {
327
- const normalized = {};
328
- for (const [serverName, serverConfig] of Object.entries(servers)) {
329
- if (serverConfig && typeof serverConfig === "object") {
330
- const env = serverConfig.env && typeof serverConfig.env === "object" ? serverConfig.env : void 0;
331
- normalized[serverName] = {
332
- name: serverName,
333
- command: serverConfig.command || "",
334
- args: Array.isArray(serverConfig.args) ? serverConfig.args : void 0,
335
- type: this.validateType(serverConfig.type) ? serverConfig.type : this.inferTransportType(serverConfig),
336
- url: serverConfig.url,
337
- env
338
- };
339
- }
340
- }
341
- return normalized;
342
- }
343
- /**
344
- * Validate type value
345
- */
346
- validateType(type) {
347
- return ["sse", "http", "stdio", "streamable-http"].includes(type);
348
- }
349
- /**
350
- * Infer transport type from server configuration when type field is not explicitly set
351
- */
352
- inferTransportType(serverConfig) {
353
- if (serverConfig.url && typeof serverConfig.url === "string") {
354
- return "http";
355
- }
356
- if (Array.isArray(serverConfig.args)) {
357
- const argsString = serverConfig.args.join(" ").toLowerCase();
358
- if (argsString.includes("stdio")) {
359
- return "stdio";
360
- }
361
- if (argsString.includes("http")) {
362
- return "http";
363
- }
364
- if (argsString.includes("sse")) {
365
- return "sse";
366
- }
367
- }
368
- if (serverConfig.command && typeof serverConfig.command === "string") {
369
- return "stdio";
370
- }
371
- return void 0;
372
- }
373
- /**
374
- * Validate server configuration
375
- */
376
- validateServerConfig(serverConfig) {
377
- if (!serverConfig || typeof serverConfig !== "object") {
378
- return false;
379
- }
380
- if (!serverConfig.name || typeof serverConfig.name !== "string") {
381
- return false;
382
- }
383
- if (!serverConfig.command || typeof serverConfig.command !== "string") {
384
- return false;
385
- }
386
- return true;
387
- }
388
- /**
389
- * Get supported configuration keys that the parser recognizes
390
- */
391
- getSupportedConfigKeys() {
392
- return ["servers", "mcp.servers", "mcpServers", "context_servers"];
393
- }
394
- /**
395
- * Check if the configuration file has valid syntax
396
- */
397
- async isValidSyntax() {
398
- try {
399
- const configData = await this.parseConfigFile();
400
- return configData.valid;
401
- } catch (error) {
402
- return false;
403
- }
404
- }
405
- /**
406
- * Count the number of MCP servers in the configuration
407
- */
408
- async countMCPServers() {
409
- try {
410
- const configData = await this.parseConfigFile();
411
- return Object.keys(configData.servers).length;
412
- } catch (error) {
413
- return 0;
414
- }
415
- }
416
- /**
417
- * Get the raw file content
418
- */
419
- async getFileContent() {
420
- if (this.fileContents) {
421
- return this.fileContents;
422
- }
423
- try {
424
- this.fileContents = await import_promises.default.readFile(this.filePath, "utf-8");
425
- return this.fileContents;
426
- } catch (error) {
427
- throw new Error(`Failed to read file: ${this.filePath}`);
428
- }
429
- }
430
- };
42
+ var import_node_util = __toESM(require("util"), 1);
43
+ var import_agent_files = require("agent-files");
431
44
 
432
45
  // src/services/credential-detection-service.ts
433
46
  var CredentialDetectionService = class {
@@ -710,77 +323,6 @@ var CredentialDetectionService = class {
710
323
  }
711
324
  };
712
325
 
713
- // src/services/directory-bubble-service.ts
714
- var import_node_path2 = __toESM(require("path"), 1);
715
- var import_promises2 = __toESM(require("fs/promises"), 1);
716
- var import_node_os = require("os");
717
- var DirectoryBubbleService = class {
718
- static {
719
- __name(this, "DirectoryBubbleService");
720
- }
721
- /**
722
- * Find a local MCP config file by bubbling up the directory tree
723
- * @param localPath - The relative path to search for (e.g., '.vscode/mcp.json')
724
- * @param startDir - The directory to start searching from
725
- * @returns The absolute path to the found config file, or null if not found
726
- */
727
- async findLocalConfigInParentDirectories(localPath, startDir) {
728
- try {
729
- let currentDir = import_node_path2.default.resolve(startDir);
730
- const homeDir = (0, import_node_os.homedir)();
731
- const rootDir = "/";
732
- let iterationCount = 0;
733
- const maxIterations = 100;
734
- const startDirResult = await this.checkDirectoryForConfig(currentDir, localPath);
735
- if (startDirResult) {
736
- return import_node_path2.default.join(currentDir, localPath);
737
- }
738
- while (currentDir !== homeDir && currentDir !== rootDir && iterationCount < maxIterations) {
739
- const parentDir = this.getParentDirectory(currentDir);
740
- if (!parentDir || parentDir === currentDir) {
741
- break;
742
- }
743
- if (parentDir === currentDir || parentDir.length >= currentDir.length) {
744
- break;
745
- }
746
- currentDir = parentDir;
747
- iterationCount++;
748
- const found = await this.checkDirectoryForConfig(currentDir, localPath);
749
- if (found) {
750
- return import_node_path2.default.join(currentDir, localPath);
751
- }
752
- }
753
- return null;
754
- } catch (error) {
755
- return null;
756
- }
757
- }
758
- /**
759
- * Check if a config file exists in the specified directory
760
- * @param dir - The directory to check
761
- * @param configPath - The relative path to the config file
762
- * @returns True if the config file exists and is accessible
763
- */
764
- async checkDirectoryForConfig(dir, configPath) {
765
- try {
766
- const fullPath = import_node_path2.default.join(dir, configPath);
767
- await import_promises2.default.access(fullPath);
768
- return true;
769
- } catch (error) {
770
- return false;
771
- }
772
- }
773
- /**
774
- * Get the parent directory of the specified directory
775
- * @param dir - The directory to get the parent of
776
- * @returns The parent directory path, or null if already at root
777
- */
778
- getParentDirectory(dir) {
779
- const parent = import_node_path2.default.dirname(dir);
780
- return parent === dir ? null : parent;
781
- }
782
- };
783
-
784
326
  // src/services/mcp-version-detection-service.ts
785
327
  var MCPVersionDetectionService = class {
786
328
  static {
@@ -959,10 +501,10 @@ var MCPConfigService = class {
959
501
  versionDetectionService;
960
502
  enableDirectoryBubbling;
961
503
  constructor(options = {}) {
962
- this.pathRegistry = new MCPPathRegistry();
963
- this.currentOS = (0, import_node_os2.platform)();
504
+ this.pathRegistry = new import_agent_files.MCPPathRegistry();
505
+ this.currentOS = (0, import_node_os.platform)();
964
506
  this.debug = import_node_util.default.debuglog("ls-mcp");
965
- this.directoryBubbleService = new DirectoryBubbleService();
507
+ this.directoryBubbleService = new import_agent_files.DirectoryBubbleService();
966
508
  this.versionDetectionService = new MCPVersionDetectionService();
967
509
  this.enableDirectoryBubbling = options.enableDirectoryBubbling ?? false;
968
510
  }
@@ -1049,7 +591,7 @@ var MCPConfigService = class {
1049
591
  */
1050
592
  async validateConfigFile(filePath) {
1051
593
  try {
1052
- await import_promises3.default.access(filePath);
594
+ await import_promises.default.access(filePath);
1053
595
  const parser = this.createParser(filePath);
1054
596
  return await parser.isValidSyntax();
1055
597
  } catch (error) {
@@ -1060,7 +602,7 @@ var MCPConfigService = class {
1060
602
  * Create a parser instance (can be overridden for testing)
1061
603
  */
1062
604
  createParser(filePath) {
1063
- return new MCPConfigParser(filePath);
605
+ return new import_agent_files.MCPConfigParser(filePath);
1064
606
  }
1065
607
  /**
1066
608
  * Get MCP file groups with resolved paths and server information
@@ -1069,7 +611,8 @@ var MCPConfigService = class {
1069
611
  try {
1070
612
  const appPaths = this.getAllConfigFiles();
1071
613
  const mcpFilesPathsData = {};
1072
- for (const [groupName, paths] of Object.entries(appPaths)) {
614
+ for (const groupName of Object.keys(appPaths)) {
615
+ const paths = appPaths[groupName];
1073
616
  mcpFilesPathsData[groupName] = {
1074
617
  name: groupName,
1075
618
  friendlyName: this.getFriendlyName(groupName),
@@ -1080,10 +623,10 @@ var MCPConfigService = class {
1080
623
  let totalServersCount = 0;
1081
624
  for (const filePathData of paths) {
1082
625
  let resolvedPath = filePathData.filePath.replace("~", process.env.HOME || "");
1083
- let absolutePath = import_node_path3.default.resolve(resolvedPath);
626
+ let absolutePath = import_node_path.default.resolve(resolvedPath);
1084
627
  if (filePathData.type === "local" && this.enableDirectoryBubbling) {
1085
628
  try {
1086
- await import_promises3.default.access(resolvedPath);
629
+ await import_promises.default.access(resolvedPath);
1087
630
  } catch (error) {
1088
631
  const bubbledPath = await this.directoryBubbleService.findLocalConfigInParentDirectories(
1089
632
  filePathData.filePath,
@@ -1091,7 +634,7 @@ var MCPConfigService = class {
1091
634
  );
1092
635
  if (bubbledPath) {
1093
636
  resolvedPath = bubbledPath;
1094
- absolutePath = import_node_path3.default.resolve(resolvedPath);
637
+ absolutePath = import_node_path.default.resolve(resolvedPath);
1095
638
  }
1096
639
  }
1097
640
  }
@@ -1100,7 +643,7 @@ var MCPConfigService = class {
1100
643
  }
1101
644
  uniqueFilePaths.add(absolutePath);
1102
645
  try {
1103
- await import_promises3.default.access(resolvedPath);
646
+ await import_promises.default.access(resolvedPath);
1104
647
  const parser = this.createParser(resolvedPath);
1105
648
  const parsable = await parser.isValidSyntax();
1106
649
  filePathData.parsable = parsable;
@@ -1124,6 +667,61 @@ var MCPConfigService = class {
1124
667
  throw new Error(`Failed to get MCP file groups: ${error instanceof Error ? error.message : "Unknown error"}`);
1125
668
  }
1126
669
  }
670
+ /**
671
+ * Parse custom configuration files provided by the user
672
+ * This method processes files independently of standard app-based discovery
673
+ */
674
+ async parseCustomFiles(filePaths) {
675
+ try {
676
+ const mcpFilesPathsData = {
677
+ custom: {
678
+ name: "custom",
679
+ friendlyName: "Custom Files",
680
+ paths: [],
681
+ stats: { serversCount: 0 }
682
+ }
683
+ };
684
+ let totalServersCount = 0;
685
+ for (const filePath of filePaths) {
686
+ const resolvedPath = filePath.replace("~", process.env.HOME || "");
687
+ const absolutePath = import_node_path.default.resolve(resolvedPath);
688
+ try {
689
+ await import_promises.default.access(absolutePath);
690
+ const parser = this.createParser(absolutePath);
691
+ const parsable = await parser.isValidSyntax();
692
+ const filePathData = {
693
+ filePath: absolutePath,
694
+ type: "local",
695
+ parsable
696
+ };
697
+ if (parsable) {
698
+ const configData = await parser.parseConfigFile();
699
+ const servers = await this.convertToMCPServerInfo(configData.servers || {});
700
+ filePathData.servers = servers;
701
+ totalServersCount += servers.length;
702
+ } else {
703
+ this.debug(`File ${absolutePath} has invalid syntax`);
704
+ filePathData.servers = [];
705
+ }
706
+ mcpFilesPathsData.custom.paths.push(filePathData);
707
+ } catch (error) {
708
+ this.debug(`Skipping file ${absolutePath}: ${error instanceof Error ? error.message : "Unknown error"}`);
709
+ mcpFilesPathsData.custom.paths.push({
710
+ filePath: absolutePath,
711
+ type: "local",
712
+ parsable: false,
713
+ servers: []
714
+ });
715
+ }
716
+ }
717
+ if (mcpFilesPathsData.custom.stats) {
718
+ mcpFilesPathsData.custom.stats.serversCount = totalServersCount;
719
+ }
720
+ return mcpFilesPathsData;
721
+ } catch (error) {
722
+ throw new Error(`Failed to parse custom files: ${error instanceof Error ? error.message : "Unknown error"}`);
723
+ }
724
+ }
1127
725
  /**
1128
726
  * Register a custom app with custom paths for the current OS
1129
727
  */
@@ -1209,9 +807,9 @@ var MCPConfigService = class {
1209
807
  };
1210
808
 
1211
809
  // src/services/mcp-server-manager-service.ts
1212
- var import_node_path4 = __toESM(require("path"), 1);
810
+ var import_node_path2 = __toESM(require("path"), 1);
1213
811
  var import_node_child_process = require("child_process");
1214
- var import_node_os3 = require("os");
812
+ var import_node_os2 = require("os");
1215
813
  var MCPServerManagerService = class {
1216
814
  static {
1217
815
  __name(this, "MCPServerManagerService");
@@ -1267,7 +865,7 @@ var MCPServerManagerService = class {
1267
865
  isRunning() {
1268
866
  try {
1269
867
  let psOutput;
1270
- if ((0, import_node_os3.platform)() === "win32") {
868
+ if ((0, import_node_os2.platform)() === "win32") {
1271
869
  psOutput = (0, import_node_child_process.execSync)('powershell -Command "Get-CimInstance -ClassName Win32_Process | Select-Object ProcessId,Name,CommandLine,ParentProcessId | ConvertTo-Csv -NoTypeInformation"', {
1272
870
  encoding: "utf8",
1273
871
  timeout: 5e3
@@ -1285,7 +883,7 @@ var MCPServerManagerService = class {
1285
883
  let pid;
1286
884
  let ppid;
1287
885
  let commandLine;
1288
- if ((0, import_node_os3.platform)() === "win32") {
886
+ if ((0, import_node_os2.platform)() === "win32") {
1289
887
  if (processLine.startsWith('"ProcessId"') || processLine.startsWith("ProcessId")) continue;
1290
888
  const parts = this.parseCSVLine(processLine);
1291
889
  if (parts.length < 4) continue;
@@ -1308,7 +906,7 @@ var MCPServerManagerService = class {
1308
906
  for (const [pid, processData] of processMap) {
1309
907
  const commandMatchLinux = this.isCommandMatch(processData.commandTokens, pid, processData.ppid);
1310
908
  let commandMatchWin32 = false;
1311
- if ((0, import_node_os3.platform)() === "win32") {
909
+ if ((0, import_node_os2.platform)() === "win32") {
1312
910
  let commandTokensOnWin32 = processData.commandTokens;
1313
911
  if (commandTokensOnWin32.length > 0 && commandTokensOnWin32[0].toLowerCase().startsWith("cmd")) {
1314
912
  commandTokensOnWin32 = commandTokensOnWin32.slice(1);
@@ -1419,9 +1017,9 @@ var MCPServerManagerService = class {
1419
1017
  return true;
1420
1018
  }
1421
1019
  getBaseCommand(fullCommandPath) {
1422
- let baseCommand = import_node_path4.default.basename(fullCommandPath);
1423
- if ((0, import_node_os3.platform)() === "win32") {
1424
- baseCommand = import_node_path4.default.basename(fullCommandPath, ".exe");
1020
+ let baseCommand = import_node_path2.default.basename(fullCommandPath);
1021
+ if ((0, import_node_os2.platform)() === "win32") {
1022
+ baseCommand = import_node_path2.default.basename(fullCommandPath, ".exe");
1425
1023
  }
1426
1024
  baseCommand = baseCommand.toLowerCase();
1427
1025
  return baseCommand;
@@ -1608,14 +1206,47 @@ var MCPFiles = class {
1608
1206
  __name(this, "MCPFiles");
1609
1207
  }
1610
1208
  mcpConfigService;
1611
- constructor() {
1209
+ customFiles;
1210
+ constructor(customFiles) {
1612
1211
  this.mcpConfigService = new MCPConfigService({ enableDirectoryBubbling: true });
1212
+ this.customFiles = customFiles;
1613
1213
  }
1614
1214
  /**
1615
1215
  * Find and process all MCP configuration files
1216
+ * If customFiles are provided, only those files are processed (replaces automatic discovery)
1616
1217
  */
1617
1218
  async findFiles() {
1618
1219
  try {
1220
+ if (this.customFiles && this.customFiles.length > 0) {
1221
+ const mcpFilesPathsData2 = await this.mcpConfigService.parseCustomFiles(this.customFiles);
1222
+ for (const groupName of Object.keys(mcpFilesPathsData2)) {
1223
+ const group = mcpFilesPathsData2[groupName];
1224
+ for (const filePathData of group.paths) {
1225
+ if (filePathData.servers && filePathData.servers.length > 0) {
1226
+ for (const server of filePathData.servers) {
1227
+ const serverConfig = {
1228
+ name: server.name,
1229
+ command: server.command,
1230
+ args: server.args,
1231
+ transport: server.transport,
1232
+ type: server.type,
1233
+ env: server.env
1234
+ };
1235
+ const serverManager = new MCPServerManagerService(serverConfig);
1236
+ const processDetection = serverManager.isRunning();
1237
+ let isRunning = false;
1238
+ if (processDetection) {
1239
+ if (typeof processDetection === "object" && processDetection.estimatedProduct === group.name) {
1240
+ isRunning = true;
1241
+ }
1242
+ }
1243
+ server.status = isRunning ? "running" : "stopped";
1244
+ }
1245
+ }
1246
+ }
1247
+ }
1248
+ return mcpFilesPathsData2;
1249
+ }
1619
1250
  const mcpFilesPathsData = await this.mcpConfigService.getMCPFileGroups();
1620
1251
  for (const groupName of Object.keys(mcpFilesPathsData)) {
1621
1252
  const group = mcpFilesPathsData[groupName];