ls-mcp 1.11.0 → 1.12.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
@@ -106,6 +106,52 @@ var MCPPathRegistry = class _MCPPathRegistry {
106
106
  { filePath: path.join(".gemini", "settings.json"), type: "local" }
107
107
  ]
108
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
+ };
109
155
  customApps = /* @__PURE__ */ new Map();
110
156
  /**
111
157
  * Get all MCP configuration file paths for a specific operating system
@@ -118,6 +164,8 @@ var MCPPathRegistry = class _MCPPathRegistry {
118
164
  case "darwin":
119
165
  case "macos":
120
166
  return { ..._MCPPathRegistry.DARWIN_PATHS };
167
+ case "linux":
168
+ return { ..._MCPPathRegistry.LINUX_PATHS };
121
169
  default:
122
170
  throw new Error(`Unsupported operating system: ${os}`);
123
171
  }
@@ -144,7 +192,7 @@ var MCPPathRegistry = class _MCPPathRegistry {
144
192
  * Get all supported operating systems
145
193
  */
146
194
  getSupportedOperatingSystems() {
147
- return ["win32", "darwin"];
195
+ return ["win32", "darwin", "linux"];
148
196
  }
149
197
  /**
150
198
  * Register a custom app with custom paths for a specific OS
@@ -361,45 +409,17 @@ var CredentialDetectionService = class {
361
409
  */
