ls-mcp 1.3.1 → 1.5.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
@@ -35,6 +35,8 @@ __export(main_exports, {
35
35
  });
36
36
  module.exports = __toCommonJS(main_exports);
37
37
  var import_promises2 = __toESM(require("fs/promises"), 1);
38
+ var import_node_os2 = require("os");
39
+ var import_node_path2 = __toESM(require("path"), 1);
38
40
 
39
41
  // src/services/mcp-config-linter-service.ts
40
42
  var import_promises = __toESM(require("fs/promises"), 1);
@@ -63,8 +65,16 @@ var MCPConfigLinterService = class {
63
65
  async getMCPServers() {
64
66
  const fileContentRaw = await this.getFileContent();
65
67
  const fileContentsData = JSON.parse(fileContentRaw);
66
- const mcpServers = fileContentsData?.mcpServers;
67
- return mcpServers;
68
+ if (fileContentsData?.servers) {
69
+ return fileContentsData.servers;
70
+ }
71
+ if (fileContentsData?.mcp?.servers) {
72
+ return fileContentsData.mcp.servers;
73
+ }
74
+ if (fileContentsData?.mcpServers) {
75
+ return fileContentsData.mcpServers;
76
+ }
77
+ return {};
68
78
  }
69
79
  async getFileContent() {
70
80
  if (this.fileContents) {
@@ -76,6 +86,7 @@ var MCPConfigLinterService = class {
76
86
  };
77
87
 
78
88
  // src/services/mcp-server-manager-service.ts
89
+ var import_node_path = __toESM(require("path"), 1);
79
90
  var import_node_child_process = require("child_process");
80
91
  var import_node_os = require("os");
81
92
  var MCPServerManagerService = class {
@@ -135,15 +146,15 @@ var MCPServerManagerService = class {
135
146
  if (processLine.startsWith('"ProcessId"') || processLine.startsWith("ProcessId")) continue;
136
147
  const parts = this.parseCSVLine(processLine);
137
148
  if (parts.length < 4) continue;
138
- pid = parts[0] || "";
139
- commandLine = parts[2] || "";
140
- ppid = parts[3] || "";
149
+ pid = parts[0].trim() || "";
150
+ commandLine = parts[2].trim() || "";
151
+ ppid = parts[3].trim() || "";
141
152
  } else {
142
153
  const match = processLine.trim().match(/^\s*(\d+)\s+(\d+)\s+(.+)$/);
143
154
  if (!match) continue;
144
- pid = match[1];
145
- ppid = match[2];
146
- commandLine = match[3];
155
+ pid = match[1].trim() || "";
156
+ ppid = match[2].trim() || "";
157
+ commandLine = match[3].trim() || "";
147
158
  }
148
159
  const commandTokens = this.parseCommandLine(commandLine);
149
160
  if (commandTokens.length > 0) {
@@ -152,7 +163,20 @@ var MCPServerManagerService = class {
152
163
  }
153
164
  let mcpServerDetection;
154
165
  for (const [pid, processData] of processMap) {
155
- if (this.isCommandMatch(processData.commandTokens, pid, processData.ppid)) {
166
+ const commandMatchLinux = this.isCommandMatch(processData.commandTokens, pid, processData.ppid);
167
+ let commandMatchWin32 = false;
168
+ if ((0, import_node_os.platform)() === "win32") {
169
+ let commandTokensOnWin32 = processData.commandTokens;
170
+ if (commandTokensOnWin32.length > 0 && commandTokensOnWin32[0].toLowerCase().startsWith("cmd")) {
171
+ commandTokensOnWin32 = commandTokensOnWin32.slice(1);
172
+ while (commandTokensOnWin32.length > 0 && commandTokensOnWin32[0].startsWith("/")) {
173
+ commandTokensOnWin32 = commandTokensOnWin32.slice(1);
174
+ }
175
+ }
176
+ commandMatchWin32 = this.isCommandMatch(commandTokensOnWin32, pid, processData.ppid);
177
+ }
178
+ const commandMatch = commandMatchLinux || commandMatchWin32;
179
+ if (commandMatch) {
156
180
  mcpServerDetection = {
157
181
  pid,
158
182
  commandLine: processData.commandTokens.join(" "),
@@ -199,13 +223,14 @@ var MCPServerManagerService = class {
199
223
  isCommandMatch(commandTokens, pid, ppid) {
200
224
  if (commandTokens.length === 0) return false;
201
225
  const baseCommand = this.getBaseCommand(commandTokens[0]);
202
- if (this.command === "uvx" && baseCommand === "uv") {
226
+ const commandInConfig = this.getBaseCommand(this.command);
227
+ if (commandInConfig === "uvx" && baseCommand === "uv") {
203
228
  return this.matchUvxProcess(commandTokens);
204
229
  }
205
- if (this.command === "npx" && baseCommand === "npm") {
230
+ if (commandInConfig === "npx" && baseCommand === "npm") {
206
231
  return this.matchNpxProcess(commandTokens);
207
232
  }
208
- if (this.command === "uv" && baseCommand === "uv") {
233
+ if (commandInConfig === "uv" && baseCommand === "uv") {
209
234
  return this.matchGenericArgsToArgs(commandTokens);
210
235
  }
211
236
  const commandConfigPythonBase = this.getBaseCommand(this.command);
@@ -230,19 +255,21 @@ var MCPServerManagerService = class {
230
255
  const commandWithoutArgs = commandTokens.slice(1);
231
256
  for (let i = 0; i < this.args.length; i++) {
232
257
  if (i >= commandWithoutArgs.length) return false;
233
- const arg = this.args[i];
234
- const token = commandWithoutArgs[i];
258
+ const arg = this.args[i].toLowerCase();
259
+ const token = commandWithoutArgs[i].toLowerCase();
235
260
  if (arg !== token && !token.includes(arg)) {
236
261
  return false;
237
262
  }
238
263
  }
239
264
  return true;
240
265
  }
241
- // @TODO refactor this to use path.basename or similar
242
- // to extract the base command from the full command path
243
266
  getBaseCommand(fullCommandPath) {
244
- const parts = fullCommandPath.split(/[/\\]/);
245
- return parts[parts.length - 1];
267
+ let baseCommand = import_node_path.default.basename(fullCommandPath);
268
+ if ((0, import_node_os.platform)() === "win32") {
269
+ baseCommand = import_node_path.default.basename(fullCommandPath, ".exe");
270
+ }
271
+ baseCommand = baseCommand.toLowerCase();
272
+ return baseCommand;
246
273
  }
247
274
  /*
248
275
  example1:
@@ -321,8 +348,9 @@ var MCPServerManagerService = class {
321
348
  }
322
349
  findMcpServerNameInProcessArguments(commandTokens, mcpServerName) {
323
350
  for (let i = 0; i < commandTokens.length; i++) {
324
- const token = commandTokens[i];
325
- if (mcpServerName === token || token.includes(mcpServerName)) {
351
+ const token = commandTokens[i].toLowerCase();
352
+ const normalizedMcpServerName = mcpServerName.toLowerCase();
353
+ if (normalizedMcpServerName === token || token.includes(normalizedMcpServerName)) {
326
354
  return true;
327
355
  }
328
356
  }
@@ -409,8 +437,8 @@ var MCPServerManagerService = class {
409
437
  return false;
410
438
  }
411
439
  for (let i = 0; i < argsToMatch.length; i++) {
412
- const commandToken = commandTokens[i + 2];
413
- const expectedArg = argsToMatch[i];
440
+ const commandToken = commandTokens[i + 2].toLowerCase();
441
+ const expectedArg = argsToMatch[i].toLowerCase();
414
442
  if (commandToken !== expectedArg) {
415
443
  return false;
416
444
  }
@@ -420,6 +448,63 @@ var MCPServerManagerService = class {
420
448
  };
421
449
 
422
450
  // src/main.ts
451
+ var osSpecificPaths = {
452
+ claude: [],
453
+ cursor: [],
454
+ vscode: [],
455
+ cline: [],
456
+ windsurf: [],
457
+ roo: []
458
+ };
459
+ if ((0, import_node_os2.platform)() === "win32") {
460
+ osSpecificPaths["claude"] = [
461
+ { filePath: `${process.env.APPDATA}\\Claude\\claude_desktop_config.json`, type: "global" }
462
+ ];
463
+ osSpecificPaths["cursor"] = [
464
+ { filePath: `${process.env.HOME}\\.cursor\\mcp.json`, type: "global" },
465
+ { filePath: ".cursor\\mcp.json", type: "local" }
466
+ ];
467
+ osSpecificPaths["vscode"] = [
468
+ { filePath: ".vscode\\mcp.json", type: "local" },
469
+ { filePath: `${process.env.APPDATA}\\Code\\User\\settings.json`, type: "global" },
470
+ { filePath: `${process.env.APPDATA}\\Code - Insiders\\User\\settings.json`, type: "global" }
471
+ ];
472
+ osSpecificPaths["cline"] = [
473
+ { filePath: `${process.env.APPDATA}\\Code\\User\\globalStorage\\saoudrizwan.claude-dev\\settings\\cline_mcp_settings.json`, type: "global" },
474
+ { filePath: `${process.env.APPDATA}\\Code - Insiders\\User\\globalStorage\\saoudrizwan.claude-dev\\settings\\cline_mcp_settings.json`, type: "global" }
475
+ ];
476
+ osSpecificPaths["windsurf"] = [
477
+ { filePath: ".codeium\\windsurf\\mcp_config.json", type: "local" }
478
+ ];
479
+ osSpecificPaths["roo"] = [
480
+ { filePath: `${process.env.APPDATA}\\Code\\User\\globalStorage\\rooveterinaryinc.roo-cline\\settings\\cline_mcp_settings.json`, type: "global" },
481
+ { filePath: `${process.env.APPDATA}\\Code - Insiders\\User\\globalStorage\\rooveterinaryinc.roo-cline\\settings\\cline_mcp_settings.json`, type: "global" }
482
+ ];
483
+ } else {
484
+ osSpecificPaths["claude"] = [
485
+ { filePath: "~/Library/Application Support/Claude/claude_desktop_config.json", type: "global" }
486
+ ];
487
+ osSpecificPaths["cursor"] = [
488
+ { filePath: "~/.cursor/mcp.json", type: "global" },
489
+ { filePath: ".cursor/mcp.json", type: "local" }
490
+ ];
491
+ osSpecificPaths["vscode"] = [
492
+ { filePath: ".vscode/mcp.json", type: "local" },
493
+ { filePath: "~/Library/Application Support/Code/User/settings.json", type: "global" },
494
+ { filePath: "~/Library/Application Support/Code - Insiders/User/settings.json", type: "global" }
495
+ ];
496
+ osSpecificPaths["cline"] = [
497
+ { filePath: "~/Library/Application Support/Code/User/globalStorage/saoudrizwan.claude-dev/settings/cline_mcp_settings.json", type: "global" },
498
+ { filePath: "~/Library/Application Support/Code - Insiders/User/globalStorage/saoudrizwan.claude-dev/settings/cline_mcp_settings.json", type: "global" }
499
+ ];
500
+ osSpecificPaths["windsurf"] = [
501
+ { filePath: ".codeium/windsurf/mcp_config.json", type: "local" }
502
+ ];
503
+ osSpecificPaths["roo"] = [
504
+ { filePath: "~/Library/Application Support/Code/User/globalStorage/rooveterinaryinc.roo-cline/settings/cline_mcp_settings.json", type: "global" },
505
+ { filePath: "~/Library/Application Support/Code - Insiders/User/globalStorage/rooveterinaryinc.roo-cline/settings/cline_mcp_settings.json", type: "global" }
506
+ ];
507
+ }
423
508
  var MCPFiles = class {
424
509
  static {
425
510
  __name(this, "MCPFiles");
@@ -428,17 +513,32 @@ var MCPFiles = class {
428
513
  claude: {
429
514
  name: "claude-desktop",
430
515
  friendlyName: "Claude Desktop",
431
- paths: [
432
- { filePath: "~/Library/Application Support/Claude/claude_desktop_config.json", type: "global" }
433
- ]
516
+ paths: osSpecificPaths["claude"]
434
517
  },
435
518
  cursor: {
436
519
  name: "cursor",
437
520
  friendlyName: "Cursor",
438
- paths: [
439
- { filePath: "~/.cursor/mcp.json", type: "global" },
440
- { filePath: ".cursor/mcp.json", type: "local" }
441
- ]
521
+ paths: osSpecificPaths["cursor"]
522
+ },
523
+ vscode: {
524
+ name: "vscode",
525
+ friendlyName: "VS Code",
526
+ paths: osSpecificPaths["vscode"]
527
+ },
528
+ cline: {
529
+ name: "cline",
530
+ friendlyName: "Cline",
531
+ paths: osSpecificPaths["cline"]
532
+ },
533
+ windsurf: {
534
+ name: "windsurf",
535
+ friendlyName: "Windsurf",
536
+ paths: osSpecificPaths["windsurf"]
537
+ },
538
+ roo: {
539
+ name: "roo",
540
+ friendlyName: "Roo",
541
+ paths: osSpecificPaths["roo"]
442
542
  }
443
543
  };
444
544
  constructor(mcpFilePathGroups) {
@@ -454,8 +554,14 @@ var MCPFiles = class {
454
554
  paths: [],
455
555
  stats: {}
456
556
  };
557
+ const uniqueFilePaths = /* @__PURE__ */ new Set();
457
558
  for (const filePathData of clientsGroup.paths) {
458
559
  const resolvedPath = filePathData.filePath.replace("~", process.env.HOME || "");
560
+ const absolutePath = import_node_path2.default.resolve(resolvedPath);
561
+ if (uniqueFilePaths.has(absolutePath)) {
562
+ continue;
563
+ }
564
+ uniqueFilePaths.add(absolutePath);
459
565
  try {
460
566
  await import_promises2.default.access(resolvedPath);
461
567
  const MCPConfigLinter = new MCPConfigLinterService(resolvedPath);
package/dist/main.mjs CHANGED
@@ -3,6 +3,8 @@ var __name = (target, value) => __defProp(target, "name", { value, configurable:
3
3
 
4
4
  // src/main.ts
5
5
  import fs2 from "fs/promises";
6
+ import { platform as platform2 } from "os";
7
+ import path2 from "path";
6
8
 
7
9
  // src/services/mcp-config-linter-service.ts
8
10
  import fs from "fs/promises";
@@ -31,8 +33,16 @@ var MCPConfigLinterService = class {
31
33
  async getMCPServers() {
32
34
  const fileContentRaw = await this.getFileContent();
33
35
  const fileContentsData = JSON.parse(fileContentRaw);
34
- const mcpServers = fileContentsData?.mcpServers;
35
- return mcpServers;
36
+ if (fileContentsData?.servers) {
37
+ return fileContentsData.servers;
38
+ }
39
+ if (fileContentsData?.mcp?.servers) {
40
+ return fileContentsData.mcp.servers;
41
+ }
42
+ if (fileContentsData?.mcpServers) {
43
+ return fileContentsData.mcpServers;
44
+ }
45
+ return {};
36
46
  }
37
47
  async getFileContent() {
38
48
  if (this.fileContents) {
@@ -44,6 +54,7 @@ var MCPConfigLinterService = class {
44
54
  };
45
55
 
46
56
  // src/services/mcp-server-manager-service.ts
57
+ import path from "path";
47
58
  import { execSync } from "child_process";
48
59
  import { platform } from "os";
49
60
  var MCPServerManagerService = class {
@@ -103,15 +114,15 @@ var MCPServerManagerService = class {
103
114
  if (processLine.startsWith('"ProcessId"') || processLine.startsWith("ProcessId")) continue;
104
115
  const parts = this.parseCSVLine(processLine);
105
116
  if (parts.length < 4) continue;
106
- pid = parts[0] || "";
107
- commandLine = parts[2] || "";
108
- ppid = parts[3] || "";
117
+ pid = parts[0].trim() || "";
118
+ commandLine = parts[2].trim() || "";
119
+ ppid = parts[3].trim() || "";
109
120
  } else {
110
121
  const match = processLine.trim().match(/^\s*(\d+)\s+(\d+)\s+(.+)$/);
111
122
  if (!match) continue;
112
- pid = match[1];
113
- ppid = match[2];
114
- commandLine = match[3];
123
+ pid = match[1].trim() || "";
124
+ ppid = match[2].trim() || "";
125
+ commandLine = match[3].trim() || "";
115
126
  }
116
127
  const commandTokens = this.parseCommandLine(commandLine);
117
128
  if (commandTokens.length > 0) {
@@ -120,7 +131,20 @@ var MCPServerManagerService = class {
120
131
  }
121
132
  let mcpServerDetection;
122
133
  for (const [pid, processData] of processMap) {
123
- if (this.isCommandMatch(processData.commandTokens, pid, processData.ppid)) {
134
+ const commandMatchLinux = this.isCommandMatch(processData.commandTokens, pid, processData.ppid);
135
+ let commandMatchWin32 = false;
136
+ if (platform() === "win32") {
137
+ let commandTokensOnWin32 = processData.commandTokens;
138
+ if (commandTokensOnWin32.length > 0 && commandTokensOnWin32[0].toLowerCase().startsWith("cmd")) {
139
+ commandTokensOnWin32 = commandTokensOnWin32.slice(1);
140
+ while (commandTokensOnWin32.length > 0 && commandTokensOnWin32[0].startsWith("/")) {
141
+ commandTokensOnWin32 = commandTokensOnWin32.slice(1);
142
+ }
143
+ }
144
+ commandMatchWin32 = this.isCommandMatch(commandTokensOnWin32, pid, processData.ppid);
145
+ }
146
+ const commandMatch = commandMatchLinux || commandMatchWin32;
147
+ if (commandMatch) {
124
148
  mcpServerDetection = {
125
149
  pid,
126
150
  commandLine: processData.commandTokens.join(" "),
@@ -167,13 +191,14 @@ var MCPServerManagerService = class {
167
191
  isCommandMatch(commandTokens, pid, ppid) {
168
192
  if (commandTokens.length === 0) return false;
169
193
  const baseCommand = this.getBaseCommand(commandTokens[0]);
170
- if (this.command === "uvx" && baseCommand === "uv") {
194
+ const commandInConfig = this.getBaseCommand(this.command);
195
+ if (commandInConfig === "uvx" && baseCommand === "uv") {
171
196
  return this.matchUvxProcess(commandTokens);
172
197
  }
173
- if (this.command === "npx" && baseCommand === "npm") {
198
+ if (commandInConfig === "npx" && baseCommand === "npm") {
174
199
  return this.matchNpxProcess(commandTokens);
175
200
  }
176
- if (this.command === "uv" && baseCommand === "uv") {
201
+ if (commandInConfig === "uv" && baseCommand === "uv") {
177
202
  return this.matchGenericArgsToArgs(commandTokens);
178
203
  }
179
204
  const commandConfigPythonBase = this.getBaseCommand(this.command);
@@ -198,19 +223,21 @@ var MCPServerManagerService = class {
198
223
  const commandWithoutArgs = commandTokens.slice(1);
199
224
  for (let i = 0; i < this.args.length; i++) {
200
225
  if (i >= commandWithoutArgs.length) return false;
201
- const arg = this.args[i];
202
- const token = commandWithoutArgs[i];
226
+ const arg = this.args[i].toLowerCase();
227
+ const token = commandWithoutArgs[i].toLowerCase();
203
228
  if (arg !== token && !token.includes(arg)) {
204
229
  return false;
205
230
  }
206
231
  }
207
232
  return true;
208
233
  }
209
- // @TODO refactor this to use path.basename or similar
210
- // to extract the base command from the full command path
211
234
  getBaseCommand(fullCommandPath) {
212
- const parts = fullCommandPath.split(/[/\\]/);
213
- return parts[parts.length - 1];
235
+ let baseCommand = path.basename(fullCommandPath);
236
+ if (platform() === "win32") {
237
+ baseCommand = path.basename(fullCommandPath, ".exe");
238
+ }
239
+ baseCommand = baseCommand.toLowerCase();
240
+ return baseCommand;
214
241
  }
215
242
  /*
216
243
  example1:
@@ -289,8 +316,9 @@ var MCPServerManagerService = class {
289
316
  }
290
317
  findMcpServerNameInProcessArguments(commandTokens, mcpServerName) {
291
318
  for (let i = 0; i < commandTokens.length; i++) {
292
- const token = commandTokens[i];
293
- if (mcpServerName === token || token.includes(mcpServerName)) {
319
+ const token = commandTokens[i].toLowerCase();
320
+ const normalizedMcpServerName = mcpServerName.toLowerCase();
321
+ if (normalizedMcpServerName === token || token.includes(normalizedMcpServerName)) {
294
322
  return true;
295
323
  }
296
324
  }
@@ -377,8 +405,8 @@ var MCPServerManagerService = class {
377
405
  return false;
378
406
  }
379
407
  for (let i = 0; i < argsToMatch.length; i++) {
380
- const commandToken = commandTokens[i + 2];
381
- const expectedArg = argsToMatch[i];
408
+ const commandToken = commandTokens[i + 2].toLowerCase();
409
+ const expectedArg = argsToMatch[i].toLowerCase();
382
410
  if (commandToken !== expectedArg) {
383
411
  return false;
384
412
  }
@@ -388,6 +416,63 @@ var MCPServerManagerService = class {
388
416
  };
389
417
 
390
418
  // src/main.ts
419
+ var osSpecificPaths = {
420
+ claude: [],
421
+ cursor: [],
422
+ vscode: [],
423
+ cline: [],
424
+ windsurf: [],
425
+ roo: []
426
+ };
427
+ if (platform2() === "win32") {
428
+ osSpecificPaths["claude"] = [
429
+ { filePath: `${process.env.APPDATA}\\Claude\\claude_desktop_config.json`, type: "global" }
430
+ ];
431
+ osSpecificPaths["cursor"] = [
432
+ { filePath: `${process.env.HOME}\\.cursor\\mcp.json`, type: "global" },
433
+ { filePath: ".cursor\\mcp.json", type: "local" }
434
+ ];
435
+ osSpecificPaths["vscode"] = [
436
+ { filePath: ".vscode\\mcp.json", type: "local" },
437
+ { filePath: `${process.env.APPDATA}\\Code\\User\\settings.json`, type: "global" },
438
+ { filePath: `${process.env.APPDATA}\\Code - Insiders\\User\\settings.json`, type: "global" }
439
+ ];
440
+ osSpecificPaths["cline"] = [
441
+ { filePath: `${process.env.APPDATA}\\Code\\User\\globalStorage\\saoudrizwan.claude-dev\\settings\\cline_mcp_settings.json`, type: "global" },
442
+ { filePath: `${process.env.APPDATA}\\Code - Insiders\\User\\globalStorage\\saoudrizwan.claude-dev\\settings\\cline_mcp_settings.json`, type: "global" }
443
+ ];
444
+ osSpecificPaths["windsurf"] = [
445
+ { filePath: ".codeium\\windsurf\\mcp_config.json", type: "local" }
446
+ ];
447
+ osSpecificPaths["roo"] = [
448
+ { filePath: `${process.env.APPDATA}\\Code\\User\\globalStorage\\rooveterinaryinc.roo-cline\\settings\\cline_mcp_settings.json`, type: "global" },
449
+ { filePath: `${process.env.APPDATA}\\Code - Insiders\\User\\globalStorage\\rooveterinaryinc.roo-cline\\settings\\cline_mcp_settings.json`, type: "global" }
450
+ ];
451
+ } else {
452
+ osSpecificPaths["claude"] = [
453
+ { filePath: "~/Library/Application Support/Claude/claude_desktop_config.json", type: "global" }
454
+ ];
455
+ osSpecificPaths["cursor"] = [
456
+ { filePath: "~/.cursor/mcp.json", type: "global" },
457
+ { filePath: ".cursor/mcp.json", type: "local" }
458
+ ];
459
+ osSpecificPaths["vscode"] = [
460
+ { filePath: ".vscode/mcp.json", type: "local" },
461
+ { filePath: "~/Library/Application Support/Code/User/settings.json", type: "global" },
462
+ { filePath: "~/Library/Application Support/Code - Insiders/User/settings.json", type: "global" }
463
+ ];
464
+ osSpecificPaths["cline"] = [
465
+ { filePath: "~/Library/Application Support/Code/User/globalStorage/saoudrizwan.claude-dev/settings/cline_mcp_settings.json", type: "global" },
466
+ { filePath: "~/Library/Application Support/Code - Insiders/User/globalStorage/saoudrizwan.claude-dev/settings/cline_mcp_settings.json", type: "global" }
467
+ ];
468
+ osSpecificPaths["windsurf"] = [
469
+ { filePath: ".codeium/windsurf/mcp_config.json", type: "local" }
470
+ ];
471
+ osSpecificPaths["roo"] = [
472
+ { filePath: "~/Library/Application Support/Code/User/globalStorage/rooveterinaryinc.roo-cline/settings/cline_mcp_settings.json", type: "global" },
473
+ { filePath: "~/Library/Application Support/Code - Insiders/User/globalStorage/rooveterinaryinc.roo-cline/settings/cline_mcp_settings.json", type: "global" }
474
+ ];
475
+ }
391
476
  var MCPFiles = class {
392
477
  static {
393
478
  __name(this, "MCPFiles");
@@ -396,17 +481,32 @@ var MCPFiles = class {
396
481
  claude: {
397
482
  name: "claude-desktop",
398
483
  friendlyName: "Claude Desktop",
399
- paths: [
400
- { filePath: "~/Library/Application Support/Claude/claude_desktop_config.json", type: "global" }
401
- ]
484
+ paths: osSpecificPaths["claude"]
402
485
  },
403
486
  cursor: {
404
487
  name: "cursor",
405
488
  friendlyName: "Cursor",
406
- paths: [
407
- { filePath: "~/.cursor/mcp.json", type: "global" },
408
- { filePath: ".cursor/mcp.json", type: "local" }
409
- ]
489
+ paths: osSpecificPaths["cursor"]
490
+ },
491
+ vscode: {
492
+ name: "vscode",
493
+ friendlyName: "VS Code",
494
+ paths: osSpecificPaths["vscode"]
495
+ },
496
+ cline: {
497
+ name: "cline",
498
+ friendlyName: "Cline",
499
+ paths: osSpecificPaths["cline"]
500
+ },
501
+ windsurf: {
502
+ name: "windsurf",
503
+ friendlyName: "Windsurf",
504
+ paths: osSpecificPaths["windsurf"]
505
+ },
506
+ roo: {
507
+ name: "roo",
508
+ friendlyName: "Roo",
509
+ paths: osSpecificPaths["roo"]
410
510
  }
411
511
  };
412
512
  constructor(mcpFilePathGroups) {
@@ -422,8 +522,14 @@ var MCPFiles = class {
422
522
  paths: [],
423
523
  stats: {}
424
524
  };
525
+ const uniqueFilePaths = /* @__PURE__ */ new Set();
425
526
  for (const filePathData of clientsGroup.paths) {
426
527
  const resolvedPath = filePathData.filePath.replace("~", process.env.HOME || "");
528
+ const absolutePath = path2.resolve(resolvedPath);
529
+ if (uniqueFilePaths.has(absolutePath)) {
530
+ continue;
531
+ }
532
+ uniqueFilePaths.add(absolutePath);
427
533
  try {
428
534
  await fs2.access(resolvedPath);
429
535
  const MCPConfigLinter = new MCPConfigLinterService(resolvedPath);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ls-mcp",
3
- "version": "1.3.1",
3
+ "version": "1.5.0",
4
4
  "description": "list and detect MCP servers and configurations",
5
5
  "types": "dist/main.d.ts",
6
6
  "type": "module",
package/src/bin/cli.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
 
3
3
  // import { debuglog } from 'node:util'
4
+ import { styleText } from 'node:util'
4
5
  import { MCPFiles } from '../main.ts'
5
6
  import { RenderService } from '../services/render-service.ts'
6
7
 
@@ -13,26 +14,26 @@ interface MCPServerInfo {
13
14
  status?: 'running' | 'stopped'
14
15
  }
15
16
 
16
- // Start the CLI with a new line for better readability
17
- console.log()
18
-
19
17
  // @TODO add debug logging
20
18
  // const debug = debuglog('ls-mcp')
21
19
 
22
20
  async function init () {
21
+ // Start the CLI with a new line for better readability
22
+ console.log()
23
+ console.log('[+] Detecting MCP Server configurations...')
24
+
23
25
  const mcpFilesManager = new MCPFiles()
24
26
  const mcpFilesList = await mcpFilesManager.findFiles()
25
27
 
26
28
  if (Object.keys(mcpFilesList).length === 0) {
27
- console.log('No MCP files found.')
28
- return
29
+ exitWithError('No configuration for MCP Server applications found.')
29
30
  }
30
31
 
31
32
  let pathIndex = 0
32
33
  for (const groupName of Object.keys(mcpFilesList)) {
33
34
  const group = mcpFilesList[groupName]
34
35
 
35
- if (group.paths.length >= 0) {
36
+ if (group.paths.length > 0) {
36
37
  // handle file path list of MCP Servers
37
38
  for (const filePathData of group.paths) {
38
39
  pathIndex++
@@ -60,12 +61,19 @@ async function init () {
60
61
  RenderService.printMcpGroup(pathIndex, mcpGroupData, groupMetadata)
61
62
  RenderService.printMcpServers(mcpServers)
62
63
  }
63
- } else {
64
- console.log('No files found in this group.')
65
64
  }
66
65
  }
66
+
67
+ if (pathIndex === 0) {
68
+ exitWithError('No MCP servers found in known configuration files.')
69
+ }
67
70
  }
68
71
 
69
72
  init().then(() => {
70
73
  console.log('\n')
71
74
  })
75
+
76
+ function exitWithError (message: string) {
77
+ console.error(`${styleText(['red'], '●')} ${message}\n`)
78
+ process.exit(1)
79
+ }