ls-mcp 1.11.0 → 1.13.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 +491 -74
- package/dist/bin/cli.mjs +491 -74
- package/dist/main.cjs +400 -41
- package/dist/main.d.cts +11 -0
- package/dist/main.d.ts +11 -0
- package/dist/main.mjs +400 -41
- package/package.json +1 -1
- package/src/bin/cli.ts +7 -0
- package/src/components/credential-warning.ts +35 -5
- package/src/components/mcp-server-version.ts +19 -0
- package/src/components/summary.ts +4 -1
- package/src/services/credential-detection-service.ts +230 -44
- package/src/services/mcp-config-service.ts +16 -1
- package/src/services/mcp-path-registry.ts +50 -1
- package/src/services/mcp-version-detection-service.ts +191 -0
- package/src/services/render-service.ts +13 -3
- package/src/types/mcp-config-service.types.ts +11 -0
package/dist/bin/cli.cjs
CHANGED
|
@@ -25,7 +25,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
25
25
|
));
|
|
26
26
|
|
|
27
27
|
// src/bin/cli.ts
|
|
28
|
-
var
|
|
28
|
+
var import_node_util13 = require("util");
|
|
29
29
|
|
|
30
30
|
// src/services/mcp-config-service.ts
|
|
31
31
|
var import_node_os2 = require("os");
|
|
@@ -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
|
}
|
|
@@ -577,6 +773,157 @@ var DirectoryBubbleService = class {
|
|
|
577
773
|
}
|
|
578
774
|
};
|
|
579
775
|
|
|
776
|
+
// src/services/mcp-version-detection-service.ts
|
|
777
|
+
var MCPVersionDetectionService = class {
|
|
778
|
+
static {
|
|
779
|
+
__name(this, "MCPVersionDetectionService");
|
|
780
|
+
}
|
|
781
|
+
/**
|
|
782
|
+
* Analyze a server configuration to extract version information
|
|
783
|
+
* @param command - The command used to run the server
|
|
784
|
+
* @param args - Array of arguments passed to the command
|
|
785
|
+
* @returns PackageVersionInfo if analysis is possible, null otherwise
|
|
786
|
+
*/
|
|
787
|
+
analyzeServerVersion(command, args) {
|
|
788
|
+
if (!["npx", "uvx", "uv"].includes(command)) {
|
|
789
|
+
return null;
|
|
790
|
+
}
|
|
791
|
+
if (!args || args.length === 0) {
|
|
792
|
+
return null;
|
|
793
|
+
}
|
|
794
|
+
const packageName = this.extractPackageName(command, args);
|
|
795
|
+
if (!packageName) {
|
|
796
|
+
return null;
|
|
797
|
+
}
|
|
798
|
+
const { name, version } = this.parsePackageVersion(packageName);
|
|
799
|
+
const isPinned = this.isPinnedVersion(version);
|
|
800
|
+
return {
|
|
801
|
+
packageName: name,
|
|
802
|
+
version,
|
|
803
|
+
isPinned,
|
|
804
|
+
isLatest: !isPinned
|
|
805
|
+
};
|
|
806
|
+
}
|
|
807
|
+
/**
|
|
808
|
+
* Extract the package name based on the command type
|
|
809
|
+
* @param command - The command used to run the server
|
|
810
|
+
* @param args - Array of arguments passed to the command
|
|
811
|
+
* @returns The package name/spec or null if not found
|
|
812
|
+
*/
|
|
813
|
+
extractPackageName(command, args) {
|
|
814
|
+
switch (command) {
|
|
815
|
+
case "npx":
|
|
816
|
+
return this.extractNpxPackageName(args);
|
|
817
|
+
case "uvx":
|
|
818
|
+
return this.extractUvxPackageName(args);
|
|
819
|
+
case "uv":
|
|
820
|
+
return this.extractUvPackageName(args);
|
|
821
|
+
default:
|
|
822
|
+
return null;
|
|
823
|
+
}
|
|
824
|
+
}
|
|
825
|
+
/**
|
|
826
|
+
* Extract the package name from npx arguments
|
|
827
|
+
* @param args - Array of arguments passed to npx
|
|
828
|
+
* @returns The package name/spec or null if not found
|
|
829
|
+
*/
|
|
830
|
+
extractNpxPackageName(args) {
|
|
831
|
+
if (!args || args.length === 0) {
|
|
832
|
+
return null;
|
|
833
|
+
}
|
|
834
|
+
const yIndex = args.indexOf("-y");
|
|
835
|
+
if (yIndex !== -1 && yIndex + 1 < args.length) {
|
|
836
|
+
return args[yIndex + 1];
|
|
837
|
+
}
|
|
838
|
+
const yesIndex = args.indexOf("--yes");
|
|
839
|
+
if (yesIndex !== -1 && yesIndex + 1 < args.length) {
|
|
840
|
+
return args[yesIndex + 1];
|
|
841
|
+
}
|
|
842
|
+
for (let i = 0; i < args.length; i++) {
|
|
843
|
+
const arg = args[i];
|
|
844
|
+
if (!arg.startsWith("-")) {
|
|
845
|
+
if (i > 0) {
|
|
846
|
+
const prevArg = args[i - 1];
|
|
847
|
+
if (prevArg === "--registry" || prevArg === "-r" || prevArg === "--package" || prevArg === "-p") {
|
|
848
|
+
continue;
|
|
849
|
+
}
|
|
850
|
+
}
|
|
851
|
+
return arg;
|
|
852
|
+
}
|
|
853
|
+
}
|
|
854
|
+
return null;
|
|
855
|
+
}
|
|
856
|
+
/**
|
|
857
|
+
* Extract the package name from uvx arguments
|
|
858
|
+
* @param args - Array of arguments passed to uvx
|
|
859
|
+
* @returns The package name/spec or null if not found
|
|
860
|
+
*/
|
|
861
|
+
extractUvxPackageName(args) {
|
|
862
|
+
if (!args || args.length === 0) {
|
|
863
|
+
return null;
|
|
864
|
+
}
|
|
865
|
+
return args[0];
|
|
866
|
+
}
|
|
867
|
+
/**
|
|
868
|
+
* Extract the package name from uv arguments
|
|
869
|
+
* @param args - Array of arguments passed to uv
|
|
870
|
+
* @returns The package name/spec or null if not found
|
|
871
|
+
*/
|
|
872
|
+
extractUvPackageName(args) {
|
|
873
|
+
if (!args || args.length === 0) {
|
|
874
|
+
return null;
|
|
875
|
+
}
|
|
876
|
+
const runIndex = args.indexOf("run");
|
|
877
|
+
if (runIndex !== -1 && runIndex + 1 < args.length) {
|
|
878
|
+
return args[runIndex + 1];
|
|
879
|
+
}
|
|
880
|
+
return null;
|
|
881
|
+
}
|
|
882
|
+
/**
|
|
883
|
+
* Parse a package specification to extract name and version
|
|
884
|
+
* @param packageSpec - Package specification (e.g., "package@1.0.0" or "package")
|
|
885
|
+
* @returns Object with name and optional version
|
|
886
|
+
*/
|
|
887
|
+
parsePackageVersion(packageSpec) {
|
|
888
|
+
if (!packageSpec) {
|
|
889
|
+
return { name: "", version: void 0 };
|
|
890
|
+
}
|
|
891
|
+
if (packageSpec.startsWith("@")) {
|
|
892
|
+
const parts = packageSpec.split("@");
|
|
893
|
+
if (parts.length === 2) {
|
|
894
|
+
return { name: packageSpec, version: void 0 };
|
|
895
|
+
} else if (parts.length === 3) {
|
|
896
|
+
return {
|
|
897
|
+
name: `@${parts[1]}`,
|
|
898
|
+
version: parts[2]
|
|
899
|
+
};
|
|
900
|
+
}
|
|
901
|
+
}
|
|
902
|
+
const atIndex = packageSpec.lastIndexOf("@");
|
|
903
|
+
if (atIndex > 0) {
|
|
904
|
+
return {
|
|
905
|
+
name: packageSpec.substring(0, atIndex),
|
|
906
|
+
version: packageSpec.substring(atIndex + 1)
|
|
907
|
+
};
|
|
908
|
+
}
|
|
909
|
+
return { name: packageSpec, version: void 0 };
|
|
910
|
+
}
|
|
911
|
+
/**
|
|
912
|
+
* Determine if a version represents a pinned version
|
|
913
|
+
* @param version - The version string to check
|
|
914
|
+
* @returns true if the version is pinned, false if it's latest/implicit
|
|
915
|
+
*/
|
|
916
|
+
isPinnedVersion(version) {
|
|
917
|
+
if (!version) {
|
|
918
|
+
return false;
|
|
919
|
+
}
|
|
920
|
+
if (version === "latest") {
|
|
921
|
+
return false;
|
|
922
|
+
}
|
|
923
|
+
return true;
|
|
924
|
+
}
|
|
925
|
+
};
|
|
926
|
+
|
|
580
927
|
// src/utils/url-utils.ts
|
|
581
928
|
function extractHostname(urlString) {
|
|
582
929
|
try {
|
|
@@ -601,12 +948,14 @@ var MCPConfigService = class {
|
|
|
601
948
|
currentOS;
|
|
602
949
|
debug;
|
|
603
950
|
directoryBubbleService;
|
|
951
|
+
versionDetectionService;
|
|
604
952
|
enableDirectoryBubbling;
|
|
605
953
|
constructor(options = {}) {
|
|
606
954
|
this.pathRegistry = new MCPPathRegistry();
|
|
607
955
|
this.currentOS = (0, import_node_os2.platform)();
|
|
608
956
|
this.debug = import_node_util.default.debuglog("ls-mcp");
|
|
609
957
|
this.directoryBubbleService = new DirectoryBubbleService();
|
|
958
|
+
this.versionDetectionService = new MCPVersionDetectionService();
|
|
610
959
|
this.enableDirectoryBubbling = options.enableDirectoryBubbling ?? false;
|
|
611
960
|
}
|
|
612
961
|
/**
|
|
@@ -803,6 +1152,10 @@ var MCPConfigService = class {
|
|
|
803
1152
|
} else {
|
|
804
1153
|
source = serverConfig.command || "";
|
|
805
1154
|
}
|
|
1155
|
+
const versionInfo = this.versionDetectionService.analyzeServerVersion(
|
|
1156
|
+
serverConfig.command || "",
|
|
1157
|
+
Array.isArray(serverConfig.args) ? serverConfig.args : void 0
|
|
1158
|
+
);
|
|
806
1159
|
serverInfos.push({
|
|
807
1160
|
name: serverName,
|
|
808
1161
|
command: serverConfig.command || "",
|
|
@@ -812,9 +1165,15 @@ var MCPConfigService = class {
|
|
|
812
1165
|
type: serverConfig.type,
|
|
813
1166
|
source,
|
|
814
1167
|
env: serverConfig.env,
|
|
1168
|
+
headers: serverConfig.headers,
|
|
815
1169
|
status: "stopped",
|
|
816
1170
|
// Default status, will be updated by server manager
|
|
817
|
-
|
|
1171
|
+
versionInfo: versionInfo || void 0,
|
|
1172
|
+
credentials: CredentialDetectionService.analyzeServerConfig({
|
|
1173
|
+
env: serverConfig.env,
|
|
1174
|
+
args: serverConfig.args,
|
|
1175
|
+
headers: serverConfig.headers
|
|
1176
|
+
})
|
|
818
1177
|
});
|
|
819
1178
|
}
|
|
820
1179
|
}
|
|
@@ -1291,7 +1650,7 @@ var MCPFiles = class {
|
|
|
1291
1650
|
};
|
|
1292
1651
|
|
|
1293
1652
|
// src/services/render-service.ts
|
|
1294
|
-
var
|
|
1653
|
+
var import_node_util12 = require("util");
|
|
1295
1654
|
|
|
1296
1655
|
// src/components/transport.ts
|
|
1297
1656
|
var import_node_util2 = require("util");
|
|
@@ -1351,31 +1710,47 @@ function render5(text) {
|
|
|
1351
1710
|
}
|
|
1352
1711
|
__name(render5, "render");
|
|
1353
1712
|
|
|
1354
|
-
// src/components/
|
|
1713
|
+
// src/components/mcp-server-version.ts
|
|
1355
1714
|
var import_node_util7 = require("util");
|
|
1356
|
-
function render6(
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1715
|
+
function render6(versionInfo) {
|
|
1716
|
+
if (!versionInfo) {
|
|
1717
|
+
return "";
|
|
1718
|
+
}
|
|
1719
|
+
const version = versionInfo.version || "LATEST";
|
|
1720
|
+
const displayVersion = version === "latest" ? "LATEST" : version;
|
|
1721
|
+
if (versionInfo.isPinned) {
|
|
1722
|
+
return (0, import_node_util7.styleText)(["green"], "\u25CF") + " " + displayVersion;
|
|
1723
|
+
} else {
|
|
1724
|
+
return (0, import_node_util7.styleText)(["red"], "\u25CF") + " LATEST";
|
|
1725
|
+
}
|
|
1360
1726
|
}
|
|
1361
1727
|
__name(render6, "render");
|
|
1362
1728
|
|
|
1363
|
-
// src/components/
|
|
1729
|
+
// src/components/file-path.ts
|
|
1364
1730
|
var import_node_util8 = require("util");
|
|
1365
1731
|
function render7(text) {
|
|
1732
|
+
const formattedText = text;
|
|
1733
|
+
const data = (0, import_node_util8.styleText)(["underline"], formattedText);
|
|
1734
|
+
return data;
|
|
1735
|
+
}
|
|
1736
|
+
__name(render7, "render");
|
|
1737
|
+
|
|
1738
|
+
// src/components/mcp-servers-config-parsable.ts
|
|
1739
|
+
var import_node_util9 = require("util");
|
|
1740
|
+
function render8(text) {
|
|
1366
1741
|
const formattedText = text.toUpperCase().replace(/_/g, " ");
|
|
1367
1742
|
let data = formattedText;
|
|
1368
1743
|
if (formattedText === "VALID") {
|
|
1369
|
-
data = (0,
|
|
1744
|
+
data = (0, import_node_util9.styleText)(["green"], "\u25CF");
|
|
1370
1745
|
} else {
|
|
1371
|
-
data = (0,
|
|
1746
|
+
data = (0, import_node_util9.styleText)(["red"], "\u25CF");
|
|
1372
1747
|
}
|
|
1373
1748
|
return data;
|
|
1374
1749
|
}
|
|
1375
|
-
__name(
|
|
1750
|
+
__name(render8, "render");
|
|
1376
1751
|
|
|
1377
1752
|
// src/components/credential-warning.ts
|
|
1378
|
-
var
|
|
1753
|
+
var import_node_util10 = require("util");
|
|
1379
1754
|
function CredentialWarningComponent(credentials) {
|
|
1380
1755
|
if (!credentials || !credentials.hasCredentials) {
|
|
1381
1756
|
return "";
|
|
@@ -1386,33 +1761,64 @@ function CredentialWarningComponent(credentials) {
|
|
|
1386
1761
|
switch (riskLevel) {
|
|
1387
1762
|
case "high":
|
|
1388
1763
|
riskColor = "red";
|
|
1389
|
-
riskIcon = (0,
|
|
1764
|
+
riskIcon = (0, import_node_util10.styleText)(["red"], "\u25CF");
|
|
1390
1765
|
break;
|
|
1391
1766
|
case "low":
|
|
1392
1767
|
riskColor = "blue";
|
|
1393
|
-
riskIcon = (0,
|
|
1768
|
+
riskIcon = (0, import_node_util10.styleText)(["blue"], "\u25CF");
|
|
1394
1769
|
break;
|
|
1395
1770
|
default:
|
|
1396
1771
|
riskColor = "blue";
|
|
1397
|
-
riskIcon = (0,
|
|
1398
|
-
}
|
|
1399
|
-
const riskText = (0,
|
|
1400
|
-
const
|
|
1401
|
-
|
|
1772
|
+
riskIcon = (0, import_node_util10.styleText)(["blue"], "\u25CF");
|
|
1773
|
+
}
|
|
1774
|
+
const riskText = (0, import_node_util10.styleText)([riskColor], `${riskIcon} ${riskLevel.toUpperCase()} RISK`);
|
|
1775
|
+
const credsBySource = credentialVars.reduce((acc, cv) => {
|
|
1776
|
+
const source = cv.source || "env";
|
|
1777
|
+
if (!acc[source]) {
|
|
1778
|
+
acc[source] = [];
|
|
1779
|
+
}
|
|
1780
|
+
acc[source].push(cv);
|
|
1781
|
+
return acc;
|
|
1782
|
+
}, {});
|
|
1783
|
+
const sourceSummaries = Object.entries(credsBySource).map(([source, creds]) => {
|
|
1784
|
+
const sourceIcon = getSourceIcon(source);
|
|
1785
|
+
const credList = creds.map((cv) => `${cv.name}=${cv.value}`).join(", ");
|
|
1786
|
+
return `${sourceIcon}${source}: ${credList}`;
|
|
1787
|
+
});
|
|
1788
|
+
const credentialSummary = sourceSummaries.join(" | ");
|
|
1789
|
+
return `${riskText} ${(0, import_node_util10.styleText)(["dim"], `(${credentialVars.length} creds: ${credentialSummary})`)}`;
|
|
1402
1790
|
}
|
|
1403
1791
|
__name(CredentialWarningComponent, "CredentialWarningComponent");
|
|
1792
|
+
function getSourceIcon(source) {
|
|
1793
|
+
switch (source) {
|
|
1794
|
+
case "env":
|
|
1795
|
+
return "\u{1F331} ";
|
|
1796
|
+
// Environment variable
|
|
1797
|
+
case "args":
|
|
1798
|
+
return "\u26A1 ";
|
|
1799
|
+
// Command argument
|
|
1800
|
+
case "headers":
|
|
1801
|
+
return "\u{1F517} ";
|
|
1802
|
+
// HTTP header
|
|
1803
|
+
default:
|
|
1804
|
+
return "\u{1F4CB} ";
|
|
1805
|
+
}
|
|
1806
|
+
}
|
|
1807
|
+
__name(getSourceIcon, "getSourceIcon");
|
|
1404
1808
|
|
|
1405
1809
|
// src/components/summary.ts
|
|
1406
|
-
var
|
|
1810
|
+
var import_node_util11 = require("util");
|
|
1407
1811
|
function SummaryComponent(stats) {
|
|
1408
|
-
const { totalServers, runningServers, highRiskCredentials, transportBreakdown } = stats;
|
|
1812
|
+
const { totalServers, runningServers, highRiskCredentials, implicitLatestVersions, transportBreakdown } = stats;
|
|
1409
1813
|
const runningBar = createProgressBar(runningServers, totalServers, 20, "green");
|
|
1410
1814
|
const securityBar = createProgressBar(highRiskCredentials, totalServers, 20, "red");
|
|
1815
|
+
const versionBar = createProgressBar(implicitLatestVersions, totalServers, 20, "red");
|
|
1411
1816
|
const transportText = `stdio: ${transportBreakdown.stdio} | SSE: ${transportBreakdown.sse} | HTTP: ${transportBreakdown.http}`;
|
|
1412
1817
|
const lines = [
|
|
1413
1818
|
"SUMMARY",
|
|
1414
1819
|
` SERVERS ${runningBar} ${runningServers} / ${totalServers} Running`,
|
|
1415
1820
|
` SECURITY ${securityBar} ${highRiskCredentials} / ${totalServers} High Risk Credentials`,
|
|
1821
|
+
` VERSION ${versionBar} ${implicitLatestVersions} / ${totalServers} Implicit Latest`,
|
|
1416
1822
|
` TRANSPORT ${transportText}`
|
|
1417
1823
|
];
|
|
1418
1824
|
return lines.join("\n");
|
|
@@ -1429,11 +1835,11 @@ function createProgressBar(count, total, width, color) {
|
|
|
1429
1835
|
let filled;
|
|
1430
1836
|
let empty;
|
|
1431
1837
|
if (color === "green") {
|
|
1432
|
-
filled = (0,
|
|
1433
|
-
empty = (0,
|
|
1838
|
+
filled = (0, import_node_util11.styleText)(["greenBright"], "\u2588".repeat(filledWidth));
|
|
1839
|
+
empty = (0, import_node_util11.styleText)(["green"], "\u2591".repeat(emptyWidth));
|
|
1434
1840
|
} else {
|
|
1435
|
-
filled = (0,
|
|
1436
|
-
empty = (0,
|
|
1841
|
+
filled = (0, import_node_util11.styleText)(["redBright"], "\u2588".repeat(filledWidth));
|
|
1842
|
+
empty = (0, import_node_util11.styleText)(["red"], "\u2591".repeat(emptyWidth));
|
|
1437
1843
|
}
|
|
1438
1844
|
return `${filled}${empty}`;
|
|
1439
1845
|
}
|
|
@@ -1455,9 +1861,9 @@ var RenderService = class _RenderService {
|
|
|
1455
1861
|
}
|
|
1456
1862
|
static printMcpServers(data) {
|
|
1457
1863
|
if (data.length === 0) return;
|
|
1458
|
-
const headers = ["STATUS", "NAME", "SOURCE", "TRANSPORT", "CREDENTIALS"];
|
|
1459
|
-
const keys = ["status", "name", "source", "transport", "credentials"];
|
|
1460
|
-
const centerColumns = [0,
|
|
1864
|
+
const headers = ["STATUS", "NAME", "VERSION", "SOURCE", "TRANSPORT", "CREDENTIALS"];
|
|
1865
|
+
const keys = ["status", "name", "versionInfo", "source", "transport", "credentials"];
|
|
1866
|
+
const centerColumns = [0, 3, 4];
|
|
1461
1867
|
const leftPadding = " ";
|
|
1462
1868
|
const columnWidths = headers.map((header, index) => {
|
|
1463
1869
|
const headerWidth = _RenderService.getVisibleLength(render2(header));
|
|
@@ -1475,6 +1881,9 @@ var RenderService = class _RenderService {
|
|
|
1475
1881
|
if (keys[index] === "name") {
|
|
1476
1882
|
text = render4(text);
|
|
1477
1883
|
}
|
|
1884
|
+
if (keys[index] === "versionInfo") {
|
|
1885
|
+
text = render6(row[keys[index]]);
|
|
1886
|
+
}
|
|
1478
1887
|
if (keys[index] === "credentials") {
|
|
1479
1888
|
text = CredentialWarningComponent(row[keys[index]]);
|
|
1480
1889
|
}
|
|
@@ -1521,6 +1930,9 @@ var RenderService = class _RenderService {
|
|
|
1521
1930
|
if (key === "name") {
|
|
1522
1931
|
text = render4(text);
|
|
1523
1932
|
}
|
|
1933
|
+
if (key === "versionInfo") {
|
|
1934
|
+
text = render6(row[key]);
|
|
1935
|
+
}
|
|
1524
1936
|
if (key === "credentials") {
|
|
1525
1937
|
text = CredentialWarningComponent(row[key]);
|
|
1526
1938
|
}
|
|
@@ -1569,10 +1981,10 @@ var RenderService = class _RenderService {
|
|
|
1569
1981
|
return render2(row[key]).padEnd(columnWidths[index2] + paddingNormalizer);
|
|
1570
1982
|
}
|
|
1571
1983
|
if (row["key"] === "FILE") {
|
|
1572
|
-
return
|
|
1984
|
+
return render7(row[key]).padEnd(columnWidths[index2] + paddingNormalizer);
|
|
1573
1985
|
}
|
|
1574
1986
|
if (row["key"] === "PARSABLE") {
|
|
1575
|
-
return
|
|
1987
|
+
return render8(row[key]).padEnd(columnWidths[index2] + paddingNormalizer);
|
|
1576
1988
|
}
|
|
1577
1989
|
return String(row[key]).padEnd(columnWidths[index2] + paddingNormalizer);
|
|
1578
1990
|
}).join(" ");
|
|
@@ -1593,8 +2005,8 @@ var RenderService = class _RenderService {
|
|
|
1593
2005
|
let filled;
|
|
1594
2006
|
let empty;
|
|
1595
2007
|
if (count > 0) {
|
|
1596
|
-
filled = (0,
|
|
1597
|
-
empty = (0,
|
|
2008
|
+
filled = (0, import_node_util12.styleText)(["greenBright"], "\u2588".repeat(filledWidth));
|
|
2009
|
+
empty = (0, import_node_util12.styleText)(["green"], "\u2591".repeat(emptyWidth));
|
|
1598
2010
|
} else {
|
|
1599
2011
|
filled = "\u2588".repeat(filledWidth);
|
|
1600
2012
|
empty = "\u2591".repeat(emptyWidth);
|
|
@@ -1635,6 +2047,7 @@ async function init() {
|
|
|
1635
2047
|
let totalServers = 0;
|
|
1636
2048
|
let totalRunning = 0;
|
|
1637
2049
|
let totalHighRiskCredentials = 0;
|
|
2050
|
+
let totalImplicitLatestVersions = 0;
|
|
1638
2051
|
const transportCounts = { stdio: 0, sse: 0, http: 0 };
|
|
1639
2052
|
for (const groupName of Object.keys(mcpFilesList)) {
|
|
1640
2053
|
const group = mcpFilesList[groupName];
|
|
@@ -1659,6 +2072,9 @@ async function init() {
|
|
|
1659
2072
|
if (server.credentials?.hasCredentials && server.credentials?.riskLevel === "high") {
|
|
1660
2073
|
totalHighRiskCredentials++;
|
|
1661
2074
|
}
|
|
2075
|
+
if (server.versionInfo?.isLatest) {
|
|
2076
|
+
totalImplicitLatestVersions++;
|
|
2077
|
+
}
|
|
1662
2078
|
}
|
|
1663
2079
|
const mcpGroupData = [
|
|
1664
2080
|
{ key: "PROVIDER", value: group.friendlyName },
|
|
@@ -1682,6 +2098,7 @@ async function init() {
|
|
|
1682
2098
|
totalServers,
|
|
1683
2099
|
runningServers: totalRunning,
|
|
1684
2100
|
highRiskCredentials: totalHighRiskCredentials,
|
|
2101
|
+
implicitLatestVersions: totalImplicitLatestVersions,
|
|
1685
2102
|
transportBreakdown: transportCounts
|
|
1686
2103
|
};
|
|
1687
2104
|
RenderService.printSummary(summaryStats);
|
|
@@ -1691,7 +2108,7 @@ init().then(() => {
|
|
|
1691
2108
|
console.log("\n");
|
|
1692
2109
|
});
|
|
1693
2110
|
function exitWithError(message) {
|
|
1694
|
-
console.error(`${(0,
|
|
2111
|
+
console.error(`${(0, import_node_util13.styleText)(["red"], "\u25CF")} ${message}
|
|
1695
2112
|
`);
|
|
1696
2113
|
process.exit(1);
|
|
1697
2114
|
}
|