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.mjs
CHANGED
|
@@ -3,7 +3,7 @@ var __defProp = Object.defineProperty;
|
|
|
3
3
|
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
4
4
|
|
|
5
5
|
// src/bin/cli.ts
|
|
6
|
-
import { styleText as
|
|
6
|
+
import { styleText as styleText12 } from "util";
|
|
7
7
|
|
|
8
8
|
// src/services/mcp-config-service.ts
|
|
9
9
|
import { platform } from "os";
|
|
@@ -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
|
-
//
|
|
365
|
-
|
|
366
|
-
|
|
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
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
// Credentials
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
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
|
}
|
|
@@ -555,6 +751,157 @@ var DirectoryBubbleService = class {
|
|
|
555
751
|
}
|
|
556
752
|
};
|
|
557
753
|
|
|
754
|
+
// src/services/mcp-version-detection-service.ts
|
|
755
|
+
var MCPVersionDetectionService = class {
|
|
756
|
+
static {
|
|
757
|
+
__name(this, "MCPVersionDetectionService");
|
|
758
|
+
}
|
|
759
|
+
/**
|
|
760
|
+
* Analyze a server configuration to extract version information
|
|
761
|
+
* @param command - The command used to run the server
|
|
762
|
+
* @param args - Array of arguments passed to the command
|
|
763
|
+
* @returns PackageVersionInfo if analysis is possible, null otherwise
|
|
764
|
+
*/
|
|
765
|
+
analyzeServerVersion(command, args) {
|
|
766
|
+
if (!["npx", "uvx", "uv"].includes(command)) {
|
|
767
|
+
return null;
|
|
768
|
+
}
|
|
769
|
+
if (!args || args.length === 0) {
|
|
770
|
+
return null;
|
|
771
|
+
}
|
|
772
|
+
const packageName = this.extractPackageName(command, args);
|
|
773
|
+
if (!packageName) {
|
|
774
|
+
return null;
|
|
775
|
+
}
|
|
776
|
+
const { name, version } = this.parsePackageVersion(packageName);
|
|
777
|
+
const isPinned = this.isPinnedVersion(version);
|
|
778
|
+
return {
|
|
779
|
+
packageName: name,
|
|
780
|
+
version,
|
|
781
|
+
isPinned,
|
|
782
|
+
isLatest: !isPinned
|
|
783
|
+
};
|
|
784
|
+
}
|
|
785
|
+
/**
|
|
786
|
+
* Extract the package name based on the command type
|
|
787
|
+
* @param command - The command used to run the server
|
|
788
|
+
* @param args - Array of arguments passed to the command
|
|
789
|
+
* @returns The package name/spec or null if not found
|
|
790
|
+
*/
|
|
791
|
+
extractPackageName(command, args) {
|
|
792
|
+
switch (command) {
|
|
793
|
+
case "npx":
|
|
794
|
+
return this.extractNpxPackageName(args);
|
|
795
|
+
case "uvx":
|
|
796
|
+
return this.extractUvxPackageName(args);
|
|
797
|
+
case "uv":
|
|
798
|
+
return this.extractUvPackageName(args);
|
|
799
|
+
default:
|
|
800
|
+
return null;
|
|
801
|
+
}
|
|
802
|
+
}
|
|
803
|
+
/**
|
|
804
|
+
* Extract the package name from npx arguments
|
|
805
|
+
* @param args - Array of arguments passed to npx
|
|
806
|
+
* @returns The package name/spec or null if not found
|
|
807
|
+
*/
|
|
808
|
+
extractNpxPackageName(args) {
|
|
809
|
+
if (!args || args.length === 0) {
|
|
810
|
+
return null;
|
|
811
|
+
}
|
|
812
|
+
const yIndex = args.indexOf("-y");
|
|
813
|
+
if (yIndex !== -1 && yIndex + 1 < args.length) {
|
|
814
|
+
return args[yIndex + 1];
|
|
815
|
+
}
|
|
816
|
+
const yesIndex = args.indexOf("--yes");
|
|
817
|
+
if (yesIndex !== -1 && yesIndex + 1 < args.length) {
|
|
818
|
+
return args[yesIndex + 1];
|
|
819
|
+
}
|
|
820
|
+
for (let i = 0; i < args.length; i++) {
|
|
821
|
+
const arg = args[i];
|
|
822
|
+
if (!arg.startsWith("-")) {
|
|
823
|
+
if (i > 0) {
|
|
824
|
+
const prevArg = args[i - 1];
|
|
825
|
+
if (prevArg === "--registry" || prevArg === "-r" || prevArg === "--package" || prevArg === "-p") {
|
|
826
|
+
continue;
|
|
827
|
+
}
|
|
828
|
+
}
|
|
829
|
+
return arg;
|
|
830
|
+
}
|
|
831
|
+
}
|
|
832
|
+
return null;
|
|
833
|
+
}
|
|
834
|
+
/**
|
|
835
|
+
* Extract the package name from uvx arguments
|
|
836
|
+
* @param args - Array of arguments passed to uvx
|
|
837
|
+
* @returns The package name/spec or null if not found
|
|
838
|
+
*/
|
|
839
|
+
extractUvxPackageName(args) {
|
|
840
|
+
if (!args || args.length === 0) {
|
|
841
|
+
return null;
|
|
842
|
+
}
|
|
843
|
+
return args[0];
|
|
844
|
+
}
|
|
845
|
+
/**
|
|
846
|
+
* Extract the package name from uv arguments
|
|
847
|
+
* @param args - Array of arguments passed to uv
|
|
848
|
+
* @returns The package name/spec or null if not found
|
|
849
|
+
*/
|
|
850
|
+
extractUvPackageName(args) {
|
|
851
|
+
if (!args || args.length === 0) {
|
|
852
|
+
return null;
|
|
853
|
+
}
|
|
854
|
+
const runIndex = args.indexOf("run");
|
|
855
|
+
if (runIndex !== -1 && runIndex + 1 < args.length) {
|
|
856
|
+
return args[runIndex + 1];
|
|
857
|
+
}
|
|
858
|
+
return null;
|
|
859
|
+
}
|
|
860
|
+
/**
|
|
861
|
+
* Parse a package specification to extract name and version
|
|
862
|
+
* @param packageSpec - Package specification (e.g., "package@1.0.0" or "package")
|
|
863
|
+
* @returns Object with name and optional version
|
|
864
|
+
*/
|
|
865
|
+
parsePackageVersion(packageSpec) {
|
|
866
|
+
if (!packageSpec) {
|
|
867
|
+
return { name: "", version: void 0 };
|
|
868
|
+
}
|
|
869
|
+
if (packageSpec.startsWith("@")) {
|
|
870
|
+
const parts = packageSpec.split("@");
|
|
871
|
+
if (parts.length === 2) {
|
|
872
|
+
return { name: packageSpec, version: void 0 };
|
|
873
|
+
} else if (parts.length === 3) {
|
|
874
|
+
return {
|
|
875
|
+
name: `@${parts[1]}`,
|
|
876
|
+
version: parts[2]
|
|
877
|
+
};
|
|
878
|
+
}
|
|
879
|
+
}
|
|
880
|
+
const atIndex = packageSpec.lastIndexOf("@");
|
|
881
|
+
if (atIndex > 0) {
|
|
882
|
+
return {
|
|
883
|
+
name: packageSpec.substring(0, atIndex),
|
|
884
|
+
version: packageSpec.substring(atIndex + 1)
|
|
885
|
+
};
|
|
886
|
+
}
|
|
887
|
+
return { name: packageSpec, version: void 0 };
|
|
888
|
+
}
|
|
889
|
+
/**
|
|
890
|
+
* Determine if a version represents a pinned version
|
|
891
|
+
* @param version - The version string to check
|
|
892
|
+
* @returns true if the version is pinned, false if it's latest/implicit
|
|
893
|
+
*/
|
|
894
|
+
isPinnedVersion(version) {
|
|
895
|
+
if (!version) {
|
|
896
|
+
return false;
|
|
897
|
+
}
|
|
898
|
+
if (version === "latest") {
|
|
899
|
+
return false;
|
|
900
|
+
}
|
|
901
|
+
return true;
|
|
902
|
+
}
|
|
903
|
+
};
|
|
904
|
+
|
|
558
905
|
// src/utils/url-utils.ts
|
|
559
906
|
function extractHostname(urlString) {
|
|
560
907
|
try {
|
|
@@ -579,12 +926,14 @@ var MCPConfigService = class {
|
|
|
579
926
|
currentOS;
|
|
580
927
|
debug;
|
|
581
928
|
directoryBubbleService;
|
|
929
|
+
versionDetectionService;
|
|
582
930
|
enableDirectoryBubbling;
|
|
583
931
|
constructor(options = {}) {
|
|
584
932
|
this.pathRegistry = new MCPPathRegistry();
|
|
585
933
|
this.currentOS = platform();
|
|
586
934
|
this.debug = util.debuglog("ls-mcp");
|
|
587
935
|
this.directoryBubbleService = new DirectoryBubbleService();
|
|
936
|
+
this.versionDetectionService = new MCPVersionDetectionService();
|
|
588
937
|
this.enableDirectoryBubbling = options.enableDirectoryBubbling ?? false;
|
|
589
938
|
}
|
|
590
939
|
/**
|
|
@@ -781,6 +1130,10 @@ var MCPConfigService = class {
|
|
|
781
1130
|
} else {
|
|
782
1131
|
source = serverConfig.command || "";
|
|
783
1132
|
}
|
|
1133
|
+
const versionInfo = this.versionDetectionService.analyzeServerVersion(
|
|
1134
|
+
serverConfig.command || "",
|
|
1135
|
+
Array.isArray(serverConfig.args) ? serverConfig.args : void 0
|
|
1136
|
+
);
|
|
784
1137
|
serverInfos.push({
|
|
785
1138
|
name: serverName,
|
|
786
1139
|
command: serverConfig.command || "",
|
|
@@ -790,9 +1143,15 @@ var MCPConfigService = class {
|
|
|
790
1143
|
type: serverConfig.type,
|
|
791
1144
|
source,
|
|
792
1145
|
env: serverConfig.env,
|
|
1146
|
+
headers: serverConfig.headers,
|
|
793
1147
|
status: "stopped",
|
|
794
1148
|
// Default status, will be updated by server manager
|
|
795
|
-
|
|
1149
|
+
versionInfo: versionInfo || void 0,
|
|
1150
|
+
credentials: CredentialDetectionService.analyzeServerConfig({
|
|
1151
|
+
env: serverConfig.env,
|
|
1152
|
+
args: serverConfig.args,
|
|
1153
|
+
headers: serverConfig.headers
|
|
1154
|
+
})
|
|
796
1155
|
});
|
|
797
1156
|
}
|
|
798
1157
|
}
|
|
@@ -1269,7 +1628,7 @@ var MCPFiles = class {
|
|
|
1269
1628
|
};
|
|
1270
1629
|
|
|
1271
1630
|
// src/services/render-service.ts
|
|
1272
|
-
import { styleText as
|
|
1631
|
+
import { styleText as styleText11 } from "util";
|
|
1273
1632
|
|
|
1274
1633
|
// src/components/transport.ts
|
|
1275
1634
|
import { styleText } from "util";
|
|
@@ -1329,31 +1688,47 @@ function render5(text) {
|
|
|
1329
1688
|
}
|
|
1330
1689
|
__name(render5, "render");
|
|
1331
1690
|
|
|
1332
|
-
// src/components/
|
|
1691
|
+
// src/components/mcp-server-version.ts
|
|
1333
1692
|
import { styleText as styleText6 } from "util";
|
|
1334
|
-
function render6(
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1693
|
+
function render6(versionInfo) {
|
|
1694
|
+
if (!versionInfo) {
|
|
1695
|
+
return "";
|
|
1696
|
+
}
|
|
1697
|
+
const version = versionInfo.version || "LATEST";
|
|
1698
|
+
const displayVersion = version === "latest" ? "LATEST" : version;
|
|
1699
|
+
if (versionInfo.isPinned) {
|
|
1700
|
+
return styleText6(["green"], "\u25CF") + " " + displayVersion;
|
|
1701
|
+
} else {
|
|
1702
|
+
return styleText6(["red"], "\u25CF") + " LATEST";
|
|
1703
|
+
}
|
|
1338
1704
|
}
|
|
1339
1705
|
__name(render6, "render");
|
|
1340
1706
|
|
|
1341
|
-
// src/components/
|
|
1707
|
+
// src/components/file-path.ts
|
|
1342
1708
|
import { styleText as styleText7 } from "util";
|
|
1343
1709
|
function render7(text) {
|
|
1710
|
+
const formattedText = text;
|
|
1711
|
+
const data = styleText7(["underline"], formattedText);
|
|
1712
|
+
return data;
|
|
1713
|
+
}
|
|
1714
|
+
__name(render7, "render");
|
|
1715
|
+
|
|
1716
|
+
// src/components/mcp-servers-config-parsable.ts
|
|
1717
|
+
import { styleText as styleText8 } from "util";
|
|
1718
|
+
function render8(text) {
|
|
1344
1719
|
const formattedText = text.toUpperCase().replace(/_/g, " ");
|
|
1345
1720
|
let data = formattedText;
|
|
1346
1721
|
if (formattedText === "VALID") {
|
|
1347
|
-
data =
|
|
1722
|
+
data = styleText8(["green"], "\u25CF");
|
|
1348
1723
|
} else {
|
|
1349
|
-
data =
|
|
1724
|
+
data = styleText8(["red"], "\u25CF");
|
|
1350
1725
|
}
|
|
1351
1726
|
return data;
|
|
1352
1727
|
}
|
|
1353
|
-
__name(
|
|
1728
|
+
__name(render8, "render");
|
|
1354
1729
|
|
|
1355
1730
|
// src/components/credential-warning.ts
|
|
1356
|
-
import { styleText as
|
|
1731
|
+
import { styleText as styleText9 } from "util";
|
|
1357
1732
|
function CredentialWarningComponent(credentials) {
|
|
1358
1733
|
if (!credentials || !credentials.hasCredentials) {
|
|
1359
1734
|
return "";
|
|
@@ -1364,33 +1739,64 @@ function CredentialWarningComponent(credentials) {
|
|
|
1364
1739
|
switch (riskLevel) {
|
|
1365
1740
|
case "high":
|
|
1366
1741
|
riskColor = "red";
|
|
1367
|
-
riskIcon =
|
|
1742
|
+
riskIcon = styleText9(["red"], "\u25CF");
|
|
1368
1743
|
break;
|
|
1369
1744
|
case "low":
|
|
1370
1745
|
riskColor = "blue";
|
|
1371
|
-
riskIcon =
|
|
1746
|
+
riskIcon = styleText9(["blue"], "\u25CF");
|
|
1372
1747
|
break;
|
|
1373
1748
|
default:
|
|
1374
1749
|
riskColor = "blue";
|
|
1375
|
-
riskIcon =
|
|
1376
|
-
}
|
|
1377
|
-
const riskText =
|
|
1378
|
-
const
|
|
1379
|
-
|
|
1750
|
+
riskIcon = styleText9(["blue"], "\u25CF");
|
|
1751
|
+
}
|
|
1752
|
+
const riskText = styleText9([riskColor], `${riskIcon} ${riskLevel.toUpperCase()} RISK`);
|
|
1753
|
+
const credsBySource = credentialVars.reduce((acc, cv) => {
|
|
1754
|
+
const source = cv.source || "env";
|
|
1755
|
+
if (!acc[source]) {
|
|
1756
|
+
acc[source] = [];
|
|
1757
|
+
}
|
|
1758
|
+
acc[source].push(cv);
|
|
1759
|
+
return acc;
|
|
1760
|
+
}, {});
|
|
1761
|
+
const sourceSummaries = Object.entries(credsBySource).map(([source, creds]) => {
|
|
1762
|
+
const sourceIcon = getSourceIcon(source);
|
|
1763
|
+
const credList = creds.map((cv) => `${cv.name}=${cv.value}`).join(", ");
|
|
1764
|
+
return `${sourceIcon}${source}: ${credList}`;
|
|
1765
|
+
});
|
|
1766
|
+
const credentialSummary = sourceSummaries.join(" | ");
|
|
1767
|
+
return `${riskText} ${styleText9(["dim"], `(${credentialVars.length} creds: ${credentialSummary})`)}`;
|
|
1380
1768
|
}
|
|
1381
1769
|
__name(CredentialWarningComponent, "CredentialWarningComponent");
|
|
1770
|
+
function getSourceIcon(source) {
|
|
1771
|
+
switch (source) {
|
|
1772
|
+
case "env":
|
|
1773
|
+
return "\u{1F331} ";
|
|
1774
|
+
// Environment variable
|
|
1775
|
+
case "args":
|
|
1776
|
+
return "\u26A1 ";
|
|
1777
|
+
// Command argument
|
|
1778
|
+
case "headers":
|
|
1779
|
+
return "\u{1F517} ";
|
|
1780
|
+
// HTTP header
|
|
1781
|
+
default:
|
|
1782
|
+
return "\u{1F4CB} ";
|
|
1783
|
+
}
|
|
1784
|
+
}
|
|
1785
|
+
__name(getSourceIcon, "getSourceIcon");
|
|
1382
1786
|
|
|
1383
1787
|
// src/components/summary.ts
|
|
1384
|
-
import { styleText as
|
|
1788
|
+
import { styleText as styleText10 } from "util";
|
|
1385
1789
|
function SummaryComponent(stats) {
|
|
1386
|
-
const { totalServers, runningServers, highRiskCredentials, transportBreakdown } = stats;
|
|
1790
|
+
const { totalServers, runningServers, highRiskCredentials, implicitLatestVersions, transportBreakdown } = stats;
|
|
1387
1791
|
const runningBar = createProgressBar(runningServers, totalServers, 20, "green");
|
|
1388
1792
|
const securityBar = createProgressBar(highRiskCredentials, totalServers, 20, "red");
|
|
1793
|
+
const versionBar = createProgressBar(implicitLatestVersions, totalServers, 20, "red");
|
|
1389
1794
|
const transportText = `stdio: ${transportBreakdown.stdio} | SSE: ${transportBreakdown.sse} | HTTP: ${transportBreakdown.http}`;
|
|
1390
1795
|
const lines = [
|
|
1391
1796
|
"SUMMARY",
|
|
1392
1797
|
` SERVERS ${runningBar} ${runningServers} / ${totalServers} Running`,
|
|
1393
1798
|
` SECURITY ${securityBar} ${highRiskCredentials} / ${totalServers} High Risk Credentials`,
|
|
1799
|
+
` VERSION ${versionBar} ${implicitLatestVersions} / ${totalServers} Implicit Latest`,
|
|
1394
1800
|
` TRANSPORT ${transportText}`
|
|
1395
1801
|
];
|
|
1396
1802
|
return lines.join("\n");
|
|
@@ -1407,11 +1813,11 @@ function createProgressBar(count, total, width, color) {
|
|
|
1407
1813
|
let filled;
|
|
1408
1814
|
let empty;
|
|
1409
1815
|
if (color === "green") {
|
|
1410
|
-
filled =
|
|
1411
|
-
empty =
|
|
1816
|
+
filled = styleText10(["greenBright"], "\u2588".repeat(filledWidth));
|
|
1817
|
+
empty = styleText10(["green"], "\u2591".repeat(emptyWidth));
|
|
1412
1818
|
} else {
|
|
1413
|
-
filled =
|
|
1414
|
-
empty =
|
|
1819
|
+
filled = styleText10(["redBright"], "\u2588".repeat(filledWidth));
|
|
1820
|
+
empty = styleText10(["red"], "\u2591".repeat(emptyWidth));
|
|
1415
1821
|
}
|
|
1416
1822
|
return `${filled}${empty}`;
|
|
1417
1823
|
}
|
|
@@ -1433,9 +1839,9 @@ var RenderService = class _RenderService {
|
|
|
1433
1839
|
}
|
|
1434
1840
|
static printMcpServers(data) {
|
|
1435
1841
|
if (data.length === 0) return;
|
|
1436
|
-
const headers = ["STATUS", "NAME", "SOURCE", "TRANSPORT", "CREDENTIALS"];
|
|
1437
|
-
const keys = ["status", "name", "source", "transport", "credentials"];
|
|
1438
|
-
const centerColumns = [0,
|
|
1842
|
+
const headers = ["STATUS", "NAME", "VERSION", "SOURCE", "TRANSPORT", "CREDENTIALS"];
|
|
1843
|
+
const keys = ["status", "name", "versionInfo", "source", "transport", "credentials"];
|
|
1844
|
+
const centerColumns = [0, 3, 4];
|
|
1439
1845
|
const leftPadding = " ";
|
|
1440
1846
|
const columnWidths = headers.map((header, index) => {
|
|
1441
1847
|
const headerWidth = _RenderService.getVisibleLength(render2(header));
|
|
@@ -1453,6 +1859,9 @@ var RenderService = class _RenderService {
|
|
|
1453
1859
|
if (keys[index] === "name") {
|
|
1454
1860
|
text = render4(text);
|
|
1455
1861
|
}
|
|
1862
|
+
if (keys[index] === "versionInfo") {
|
|
1863
|
+
text = render6(row[keys[index]]);
|
|
1864
|
+
}
|
|
1456
1865
|
if (keys[index] === "credentials") {
|
|
1457
1866
|
text = CredentialWarningComponent(row[keys[index]]);
|
|
1458
1867
|
}
|
|
@@ -1499,6 +1908,9 @@ var RenderService = class _RenderService {
|
|
|
1499
1908
|
if (key === "name") {
|
|
1500
1909
|
text = render4(text);
|
|
1501
1910
|
}
|
|
1911
|
+
if (key === "versionInfo") {
|
|
1912
|
+
text = render6(row[key]);
|
|
1913
|
+
}
|
|
1502
1914
|
if (key === "credentials") {
|
|
1503
1915
|
text = CredentialWarningComponent(row[key]);
|
|
1504
1916
|
}
|
|
@@ -1547,10 +1959,10 @@ var RenderService = class _RenderService {
|
|
|
1547
1959
|
return render2(row[key]).padEnd(columnWidths[index2] + paddingNormalizer);
|
|
1548
1960
|
}
|
|
1549
1961
|
if (row["key"] === "FILE") {
|
|
1550
|
-
return
|
|
1962
|
+
return render7(row[key]).padEnd(columnWidths[index2] + paddingNormalizer);
|
|
1551
1963
|
}
|
|
1552
1964
|
if (row["key"] === "PARSABLE") {
|
|
1553
|
-
return
|
|
1965
|
+
return render8(row[key]).padEnd(columnWidths[index2] + paddingNormalizer);
|
|
1554
1966
|
}
|
|
1555
1967
|
return String(row[key]).padEnd(columnWidths[index2] + paddingNormalizer);
|
|
1556
1968
|
}).join(" ");
|
|
@@ -1571,8 +1983,8 @@ var RenderService = class _RenderService {
|
|
|
1571
1983
|
let filled;
|
|
1572
1984
|
let empty;
|
|
1573
1985
|
if (count > 0) {
|
|
1574
|
-
filled =
|
|
1575
|
-
empty =
|
|
1986
|
+
filled = styleText11(["greenBright"], "\u2588".repeat(filledWidth));
|
|
1987
|
+
empty = styleText11(["green"], "\u2591".repeat(emptyWidth));
|
|
1576
1988
|
} else {
|
|
1577
1989
|
filled = "\u2588".repeat(filledWidth);
|
|
1578
1990
|
empty = "\u2591".repeat(emptyWidth);
|
|
@@ -1613,6 +2025,7 @@ async function init() {
|
|
|
1613
2025
|
let totalServers = 0;
|
|
1614
2026
|
let totalRunning = 0;
|
|
1615
2027
|
let totalHighRiskCredentials = 0;
|
|
2028
|
+
let totalImplicitLatestVersions = 0;
|
|
1616
2029
|
const transportCounts = { stdio: 0, sse: 0, http: 0 };
|
|
1617
2030
|
for (const groupName of Object.keys(mcpFilesList)) {
|
|
1618
2031
|
const group = mcpFilesList[groupName];
|
|
@@ -1637,6 +2050,9 @@ async function init() {
|
|
|
1637
2050
|
if (server.credentials?.hasCredentials && server.credentials?.riskLevel === "high") {
|
|
1638
2051
|
totalHighRiskCredentials++;
|
|
1639
2052
|
}
|
|
2053
|
+
if (server.versionInfo?.isLatest) {
|
|
2054
|
+
totalImplicitLatestVersions++;
|
|
2055
|
+
}
|
|
1640
2056
|
}
|
|
1641
2057
|
const mcpGroupData = [
|
|
1642
2058
|
{ key: "PROVIDER", value: group.friendlyName },
|
|
@@ -1660,6 +2076,7 @@ async function init() {
|
|
|
1660
2076
|
totalServers,
|
|
1661
2077
|
runningServers: totalRunning,
|
|
1662
2078
|
highRiskCredentials: totalHighRiskCredentials,
|
|
2079
|
+
implicitLatestVersions: totalImplicitLatestVersions,
|
|
1663
2080
|
transportBreakdown: transportCounts
|
|
1664
2081
|
};
|
|
1665
2082
|
RenderService.printSummary(summaryStats);
|
|
@@ -1669,7 +2086,7 @@ init().then(() => {
|
|
|
1669
2086
|
console.log("\n");
|
|
1670
2087
|
});
|
|
1671
2088
|
function exitWithError(message) {
|
|
1672
|
-
console.error(`${
|
|
2089
|
+
console.error(`${styleText12(["red"], "\u25CF")} ${message}
|
|
1673
2090
|
`);
|
|
1674
2091
|
process.exit(1);
|
|
1675
2092
|
}
|