362
410
  static CREDENTIAL_PATTERNS = {
363
411
  high: [
364
- // API Keys and Tokens
365
- /api[_-]?key/i,
366
- /api[_-]?token/i,
367
- /access[_-]?token/i,
368
- /secret[_-]?key/i,
369
- /private[_-]?key/i,
370
- // Authentication Tokens
371
- /auth[_-]?token/i,
372
- /bearer[_-]?token/i,
373
- /jwt[_-]?token/i,
374
- /oauth[_-]?token/i,
412
+ // Generic Key and Token patterns (broad matching)
413
+ /.*key.*/i,
414
+ /.*token.*/i,
375
415
  // Passwords
376
- /password/i,
377
- /passwd/i,
378
- /pwd/i,
379
- // Credentials
380
- /credential/i,
381
- /creds/i,
382
- // Specific service patterns
383
- /openai[_-]?api[_-]?key/i,
384
- /anthropic[_-]?api[_-]?key/i,
385
- /firecrawl[_-]?api[_-]?key/i,
386
- /github[_-]?token/i,
387
- /gitlab[_-]?token/i,
388
- /bitbucket[_-]?token/i,
389
- // Database passwords
390
- /db[_-]?password/i,
391
- /database[_-]?password/i,
392
- /redis[_-]?password/i,
393
- /postgres[_-]?password/i,
394
- /mysql[_-]?password/i,
395
- // Cloud services
396
- /aws[_-]?secret[_-]?access[_-]?key/i,
397
- /aws[_-]?access[_-]?key[_-]?id/i,
398
- /azure[_-]?key/i,
399
- /gcp[_-]?key/i,
400
- /google[_-]?api[_-]?key/i,
401
- /gemini[_-]?api[_-]?key/i,
402
- /claude[_-]?api[_-]?key/i
416
+ /.*password.*/i,
417
+ /.*passwd.*/i,
418
+ /.*pwd.*/i,
419
+ // Credentials and Secrets
420
+ /.*credential.*/i,
421
+ /.*creds.*/i,
422
+ /.*secret.*/i
403
423
  ],
404
424
  low: [
405
425
  // Organization and Account IDs
@@ -410,6 +430,178 @@ var CredentialDetectionService = class {
410
430
  /openai[_-]?org[_-]?id/i
411
431
  ]
412
432
  };
433
+ /**
434
+ * Argument patterns for detecting credentials in command-line arguments
435
+ */
436
+ static ARGUMENT_PATTERNS = {
437
+ high: [
438
+ // API key arguments
439
+ /--api-key/i,
440
+ /--apikey/i,
441
+ /--key/i,
442
+ // Token arguments
443
+ /--token/i,
444
+ /--access-token/i,
445
+ /--auth-token/i,
446
+ /--bearer-token/i,
447
+ // Password arguments
448
+ /--password/i,
449
+ /--passwd/i,
450
+ /--pwd/i,
451
+ // Secret arguments
452
+ /--secret/i,
453
+ /--client-secret/i,
454
+ // Authentication arguments
455
+ /--auth/i,
456
+ /--authorization/i,
457
+ /--credentials/i,
458
+ /--creds/i
459
+ ],
460
+ low: [
461
+ // Organization and account IDs
462
+ /--org-id/i,
463
+ /--organization-id/i,
464
+ /--account-id/i,
465
+ /--user-id/i
466
+ ]
467
+ };
468
+ /**
469
+ * Header patterns for detecting credentials in HTTP headers
470
+ */
471
+ static HEADER_PATTERNS = {
472
+ high: [
473
+ // Authorization headers
474
+ /authorization/i,
475
+ /auth/i,
476
+ // API key headers
477
+ /x-api-key/i,
478
+ /api-key/i,
479
+ /apikey/i,
480
+ // Token headers
481
+ /x-access-token/i,
482
+ /access-token/i,
483
+ /bearer-token/i,
484
+ /x-auth-token/i,
485
+ /auth-token/i,
486
+ // Custom authentication headers
487
+ /x-.*-key/i,
488
+ /x-.*-token/i,
489
+ /x-.*-secret/i,
490
+ // Service-specific patterns
491
+ /x-github-token/i,
492
+ /x-openai-key/i,
493
+ /x-anthropic-key/i
494
+ ],
495
+ low: [
496
+ // User identification headers
497
+ /x-user-id/i,
498
+ /x-org-id/i,
499
+ /x-organization-id/i,
500
+ /x-account-id/i
501
+ ]
502
+ };
503
+ /**
504
+ * Variable substitution pattern to detect safe variable references
505
+ */
506
+ static VARIABLE_SUBSTITUTION_PATTERN = /^\$\{[^}]+\}$/;
507
+ /**
508
+ * Check if a value is a variable substitution pattern (e.g., ${input:token})
509
+ */
510
+ static isVariableSubstitution(value) {
511
+ return this.VARIABLE_SUBSTITUTION_PATTERN.test(value);
512
+ }
513
+ /**
514
+ * Analyze command-line arguments for potential credentials
515
+ */
516
+ static analyzeArguments(args) {
517
+ if (!args || !Array.isArray(args) || args.length === 0) {
518
+ return {
519
+ hasCredentials: false,
520
+ credentialVars: [],
521
+ riskLevel: "none"
522
+ };
523
+ }
524
+ const credentialVars = [];
525
+ for (let i = 0; i < args.length - 1; i++) {
526
+ const arg = args[i];
527
+ const nextArg = args[i + 1];
528
+ const isHighRiskArg = this.ARGUMENT_PATTERNS.high.some((pattern) => pattern.test(arg));
529
+ const isLowRiskArg = this.ARGUMENT_PATTERNS.low.some((pattern) => pattern.test(arg));
530
+ if (isHighRiskArg || isLowRiskArg) {
531
+ if (nextArg && !nextArg.startsWith("-")) {
532
+ credentialVars.push({
533
+ name: arg,
534
+ value: this.maskValue(nextArg),
535
+ riskLevel: isHighRiskArg ? "high" : "low",
536
+ source: "args"
537
+ });
538
+ i++;
539
+ }
540
+ }
541
+ }
542
+ const hasCredentials = credentialVars.length > 0;
543
+ const riskLevel = this.calculateOverallRiskLevel(credentialVars);
544
+ return {
545
+ hasCredentials,
546
+ credentialVars,
547
+ riskLevel
548
+ };
549
+ }
550
+ /**
551
+ * Analyze HTTP headers for potential credentials
552
+ */
553
+ static analyzeHeaders(headers) {
554
+ if (!headers || typeof headers !== "object") {
555
+ return {
556
+ hasCredentials: false,
557
+ credentialVars: [],
558
+ riskLevel: "none"
559
+ };
560
+ }
561
+ const credentialVars = [];
562
+ for (const [name, value] of Object.entries(headers)) {
563
+ if (this.isVariableSubstitution(value)) {
564
+ continue;
565
+ }
566
+ const isHighRiskHeader = this.HEADER_PATTERNS.high.some((pattern) => pattern.test(name));
567
+ const isLowRiskHeader = this.HEADER_PATTERNS.low.some((pattern) => pattern.test(name));
568
+ if (isHighRiskHeader || isLowRiskHeader) {
569
+ credentialVars.push({
570
+ name,
571
+ value: this.maskValue(value),
572
+ riskLevel: isHighRiskHeader ? "high" : "low",
573
+ source: "headers"
574
+ });
575
+ }
576
+ }
577
+ const hasCredentials = credentialVars.length > 0;
578
+ const riskLevel = this.calculateOverallRiskLevel(credentialVars);
579
+ return {
580
+ hasCredentials,
581
+ credentialVars,
582
+ riskLevel
583
+ };
584
+ }
585
+ /**
586
+ * Comprehensive analysis of server configuration for credentials
587
+ */
588
+ static analyzeServerConfig(config) {
589
+ const envResult = this.analyzeEnvironmentVariables(config.env);
590
+ const argsResult = this.analyzeArguments(config.args);
591
+ const headersResult = this.analyzeHeaders(config.headers);
592
+ const allCredentialVars = [
593
+ ...envResult.credentialVars,
594
+ ...argsResult.credentialVars,
595
+ ...headersResult.credentialVars
596
+ ];
597
+ const hasCredentials = allCredentialVars.length > 0;
598
+ const riskLevel = this.calculateOverallRiskLevel(allCredentialVars);
599
+ return {
600
+ hasCredentials,
601
+ credentialVars: allCredentialVars,
602
+ riskLevel
603
+ };
604
+ }
413
605
  /**
414
606
  * Check if an environment variable name suggests it might contain credentials
415
607
  */
