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.cjs +273 -43
- package/dist/bin/cli.mjs +273 -43
- package/dist/main.cjs +242 -41
- package/dist/main.d.cts +3 -0
- package/dist/main.d.ts +3 -0
- package/dist/main.mjs +242 -41
- package/package.json +1 -1
- package/src/components/credential-warning.ts +35 -5
- package/src/services/credential-detection-service.ts +230 -44
- package/src/services/mcp-config-service.ts +6 -1
- package/src/services/mcp-path-registry.ts +50 -1
- package/src/types/mcp-config-service.types.ts +3 -0
package/dist/bin/cli.cjs
CHANGED
|
@@ -128,6 +128,52 @@ var MCPPathRegistry = class _MCPPathRegistry {
|
|
|
128
128
|
{ filePath: import_node_path.default.join(".gemini", "settings.json"), type: "local" }
|
|
129
129
|
]
|
|
130
130
|
};
|
|
131
|
+
static LINUX_PATHS = {
|
|
132
|
+
claude: [
|
|
133
|
+
{ filePath: import_node_path.default.join(process.env.HOME || "", ".config", "Claude", "claude_desktop_config.json"), type: "global" }
|
|
134
|
+
],
|
|
135
|
+
claude_code: [
|
|
136
|
+
{ filePath: ".mcp.json", type: "local" }
|
|
137
|
+
],
|
|
138
|
+
cursor: [
|
|
139
|
+
{ filePath: import_node_path.default.join(process.env.HOME || "", ".cursor", "mcp.json"), type: "global" },
|
|
140
|
+
{ filePath: import_node_path.default.join(".cursor", "mcp.json"), type: "local" }
|
|
141
|
+
],
|
|
142
|
+
vscode: [
|
|
143
|
+
{ filePath: import_node_path.default.join(".vscode", "mcp.json"), type: "local" },
|
|
144
|
+
{ filePath: import_node_path.default.join(process.env.HOME || "", ".config", "Code", "User", "settings.json"), type: "global" },
|
|
145
|
+
{ filePath: import_node_path.default.join(process.env.HOME || "", ".config", "Code - Insiders", "User", "settings.json"), type: "global" },
|
|
146
|
+
{ filePath: import_node_path.default.join(process.env.HOME || "", ".config", "Code", "User", "mcp.json"), type: "global" },
|
|
147
|
+
{ filePath: import_node_path.default.join(process.env.HOME || "", ".config", "Code - Insiders", "User", "mcp.json"), type: "global" },
|
|
148
|
+
{ filePath: import_node_path.default.join(process.env.HOME || "", ".mcp.json"), type: "global" }
|
|
149
|
+
],
|
|
150
|
+
cline: [
|
|
151
|
+
{ filePath: import_node_path.default.join(process.env.HOME || "", ".config", "Code", "User", "globalStorage", "saoudrizwan.claude-dev", "settings", "cline_mcp_settings.json"), type: "global" },
|
|
152
|
+
{ filePath: import_node_path.default.join(process.env.HOME || "", ".config", "Code - Insiders", "User", "globalStorage", "saoudrizwan.claude-dev", "settings", "cline_mcp_settings.json"), type: "global" }
|
|
153
|
+
],
|
|
154
|
+
windsurf: [
|
|
155
|
+
{ filePath: import_node_path.default.join(".codeium", "windsurf", "mcp_config.json"), type: "local" }
|
|
156
|
+
],
|
|
157
|
+
roo: [
|
|
158
|
+
{ filePath: import_node_path.default.join(process.env.HOME || "", ".config", "Code", "User", "globalStorage", "rooveterinaryinc.roo-cline", "settings", "cline_mcp_settings.json"), type: "global" },
|
|
159
|
+
{ filePath: import_node_path.default.join(process.env.HOME || "", ".config", "Code - Insiders", "User", "globalStorage", "rooveterinaryinc.roo-cline", "settings", "cline_mcp_settings.json"), type: "global" }
|
|
160
|
+
],
|
|
161
|
+
"intellij-github-copilot": [
|
|
162
|
+
{ filePath: import_node_path.default.join(process.env.HOME || "", ".config", "github-copilot", "intellij", "mcp.json"), type: "global" }
|
|
163
|
+
],
|
|
164
|
+
junie: [
|
|
165
|
+
{ filePath: import_node_path.default.join(process.env.HOME || "", ".junie", "mcp.json"), type: "global" },
|
|
166
|
+
{ filePath: import_node_path.default.join(".junie", "mcp", "mcp.json"), type: "local" }
|
|
167
|
+
],
|
|
168
|
+
zed: [
|
|
169
|
+
{ filePath: import_node_path.default.join(process.env.HOME || "", ".config", "zed", "settings.json"), type: "global" },
|
|
170
|
+
{ filePath: import_node_path.default.join(".zed", "settings.json"), type: "local" }
|
|
171
|
+
],
|
|
172
|
+
gemini: [
|
|
173
|
+
{ filePath: import_node_path.default.join(process.env.HOME || "", ".gemini", "settings.json"), type: "global" },
|
|
174
|
+
{ filePath: import_node_path.default.join(".gemini", "settings.json"), type: "local" }
|
|
175
|
+
]
|
|
176
|
+
};
|
|
131
177
|
customApps = /* @__PURE__ */ new Map();
|
|
132
178
|
/**
|
|
133
179
|
* Get all MCP configuration file paths for a specific operating system
|
|
@@ -140,6 +186,8 @@ var MCPPathRegistry = class _MCPPathRegistry {
|
|
|
140
186
|
case "darwin":
|
|
141
187
|
case "macos":
|
|
142
188
|
return { ..._MCPPathRegistry.DARWIN_PATHS };
|
|
189
|
+
case "linux":
|
|
190
|
+
return { ..._MCPPathRegistry.LINUX_PATHS };
|
|
143
191
|
default:
|
|
144
192
|
throw new Error(`Unsupported operating system: ${os}`);
|
|
145
193
|
}
|
|
@@ -166,7 +214,7 @@ var MCPPathRegistry = class _MCPPathRegistry {
|
|
|
166
214
|
* Get all supported operating systems
|
|
167
215
|
*/
|
|
168
216
|
getSupportedOperatingSystems() {
|
|
169
|
-
return ["win32", "darwin"];
|
|
217
|
+
return ["win32", "darwin", "linux"];
|
|
170
218
|
}
|
|
171
219
|
/**
|
|
172
220
|
* Register a custom app with custom paths for a specific OS
|
|
@@ -383,45 +431,17 @@ var CredentialDetectionService = class {
|
|
|
383
431
|
*/
|
|
384
432
|
static CREDENTIAL_PATTERNS = {
|
|
385
433
|
high: [
|
|
386
|
-
//
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
/access[_-]?token/i,
|
|
390
|
-
/secret[_-]?key/i,
|
|
391
|
-
/private[_-]?key/i,
|
|
392
|
-
// Authentication Tokens
|
|
393
|
-
/auth[_-]?token/i,
|
|
394
|
-
/bearer[_-]?token/i,
|
|
395
|
-
/jwt[_-]?token/i,
|
|
396
|
-
/oauth[_-]?token/i,
|
|
434
|
+
// Generic Key and Token patterns (broad matching)
|
|
435
|
+
/.*key.*/i,
|
|
436
|
+
/.*token.*/i,
|
|
397
437
|
// Passwords
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
// Credentials
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
/openai[_-]?api[_-]?key/i,
|
|
406
|
-
/anthropic[_-]?api[_-]?key/i,
|
|
407
|
-
/firecrawl[_-]?api[_-]?key/i,
|
|
408
|
-
/github[_-]?token/i,
|
|
409
|
-
/gitlab[_-]?token/i,
|
|
410
|
-
/bitbucket[_-]?token/i,
|
|
411
|
-
// Database passwords
|
|
412
|
-
/db[_-]?password/i,
|
|
413
|
-
/database[_-]?password/i,
|
|
414
|
-
/redis[_-]?password/i,
|
|
415
|
-
/postgres[_-]?password/i,
|
|
416
|
-
/mysql[_-]?password/i,
|
|
417
|
-
// Cloud services
|
|
418
|
-
/aws[_-]?secret[_-]?access[_-]?key/i,
|
|
419
|
-
/aws[_-]?access[_-]?key[_-]?id/i,
|
|
420
|
-
/azure[_-]?key/i,
|
|
421
|
-
/gcp[_-]?key/i,
|
|
422
|
-
/google[_-]?api[_-]?key/i,
|
|
423
|
-
/gemini[_-]?api[_-]?key/i,
|
|
424
|
-
/claude[_-]?api[_-]?key/i
|
|
438
|
+
/.*password.*/i,
|
|
439
|
+
/.*passwd.*/i,
|
|
440
|
+
/.*pwd.*/i,
|
|
441
|
+
// Credentials and Secrets
|
|
442
|
+
/.*credential.*/i,
|
|
443
|
+
/.*creds.*/i,
|
|
444
|
+
/.*secret.*/i
|
|
425
445
|
],
|
|
426
446
|
low: [
|
|
427
447
|
// Organization and Account IDs
|
|
@@ -432,6 +452,178 @@ var CredentialDetectionService = class {
|
|
|
432
452
|
/openai[_-]?org[_-]?id/i
|
|
433
453
|
]
|
|
434
454
|
};
|
|
455
|
+
/**
|
|
456
|
+
* Argument patterns for detecting credentials in command-line arguments
|
|
457
|
+
*/
|
|
458
|
+
static ARGUMENT_PATTERNS = {
|
|
459
|
+
high: [
|
|
460
|
+
// API key arguments
|
|
461
|
+
/--api-key/i,
|
|
462
|
+
/--apikey/i,
|
|
463
|
+
/--key/i,
|
|
464
|
+
// Token arguments
|
|
465
|
+
/--token/i,
|
|
466
|
+
/--access-token/i,
|
|
467
|
+
/--auth-token/i,
|
|
468
|
+
/--bearer-token/i,
|
|
469
|
+
// Password arguments
|
|
470
|
+
/--password/i,
|
|
471
|
+
/--passwd/i,
|
|
472
|
+
/--pwd/i,
|
|
473
|
+
// Secret arguments
|
|
474
|
+
/--secret/i,
|
|
475
|
+
/--client-secret/i,
|
|
476
|
+
// Authentication arguments
|
|
477
|
+
/--auth/i,
|
|
478
|
+
/--authorization/i,
|
|
479
|
+
/--credentials/i,
|
|
480
|
+
/--creds/i
|
|
481
|
+
],
|
|
482
|
+
low: [
|
|
483
|
+
// Organization and account IDs
|
|
484
|
+
/--org-id/i,
|
|
485
|
+
/--organization-id/i,
|
|
486
|
+
/--account-id/i,
|
|
487
|
+
/--user-id/i
|
|
488
|
+
]
|
|
489
|
+
};
|
|
490
|
+
/**
|
|
491
|
+
* Header patterns for detecting credentials in HTTP headers
|
|
492
|
+
*/
|
|
493
|
+
static HEADER_PATTERNS = {
|
|
494
|
+
high: [
|
|
495
|
+
// Authorization headers
|
|
496
|
+
/authorization/i,
|
|
497
|
+
/auth/i,
|
|
498
|
+
// API key headers
|
|
499
|
+
/x-api-key/i,
|
|
500
|
+
/api-key/i,
|
|
501
|
+
/apikey/i,
|
|
502
|
+
// Token headers
|
|
503
|
+
/x-access-token/i,
|
|
504
|
+
/access-token/i,
|
|
505
|
+
/bearer-token/i,
|
|
506
|
+
/x-auth-token/i,
|
|
507
|
+
/auth-token/i,
|
|
508
|
+
// Custom authentication headers
|
|
509
|
+
/x-.*-key/i,
|
|
510
|
+
/x-.*-token/i,
|
|
511
|
+
/x-.*-secret/i,
|
|
512
|
+
// Service-specific patterns
|
|
513
|
+
/x-github-token/i,
|
|
514
|
+
/x-openai-key/i,
|
|
515
|
+
/x-anthropic-key/i
|
|
516
|
+
],
|
|
517
|
+
low: [
|
|
518
|
+
// User identification headers
|
|
519
|
+
/x-user-id/i,
|
|
520
|
+
/x-org-id/i,
|
|
521
|
+
/x-organization-id/i,
|
|
522
|
+
/x-account-id/i
|
|
523
|
+
]
|
|
524
|
+
};
|
|
525
|
+
/**
|
|
526
|
+
* Variable substitution pattern to detect safe variable references
|
|
527
|
+
*/
|
|
528
|
+
static VARIABLE_SUBSTITUTION_PATTERN = /^\$\{[^}]+\}$/;
|
|
529
|
+
/**
|
|
530
|
+
* Check if a value is a variable substitution pattern (e.g., ${input:token})
|
|
531
|
+
*/
|
|
532
|
+
static isVariableSubstitution(value) {
|
|
533
|
+
return this.VARIABLE_SUBSTITUTION_PATTERN.test(value);
|
|
534
|
+
}
|
|
535
|
+
/**
|
|
536
|
+
* Analyze command-line arguments for potential credentials
|
|
537
|
+
*/
|
|
538
|
+
static analyzeArguments(args) {
|
|
539
|
+
if (!args || !Array.isArray(args) || args.length === 0) {
|
|
540
|
+
return {
|
|
541
|
+
hasCredentials: false,
|
|
542
|
+
credentialVars: [],
|
|
543
|
+
riskLevel: "none"
|
|
544
|
+
};
|
|
545
|
+
}
|
|
546
|
+
const credentialVars = [];
|
|
547
|
+
for (let i = 0; i < args.length - 1; i++) {
|
|
548
|
+
const arg = args[i];
|
|
549
|
+
const nextArg = args[i + 1];
|
|
550
|
+
const isHighRiskArg = this.ARGUMENT_PATTERNS.high.some((pattern) => pattern.test(arg));
|
|
551
|
+
const isLowRiskArg = this.ARGUMENT_PATTERNS.low.some((pattern) => pattern.test(arg));
|
|
552
|
+
if (isHighRiskArg || isLowRiskArg) {
|
|
553
|
+
if (nextArg && !nextArg.startsWith("-")) {
|
|
554
|
+
credentialVars.push({
|
|
555
|
+
name: arg,
|
|
556
|
+
value: this.maskValue(nextArg),
|
|
557
|
+
riskLevel: isHighRiskArg ? "high" : "low",
|
|
558
|
+
source: "args"
|
|
559
|
+
});
|
|
560
|
+
i++;
|
|
561
|
+
}
|
|
562
|
+
}
|
|
563
|
+
}
|
|
564
|
+
const hasCredentials = credentialVars.length > 0;
|
|
565
|
+
const riskLevel = this.calculateOverallRiskLevel(credentialVars);
|
|
566
|
+
return {
|
|
567
|
+
hasCredentials,
|
|
568
|
+
credentialVars,
|
|
569
|
+
riskLevel
|
|
570
|
+
};
|
|
571
|
+
}
|
|
572
|
+
/**
|
|
573
|
+
* Analyze HTTP headers for potential credentials
|
|
574
|
+
*/
|
|
575
|
+
static analyzeHeaders(headers) {
|
|
576
|
+
if (!headers || typeof headers !== "object") {
|
|
577
|
+
return {
|
|
578
|
+
hasCredentials: false,
|
|
579
|
+
credentialVars: [],
|
|
580
|
+
riskLevel: "none"
|
|
581
|
+
};
|
|
582
|
+
}
|
|
583
|
+
const credentialVars = [];
|
|
584
|
+
for (const [name, value] of Object.entries(headers)) {
|
|
585
|
+
if (this.isVariableSubstitution(value)) {
|
|
586
|
+
continue;
|
|
587
|
+
}
|
|
588
|
+
const isHighRiskHeader = this.HEADER_PATTERNS.high.some((pattern) => pattern.test(name));
|
|
589
|
+
const isLowRiskHeader = this.HEADER_PATTERNS.low.some((pattern) => pattern.test(name));
|
|
590
|
+
if (isHighRiskHeader || isLowRiskHeader) {
|
|
591
|
+
credentialVars.push({
|
|
592
|
+
name,
|
|
593
|
+
value: this.maskValue(value),
|
|
594
|
+
riskLevel: isHighRiskHeader ? "high" : "low",
|
|
595
|
+
source: "headers"
|
|
596
|
+
});
|
|
597
|
+
}
|
|
598
|
+
}
|
|
599
|
+
const hasCredentials = credentialVars.length > 0;
|
|
600
|
+
const riskLevel = this.calculateOverallRiskLevel(credentialVars);
|
|
601
|
+
return {
|
|
602
|
+
hasCredentials,
|
|
603
|
+
credentialVars,
|
|
604
|
+
riskLevel
|
|
605
|
+
};
|
|
606
|
+
}
|
|
607
|
+
/**
|
|
608
|
+
* Comprehensive analysis of server configuration for credentials
|
|
609
|
+
*/
|
|
610
|
+
static analyzeServerConfig(config) {
|
|
611
|
+
const envResult = this.analyzeEnvironmentVariables(config.env);
|
|
612
|
+
const argsResult = this.analyzeArguments(config.args);
|
|
613
|
+
const headersResult = this.analyzeHeaders(config.headers);
|
|
614
|
+
const allCredentialVars = [
|
|
615
|
+
...envResult.credentialVars,
|
|
616
|
+
...argsResult.credentialVars,
|
|
617
|
+
...headersResult.credentialVars
|
|
618
|
+
];
|
|
619
|
+
const hasCredentials = allCredentialVars.length > 0;
|
|
620
|
+
const riskLevel = this.calculateOverallRiskLevel(allCredentialVars);
|
|
621
|
+
return {
|
|
622
|
+
hasCredentials,
|
|
623
|
+
credentialVars: allCredentialVars,
|
|
624
|
+
riskLevel
|
|
625
|
+
};
|
|
626
|
+
}
|
|
435
627
|
/**
|
|
436
628
|
* Check if an environment variable name suggests it might contain credentials
|
|
437
629
|
*/
|
|
@@ -451,11 +643,15 @@ var CredentialDetectionService = class {
|
|
|
451
643
|
}
|
|
452
644
|
const credentialVars = [];
|
|
453
645
|
for (const [name, value] of Object.entries(env)) {
|
|
646
|
+
if (this.isVariableSubstitution(value)) {
|
|
647
|
+
continue;
|
|
648
|
+
}
|
|
454
649
|
if (this.isPotentialCredential(name)) {
|
|
455
650
|
credentialVars.push({
|
|
456
651
|
name,
|
|
457
652
|
value: this.maskValue(value),
|
|
458
|
-
riskLevel: this.assessRiskLevel(name)
|
|
653
|
+
riskLevel: this.assessRiskLevel(name),
|
|
654
|
+
source: "env"
|
|
459
655
|
});
|
|
460
656
|
}
|
|
461
657
|
}
|
|
@@ -812,9 +1008,14 @@ var MCPConfigService = class {
|
|
|
812
1008
|
type: serverConfig.type,
|
|
813
1009
|
source,
|
|
814
1010
|
env: serverConfig.env,
|
|
1011
|
+
headers: serverConfig.headers,
|
|
815
1012
|
status: "stopped",
|
|
816
1013
|
// Default status, will be updated by server manager
|
|
817
|
-
credentials: CredentialDetectionService.
|
|
1014
|
+
credentials: CredentialDetectionService.analyzeServerConfig({
|
|
1015
|
+
env: serverConfig.env,
|
|
1016
|
+
args: serverConfig.args,
|
|
1017
|
+
headers: serverConfig.headers
|
|
1018
|
+
})
|
|
818
1019
|
});
|
|
819
1020
|
}
|
|
820
1021
|
}
|
|
@@ -1397,10 +1598,39 @@ function CredentialWarningComponent(credentials) {
|
|
|
1397
1598
|
riskIcon = (0, import_node_util9.styleText)(["blue"], "\u25CF");
|
|
1398
1599
|
}
|
|
1399
1600
|
const riskText = (0, import_node_util9.styleText)([riskColor], `${riskIcon} ${riskLevel.toUpperCase()} RISK`);
|
|
1400
|
-
const
|
|
1401
|
-
|
|
1601
|
+
const credsBySource = credentialVars.reduce((acc, cv) => {
|
|
1602
|
+
const source = cv.source || "env";
|
|
1603
|
+
if (!acc[source]) {
|
|
1604
|
+
acc[source] = [];
|
|
1605
|
+
}
|
|
1606
|
+
acc[source].push(cv);
|
|
1607
|
+
return acc;
|
|
1608
|
+
}, {});
|
|
1609
|
+
const sourceSummaries = Object.entries(credsBySource).map(([source, creds]) => {
|
|
1610
|
+
const sourceIcon = getSourceIcon(source);
|
|
1611
|
+
const credList = creds.map((cv) => `${cv.name}=${cv.value}`).join(", ");
|
|
1612
|
+
return `${sourceIcon}${source}: ${credList}`;
|
|
1613
|
+
});
|
|
1614
|
+
const credentialSummary = sourceSummaries.join(" | ");
|
|
1615
|
+
return `${riskText} ${(0, import_node_util9.styleText)(["dim"], `(${credentialVars.length} creds: ${credentialSummary})`)}`;
|
|
1402
1616
|
}
|
|
1403
1617
|
__name(CredentialWarningComponent, "CredentialWarningComponent");
|
|
1618
|
+
function getSourceIcon(source) {
|
|
1619
|
+
switch (source) {
|
|
1620
|
+
case "env":
|
|
1621
|
+
return "\u{1F331} ";
|
|
1622
|
+
// Environment variable
|
|
1623
|
+
case "args":
|
|
1624
|
+
return "\u26A1 ";
|
|
1625
|
+
// Command argument
|
|
1626
|
+
case "headers":
|
|
1627
|
+
return "\u{1F517} ";
|
|
1628
|
+
// HTTP header
|
|
1629
|
+
default:
|
|
1630
|
+
return "\u{1F4CB} ";
|
|
1631
|
+
}
|
|
1632
|
+
}
|
|
1633
|
+
__name(getSourceIcon, "getSourceIcon");
|
|
1404
1634
|
|
|
1405
1635
|
// src/components/summary.ts
|
|
1406
1636
|
var import_node_util10 = require("util");
|