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/main.cjs
CHANGED
|
@@ -136,6 +136,52 @@ var MCPPathRegistry = class _MCPPathRegistry {
|
|
|
136
136
|
{ filePath: import_node_path.default.join(".gemini", "settings.json"), type: "local" }
|
|
137
137
|
]
|
|
138
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
|
+
};
|
|
139
185
|
customApps = /* @__PURE__ */ new Map();
|
|
140
186
|
/**
|
|
141
187
|
* Get all MCP configuration file paths for a specific operating system
|
|
@@ -148,6 +194,8 @@ var MCPPathRegistry = class _MCPPathRegistry {
|
|
|
148
194
|
case "darwin":
|
|
149
195
|
case "macos":
|
|
150
196
|
return { ..._MCPPathRegistry.DARWIN_PATHS };
|
|
197
|
+
case "linux":
|
|
198
|
+
return { ..._MCPPathRegistry.LINUX_PATHS };
|
|
151
199
|
default:
|
|
152
200
|
throw new Error(`Unsupported operating system: ${os}`);
|
|
153
201
|
}
|
|
@@ -174,7 +222,7 @@ var MCPPathRegistry = class _MCPPathRegistry {
|
|
|
174
222
|
* Get all supported operating systems
|
|
175
223
|
*/
|
|
176
224
|
getSupportedOperatingSystems() {
|
|
177
|
-
return ["win32", "darwin"];
|
|
225
|
+
return ["win32", "darwin", "linux"];
|
|
178
226
|
}
|
|
179
227
|
/**
|
|
180
228
|
* Register a custom app with custom paths for a specific OS
|
|
@@ -391,45 +439,17 @@ var CredentialDetectionService = class {
|
|
|
391
439
|
*/
|
|
392
440
|
static CREDENTIAL_PATTERNS = {
|
|
393
441
|
high: [
|
|
394
|
-
//
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
/access[_-]?token/i,
|
|
398
|
-
/secret[_-]?key/i,
|
|
399
|
-
/private[_-]?key/i,
|
|
400
|
-
// Authentication Tokens
|
|
401
|
-
/auth[_-]?token/i,
|
|
402
|
-
/bearer[_-]?token/i,
|
|
403
|
-
/jwt[_-]?token/i,
|
|
404
|
-
/oauth[_-]?token/i,
|
|
442
|
+
// Generic Key and Token patterns (broad matching)
|
|
443
|
+
/.*key.*/i,
|
|
444
|
+
/.*token.*/i,
|
|
405
445
|
// Passwords
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
// Credentials
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
/openai[_-]?api[_-]?key/i,
|
|
414
|
-
/anthropic[_-]?api[_-]?key/i,
|
|
415
|
-
/firecrawl[_-]?api[_-]?key/i,
|
|
416
|
-
/github[_-]?token/i,
|
|
417
|
-
/gitlab[_-]?token/i,
|
|
418
|
-
/bitbucket[_-]?token/i,
|
|
419
|
-
// Database passwords
|
|
420
|
-
/db[_-]?password/i,
|
|
421
|
-
/database[_-]?password/i,
|
|
422
|
-
/redis[_-]?password/i,
|
|
423
|
-
/postgres[_-]?password/i,
|
|
424
|
-
/mysql[_-]?password/i,
|
|
425
|
-
// Cloud services
|
|
426
|
-
/aws[_-]?secret[_-]?access[_-]?key/i,
|
|
427
|
-
/aws[_-]?access[_-]?key[_-]?id/i,
|
|
428
|
-
/azure[_-]?key/i,
|
|
429
|
-
/gcp[_-]?key/i,
|
|
430
|
-
/google[_-]?api[_-]?key/i,
|
|
431
|
-
/gemini[_-]?api[_-]?key/i,
|
|
432
|
-
/claude[_-]?api[_-]?key/i
|
|
446
|
+
/.*password.*/i,
|
|
447
|
+
/.*passwd.*/i,
|
|
448
|
+
/.*pwd.*/i,
|
|
449
|
+
// Credentials and Secrets
|
|
450
|
+
/.*credential.*/i,
|
|
451
|
+
/.*creds.*/i,
|
|
452
|
+
/.*secret.*/i
|
|
433
453
|
],
|
|
434
454
|
low: [
|
|
435
455
|
// Organization and Account IDs
|
|
@@ -440,6 +460,178 @@ var CredentialDetectionService = class {
|
|
|
440
460
|
/openai[_-]?org[_-]?id/i
|
|
441
461
|
]
|
|
442
462
|
};
|
|
463
|
+
/**
|
|
464
|
+
* Argument patterns for detecting credentials in command-line arguments
|
|
465
|
+
*/
|
|
466
|
+
static ARGUMENT_PATTERNS = {
|
|
467
|
+
high: [
|
|
468
|
+
// API key arguments
|
|
469
|
+
/--api-key/i,
|
|
470
|
+
/--apikey/i,
|
|
471
|
+
/--key/i,
|
|
472
|
+
// Token arguments
|
|
473
|
+
/--token/i,
|
|
474
|
+
/--access-token/i,
|
|
475
|
+
/--auth-token/i,
|
|
476
|
+
/--bearer-token/i,
|
|
477
|
+
// Password arguments
|
|
478
|
+
/--password/i,
|
|
479
|
+
/--passwd/i,
|
|
480
|
+
/--pwd/i,
|
|
481
|
+
// Secret arguments
|
|
482
|
+
/--secret/i,
|
|
483
|
+
/--client-secret/i,
|
|
484
|
+
// Authentication arguments
|
|
485
|
+
/--auth/i,
|
|
486
|
+
/--authorization/i,
|
|
487
|
+
/--credentials/i,
|
|
488
|
+
/--creds/i
|
|
489
|
+
],
|
|
490
|
+
low: [
|
|
491
|
+
// Organization and account IDs
|
|
492
|
+
/--org-id/i,
|
|
493
|
+
/--organization-id/i,
|
|
494
|
+
/--account-id/i,
|
|
495
|
+
/--user-id/i
|
|
496
|
+
]
|
|
497
|
+
};
|
|
498
|
+
/**
|
|
499
|
+
* Header patterns for detecting credentials in HTTP headers
|
|
500
|
+
*/
|
|
501
|
+
static HEADER_PATTERNS = {
|
|
502
|
+
high: [
|
|
503
|
+
// Authorization headers
|
|
504
|
+
/authorization/i,
|
|
505
|
+
/auth/i,
|
|
506
|
+
// API key headers
|
|
507
|
+
/x-api-key/i,
|
|
508
|
+
/api-key/i,
|
|
509
|
+
/apikey/i,
|
|
510
|
+
// Token headers
|
|
511
|
+
/x-access-token/i,
|
|
512
|
+
/access-token/i,
|
|
513
|
+
/bearer-token/i,
|
|
514
|
+
/x-auth-token/i,
|
|
515
|
+
/auth-token/i,
|
|
516
|
+
// Custom authentication headers
|
|
517
|
+
/x-.*-key/i,
|
|
518
|
+
/x-.*-token/i,
|
|
519
|
+
/x-.*-secret/i,
|
|
520
|
+
// Service-specific patterns
|
|
521
|
+
/x-github-token/i,
|
|
522
|
+
/x-openai-key/i,
|
|
523
|
+
/x-anthropic-key/i
|
|
524
|
+
],
|
|
525
|
+
low: [
|
|
526
|
+
// User identification headers
|
|
527
|
+
/x-user-id/i,
|
|
528
|
+
/x-org-id/i,
|
|
529
|
+
/x-organization-id/i,
|
|
530
|
+
/x-account-id/i
|
|
531
|
+
]
|
|
532
|
+
};
|
|
533
|
+
/**
|
|
534
|
+
* Variable substitution pattern to detect safe variable references
|
|
535
|
+
*/
|
|
536
|
+
static VARIABLE_SUBSTITUTION_PATTERN = /^\$\{[^}]+\}$/;
|
|
537
|
+
/**
|
|
538
|
+
* Check if a value is a variable substitution pattern (e.g., ${input:token})
|
|
539
|
+
*/
|
|
540
|
+
static isVariableSubstitution(value) {
|
|
541
|
+
return this.VARIABLE_SUBSTITUTION_PATTERN.test(value);
|
|
542
|
+
}
|
|
543
|
+
/**
|
|
544
|
+
* Analyze command-line arguments for potential credentials
|
|
545
|
+
*/
|
|
546
|
+
static analyzeArguments(args) {
|
|
547
|
+
if (!args || !Array.isArray(args) || args.length === 0) {
|
|
548
|
+
return {
|
|
549
|
+
hasCredentials: false,
|
|
550
|
+
credentialVars: [],
|
|
551
|
+
riskLevel: "none"
|
|
552
|
+
};
|
|
553
|
+
}
|
|
554
|
+
const credentialVars = [];
|
|
555
|
+
for (let i = 0; i < args.length - 1; i++) {
|
|
556
|
+
const arg = args[i];
|
|
557
|
+
const nextArg = args[i + 1];
|
|
558
|
+
const isHighRiskArg = this.ARGUMENT_PATTERNS.high.some((pattern) => pattern.test(arg));
|
|
559
|
+
const isLowRiskArg = this.ARGUMENT_PATTERNS.low.some((pattern) => pattern.test(arg));
|
|
560
|
+
if (isHighRiskArg || isLowRiskArg) {
|
|
561
|
+
if (nextArg && !nextArg.startsWith("-")) {
|
|
562
|
+
credentialVars.push({
|
|
563
|
+
name: arg,
|
|
564
|
+
value: this.maskValue(nextArg),
|
|
565
|
+
riskLevel: isHighRiskArg ? "high" : "low",
|
|
566
|
+
source: "args"
|
|
567
|
+
});
|
|
568
|
+
i++;
|
|
569
|
+
}
|
|
570
|
+
}
|
|
571
|
+
}
|
|
572
|
+
const hasCredentials = credentialVars.length > 0;
|
|
573
|
+
const riskLevel = this.calculateOverallRiskLevel(credentialVars);
|
|
574
|
+
return {
|
|
575
|
+
hasCredentials,
|
|
576
|
+
credentialVars,
|
|
577
|
+
riskLevel
|
|
578
|
+
};
|
|
579
|
+
}
|
|
580
|
+
/**
|
|
581
|
+
* Analyze HTTP headers for potential credentials
|
|
582
|
+
*/
|
|
583
|
+
static analyzeHeaders(headers) {
|
|
584
|
+
if (!headers || typeof headers !== "object") {
|
|
585
|
+
return {
|
|
586
|
+
hasCredentials: false,
|
|
587
|
+
credentialVars: [],
|
|
588
|
+
riskLevel: "none"
|
|
589
|
+
};
|
|
590
|
+
}
|
|
591
|
+
const credentialVars = [];
|
|
592
|
+
for (const [name, value] of Object.entries(headers)) {
|
|
593
|
+
if (this.isVariableSubstitution(value)) {
|
|
594
|
+
continue;
|
|
595
|
+
}
|
|
596
|
+
const isHighRiskHeader = this.HEADER_PATTERNS.high.some((pattern) => pattern.test(name));
|
|
597
|
+
const isLowRiskHeader = this.HEADER_PATTERNS.low.some((pattern) => pattern.test(name));
|
|
598
|
+
if (isHighRiskHeader || isLowRiskHeader) {
|
|
599
|
+
credentialVars.push({
|
|
600
|
+
name,
|
|
601
|
+
value: this.maskValue(value),
|
|
602
|
+
riskLevel: isHighRiskHeader ? "high" : "low",
|
|
603
|
+
source: "headers"
|
|
604
|
+
});
|
|
605
|
+
}
|
|
606
|
+
}
|
|
607
|
+
const hasCredentials = credentialVars.length > 0;
|
|
608
|
+
const riskLevel = this.calculateOverallRiskLevel(credentialVars);
|
|
609
|
+
return {
|
|
610
|
+
hasCredentials,
|
|
611
|
+
credentialVars,
|
|
612
|
+
riskLevel
|
|
613
|
+
};
|
|
614
|
+
}
|
|
615
|
+
/**
|
|
616
|
+
* Comprehensive analysis of server configuration for credentials
|
|
617
|
+
*/
|
|
618
|
+
static analyzeServerConfig(config) {
|
|
619
|
+
const envResult = this.analyzeEnvironmentVariables(config.env);
|
|
620
|
+
const argsResult = this.analyzeArguments(config.args);
|
|
621
|
+
const headersResult = this.analyzeHeaders(config.headers);
|
|
622
|
+
const allCredentialVars = [
|
|
623
|
+
...envResult.credentialVars,
|
|
624
|
+
...argsResult.credentialVars,
|
|
625
|
+
...headersResult.credentialVars
|
|
626
|
+
];
|
|
627
|
+
const hasCredentials = allCredentialVars.length > 0;
|
|
628
|
+
const riskLevel = this.calculateOverallRiskLevel(allCredentialVars);
|
|
629
|
+
return {
|
|
630
|
+
hasCredentials,
|
|
631
|
+
credentialVars: allCredentialVars,
|
|
632
|
+
riskLevel
|
|
633
|
+
};
|
|
634
|
+
}
|
|
443
635
|
/**
|
|
444
636
|
* Check if an environment variable name suggests it might contain credentials
|
|
445
637
|
*/
|
|
@@ -459,11 +651,15 @@ var CredentialDetectionService = class {
|
|
|
459
651
|
}
|
|
460
652
|
const credentialVars = [];
|
|
461
653
|
for (const [name, value] of Object.entries(env)) {
|
|
654
|
+
if (this.isVariableSubstitution(value)) {
|
|
655
|
+
continue;
|
|
656
|
+
}
|
|
462
657
|
if (this.isPotentialCredential(name)) {
|
|
463
658
|
credentialVars.push({
|
|
464
659
|
name,
|
|
465
660
|
value: this.maskValue(value),
|
|
466
|
-
riskLevel: this.assessRiskLevel(name)
|
|
661
|
+
riskLevel: this.assessRiskLevel(name),
|
|
662
|
+
source: "env"
|
|
467
663
|
});
|
|
468
664
|
}
|
|
469
665
|
}
|
|
@@ -820,9 +1016,14 @@ var MCPConfigService = class {
|
|
|
820
1016
|
type: serverConfig.type,
|
|
821
1017
|
source,
|
|
822
1018
|
env: serverConfig.env,
|
|
1019
|
+
headers: serverConfig.headers,
|
|
823
1020
|
status: "stopped",
|
|
824
1021
|
// Default status, will be updated by server manager
|
|
825
|
-
credentials: CredentialDetectionService.
|
|
1022
|
+
credentials: CredentialDetectionService.analyzeServerConfig({
|
|
1023
|
+
env: serverConfig.env,
|
|
1024
|
+
args: serverConfig.args,
|
|
1025
|
+
headers: serverConfig.headers
|
|
1026
|
+
})
|
|
826
1027
|
});
|
|
827
1028
|
}
|
|
828
1029
|
}
|
package/dist/main.d.cts
CHANGED
|
@@ -12,6 +12,7 @@ interface MCPServerConfig {
|
|
|
12
12
|
type?: 'sse' | 'http' | 'stdio' | 'streamable-http';
|
|
13
13
|
url?: string;
|
|
14
14
|
env?: Record<string, string>;
|
|
15
|
+
headers?: Record<string, string>;
|
|
15
16
|
}
|
|
16
17
|
interface MCPAppMetadata {
|
|
17
18
|
name: string;
|
|
@@ -32,6 +33,7 @@ interface MCPServerInfo {
|
|
|
32
33
|
type?: 'sse' | 'http' | 'stdio' | 'streamable-http';
|
|
33
34
|
source?: string;
|
|
34
35
|
env?: Record<string, string>;
|
|
36
|
+
headers?: Record<string, string>;
|
|
35
37
|
status?: 'running' | 'stopped';
|
|
36
38
|
credentials?: CredentialAnalysisResult;
|
|
37
39
|
}
|
|
@@ -49,6 +51,7 @@ interface CredentialVariable {
|
|
|
49
51
|
name: string;
|
|
50
52
|
value: string;
|
|
51
53
|
riskLevel: 'low' | 'high';
|
|
54
|
+
source?: 'env' | 'args' | 'headers';
|
|
52
55
|
}
|
|
53
56
|
interface CredentialAnalysisResult {
|
|
54
57
|
hasCredentials: boolean;
|
package/dist/main.d.ts
CHANGED
|
@@ -12,6 +12,7 @@ interface MCPServerConfig {
|
|
|
12
12
|
type?: 'sse' | 'http' | 'stdio' | 'streamable-http';
|
|
13
13
|
url?: string;
|
|
14
14
|
env?: Record<string, string>;
|
|
15
|
+
headers?: Record<string, string>;
|
|
15
16
|
}
|
|
16
17
|
interface MCPAppMetadata {
|
|
17
18
|
name: string;
|
|
@@ -32,6 +33,7 @@ interface MCPServerInfo {
|
|
|
32
33
|
type?: 'sse' | 'http' | 'stdio' | 'streamable-http';
|
|
33
34
|
source?: string;
|
|
34
35
|
env?: Record<string, string>;
|
|
36
|
+
headers?: Record<string, string>;
|
|
35
37
|
status?: 'running' | 'stopped';
|
|
36
38
|
credentials?: CredentialAnalysisResult;
|
|
37
39
|
}
|
|
@@ -49,6 +51,7 @@ interface CredentialVariable {
|
|
|
49
51
|
name: string;
|
|
50
52
|
value: string;
|
|
51
53
|
riskLevel: 'low' | 'high';
|
|
54
|
+
source?: 'env' | 'args' | 'headers';
|
|
52
55
|
}
|
|
53
56
|
interface CredentialAnalysisResult {
|
|
54
57
|
hasCredentials: boolean;
|