@@ -429,11 +621,15 @@ var CredentialDetectionService = class {
429
621
  }
430
622
  const credentialVars = [];
431
623
  for (const [name, value] of Object.entries(env)) {
624
+ if (this.isVariableSubstitution(value)) {
625
+ continue;
626
+ }
432
627
  if (this.isPotentialCredential(name)) {
433
628
  credentialVars.push({
434
629
  name,
435
630
  value: this.maskValue(value),
436
- riskLevel: this.assessRiskLevel(name)
631
+ riskLevel: this.assessRiskLevel(name),
632
+ source: "env"
437
633
  });
438
634
  }
439
635
  }
@@ -790,9 +986,14 @@ var MCPConfigService = class {
790
986
  type: serverConfig.type,
791
987
  source,
792
988
  env: serverConfig.env,
989
+ headers: serverConfig.headers,
793
990
  status: "stopped",
794
991
  // Default status, will be updated by server manager
795
- credentials: CredentialDetectionService.analyzeEnvironmentVariables(serverConfig.env)
992
+ credentials: CredentialDetectionService.analyzeServerConfig({
993
+ env: serverConfig.env,
994
+ args: serverConfig.args,
995
+ headers: serverConfig.headers
996
+ })
796
997
  });
797
998
  }
798
999
  }
@@ -1375,10 +1576,39 @@ function CredentialWarningComponent(credentials) {
1375
1576
  riskIcon = styleText8(["blue"], "\u25CF");
1376
1577
  }
1377
1578
  const riskText = styleText8([riskColor], `${riskIcon} ${riskLevel.toUpperCase()} RISK`);
1378
- const credentialSummary = credentialVars.map((cv) => `${cv.name}=${cv.value}`).join(", ");
1379
- return `${riskText} ${styleText8(["dim"], `(${credentialVars.length} cred vars: ${credentialSummary})`)}`;
1579
+ const credsBySource = credentialVars.reduce((acc, cv) => {
1580
+ const source = cv.source || "env";
1581
+ if (!acc[source]) {
1582
+ acc[source] = [];
1583
+ }
1584
+ acc[source].push(cv);
1585
+ return acc;
1586
+ }, {});
1587
+ const sourceSummaries = Object.entries(credsBySource).map(([source, creds]) => {
1588
+ const sourceIcon = getSourceIcon(source);
1589
+ const credList = creds.map((cv) => `${cv.name}=${cv.value}`).join(", ");
1590
+ return `${sourceIcon}${source}: ${credList}`;
1591
+ });
1592
+ const credentialSummary = sourceSummaries.join(" | ");
1593
+ return `${riskText} ${styleText8(["dim"], `(${credentialVars.length} creds: ${credentialSummary})`)}`;
1380
1594
  }
1381
1595
  __name(CredentialWarningComponent, "CredentialWarningComponent");
1596
+ function getSourceIcon(source) {
1597
+ switch (source) {
1598
+ case "env":
1599
+ return "\u{1F331} ";
1600
+ // Environment variable
1601
+ case "args":
1602
+ return "\u26A1 ";
1603
+ // Command argument
1604
+ case "headers":
1605
+ return "\u{1F517} ";
1606
+ // HTTP header
1607
+ default:
1608
+ return "\u{1F4CB} ";
1609
+ }
1610
+ }
1611
+ __name(getSourceIcon, "getSourceIcon");
1382
1612
 
1383
1613
  // src/components/summary.ts
1384
1614
  import { styleText as styleText9 } from "util";