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/main.mjs
CHANGED
|
@@ -102,6 +102,52 @@ var MCPPathRegistry = class _MCPPathRegistry {
|
|
|
102
102
|
{ filePath: path.join(".gemini", "settings.json"), type: "local" }
|
|
103
103
|
]
|
|
104
104
|
};
|
|
105
|
+
static LINUX_PATHS = {
|
|
106
|
+
claude: [
|
|
107
|
+
{ filePath: path.join(process.env.HOME || "", ".config", "Claude", "claude_desktop_config.json"), type: "global" }
|
|
108
|
+
],
|
|
109
|
+
claude_code: [
|
|
110
|
+
{ filePath: ".mcp.json", type: "local" }
|
|
111
|
+
],
|
|
112
|
+
cursor: [
|
|
113
|
+
{ filePath: path.join(process.env.HOME || "", ".cursor", "mcp.json"), type: "global" },
|
|
114
|
+
{ filePath: path.join(".cursor", "mcp.json"), type: "local" }
|
|
115
|
+
],
|
|
116
|
+
vscode: [
|
|
117
|
+
{ filePath: path.join(".vscode", "mcp.json"), type: "local" },
|
|
118
|
+
{ filePath: path.join(process.env.HOME || "", ".config", "Code", "User", "settings.json"), type: "global" },
|
|
119
|
+
{ filePath: path.join(process.env.HOME || "", ".config", "Code - Insiders", "User", "settings.json"), type: "global" },
|
|
120
|
+
{ filePath: path.join(process.env.HOME || "", ".config", "Code", "User", "mcp.json"), type: "global" },
|
|
121
|
+
{ filePath: path.join(process.env.HOME || "", ".config", "Code - Insiders", "User", "mcp.json"), type: "global" },
|
|
122
|
+
{ filePath: path.join(process.env.HOME || "", ".mcp.json"), type: "global" }
|
|
123
|
+
],
|
|
124
|
+
cline: [
|
|
125
|
+
{ filePath: path.join(process.env.HOME || "", ".config", "Code", "User", "globalStorage", "saoudrizwan.claude-dev", "settings", "cline_mcp_settings.json"), type: "global" },
|
|
126
|
+
{ filePath: path.join(process.env.HOME || "", ".config", "Code - Insiders", "User", "globalStorage", "saoudrizwan.claude-dev", "settings", "cline_mcp_settings.json"), type: "global" }
|
|
127
|
+
],
|
|
128
|
+
windsurf: [
|
|
129
|
+
{ filePath: path.join(".codeium", "windsurf", "mcp_config.json"), type: "local" }
|
|
130
|
+
],
|
|
131
|
+
roo: [
|
|
132
|
+
{ filePath: path.join(process.env.HOME || "", ".config", "Code", "User", "globalStorage", "rooveterinaryinc.roo-cline", "settings", "cline_mcp_settings.json"), type: "global" },
|
|
133
|
+
{ filePath: path.join(process.env.HOME || "", ".config", "Code - Insiders", "User", "globalStorage", "rooveterinaryinc.roo-cline", "settings", "cline_mcp_settings.json"), type: "global" }
|
|
134
|
+
],
|
|
135
|
+
"intellij-github-copilot": [
|
|
136
|
+
{ filePath: path.join(process.env.HOME || "", ".config", "github-copilot", "intellij", "mcp.json"), type: "global" }
|
|
137
|
+
],
|
|
138
|
+
junie: [
|
|
139
|
+
{ filePath: path.join(process.env.HOME || "", ".junie", "mcp.json"), type: "global" },
|
|
140
|
+
{ filePath: path.join(".junie", "mcp", "mcp.json"), type: "local" }
|
|
141
|
+
],
|
|
142
|
+
zed: [
|
|
143
|
+
{ filePath: path.join(process.env.HOME || "", ".config", "zed", "settings.json"), type: "global" },
|
|
144
|
+
{ filePath: path.join(".zed", "settings.json"), type: "local" }
|
|
145
|
+
],
|
|
146
|
+
gemini: [
|
|
147
|
+
{ filePath: path.join(process.env.HOME || "", ".gemini", "settings.json"), type: "global" },
|
|
148
|
+
{ filePath: path.join(".gemini", "settings.json"), type: "local" }
|
|
149
|
+
]
|
|
150
|
+
};
|
|
105
151
|
customApps = /* @__PURE__ */ new Map();
|
|
106
152
|
/**
|
|
107
153
|
* Get all MCP configuration file paths for a specific operating system
|
|
@@ -114,6 +160,8 @@ var MCPPathRegistry = class _MCPPathRegistry {
|
|
|
114
160
|
case "darwin":
|
|
115
161
|
case "macos":
|
|
116
162
|
return { ..._MCPPathRegistry.DARWIN_PATHS };
|
|
163
|
+
case "linux":
|
|
164
|
+
return { ..._MCPPathRegistry.LINUX_PATHS };
|
|
117
165
|
default:
|
|
118
166
|
throw new Error(`Unsupported operating system: ${os}`);
|
|
119
167
|
}
|
|
@@ -140,7 +188,7 @@ var MCPPathRegistry = class _MCPPathRegistry {
|
|
|
140
188
|
* Get all supported operating systems
|
|
141
189
|
*/
|
|
142
190
|
getSupportedOperatingSystems() {
|
|
143
|
-
return ["win32", "darwin"];
|
|
191
|
+
return ["win32", "darwin", "linux"];
|
|
144
192
|
}
|
|
145
193
|
/**
|
|
146
194
|
* Register a custom app with custom paths for a specific OS
|
|
@@ -357,45 +405,17 @@ var CredentialDetectionService = class {
|
|
|
357
405
|
*/
|
|
358
406
|
static CREDENTIAL_PATTERNS = {
|
|
359
407
|
high: [
|
|
360
|
-
//
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
/access[_-]?token/i,
|
|
364
|
-
/secret[_-]?key/i,
|
|
365
|
-
/private[_-]?key/i,
|
|
366
|
-
// Authentication Tokens
|
|
367
|
-
/auth[_-]?token/i,
|
|
368
|
-
/bearer[_-]?token/i,
|
|
369
|
-
/jwt[_-]?token/i,
|
|
370
|
-
/oauth[_-]?token/i,
|
|
408
|
+
// Generic Key and Token patterns (broad matching)
|
|
409
|
+
/.*key.*/i,
|
|
410
|
+
/.*token.*/i,
|
|
371
411
|
// Passwords
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
// Credentials
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
/openai[_-]?api[_-]?key/i,
|
|
380
|
-
/anthropic[_-]?api[_-]?key/i,
|
|
381
|
-
/firecrawl[_-]?api[_-]?key/i,
|
|
382
|
-
/github[_-]?token/i,
|
|
383
|
-
/gitlab[_-]?token/i,
|
|
384
|
-
/bitbucket[_-]?token/i,
|
|
385
|
-
// Database passwords
|
|
386
|
-
/db[_-]?password/i,
|
|
387
|
-
/database[_-]?password/i,
|
|
388
|
-
/redis[_-]?password/i,
|
|
389
|
-
/postgres[_-]?password/i,
|
|
390
|
-
/mysql[_-]?password/i,
|
|
391
|
-
// Cloud services
|
|
392
|
-
/aws[_-]?secret[_-]?access[_-]?key/i,
|
|
393
|
-
/aws[_-]?access[_-]?key[_-]?id/i,
|
|
394
|
-
/azure[_-]?key/i,
|
|
395
|
-
/gcp[_-]?key/i,
|
|
396
|
-
/google[_-]?api[_-]?key/i,
|
|
397
|
-
/gemini[_-]?api[_-]?key/i,
|
|
398
|
-
/claude[_-]?api[_-]?key/i
|
|
412
|
+
/.*password.*/i,
|
|
413
|
+
/.*passwd.*/i,
|
|
414
|
+
/.*pwd.*/i,
|
|
415
|
+
// Credentials and Secrets
|
|
416
|
+
/.*credential.*/i,
|
|
417
|
+
/.*creds.*/i,
|
|
418
|
+
/.*secret.*/i
|
|
399
419
|
],
|
|
400
420
|
low: [
|
|
401
421
|
// Organization and Account IDs
|
|
@@ -406,6 +426,178 @@ var CredentialDetectionService = class {
|
|
|
406
426
|
/openai[_-]?org[_-]?id/i
|
|
407
427
|
]
|
|
408
428
|
};
|
|
429
|
+
/**
|
|
430
|
+
* Argument patterns for detecting credentials in command-line arguments
|
|
431
|
+
*/
|
|
432
|
+
static ARGUMENT_PATTERNS = {
|
|
433
|
+
high: [
|
|
434
|
+
// API key arguments
|
|
435
|
+
/--api-key/i,
|
|
436
|
+
/--apikey/i,
|
|
437
|
+
/--key/i,
|
|
438
|
+
// Token arguments
|
|
439
|
+
/--token/i,
|
|
440
|
+
/--access-token/i,
|
|
441
|
+
/--auth-token/i,
|
|
442
|
+
/--bearer-token/i,
|
|
443
|
+
// Password arguments
|
|
444
|
+
/--password/i,
|
|
445
|
+
/--passwd/i,
|
|
446
|
+
/--pwd/i,
|
|
447
|
+
// Secret arguments
|
|
448
|
+
/--secret/i,
|
|
449
|
+
/--client-secret/i,
|
|
450
|
+
// Authentication arguments
|
|
451
|
+
/--auth/i,
|
|
452
|
+
/--authorization/i,
|
|
453
|
+
/--credentials/i,
|
|
454
|
+
/--creds/i
|
|
455
|
+
],
|
|
456
|
+
low: [
|
|
457
|
+
// Organization and account IDs
|
|
458
|
+
/--org-id/i,
|
|
459
|
+
/--organization-id/i,
|
|
460
|
+
/--account-id/i,
|
|
461
|
+
/--user-id/i
|
|
462
|
+
]
|
|
463
|
+
};
|
|
464
|
+
/**
|
|
465
|
+
* Header patterns for detecting credentials in HTTP headers
|
|
466
|
+
*/
|
|
467
|
+
static HEADER_PATTERNS = {
|
|
468
|
+
high: [
|
|
469
|
+
// Authorization headers
|
|
470
|
+
/authorization/i,
|
|
471
|
+
/auth/i,
|
|
472
|
+
// API key headers
|
|
473
|
+
/x-api-key/i,
|
|
474
|
+
/api-key/i,
|
|
475
|
+
/apikey/i,
|
|
476
|
+
// Token headers
|
|
477
|
+
/x-access-token/i,
|
|
478
|
+
/access-token/i,
|
|
479
|
+
/bearer-token/i,
|
|
480
|
+
/x-auth-token/i,
|
|
481
|
+
/auth-token/i,
|
|
482
|
+
// Custom authentication headers
|
|
483
|
+
/x-.*-key/i,
|
|
484
|
+
/x-.*-token/i,
|
|
485
|
+
/x-.*-secret/i,
|
|
486
|
+
// Service-specific patterns
|
|
487
|
+
/x-github-token/i,
|
|
488
|
+
/x-openai-key/i,
|
|
489
|
+
/x-anthropic-key/i
|
|
490
|
+
],
|
|
491
|
+
low: [
|
|
492
|
+
// User identification headers
|
|
493
|
+
/x-user-id/i,
|
|
494
|
+
/x-org-id/i,
|
|
495
|
+
/x-organization-id/i,
|
|
496
|
+
/x-account-id/i
|
|
497
|
+
]
|
|
498
|
+
};
|
|
499
|
+
/**
|
|
500
|
+
* Variable substitution pattern to detect safe variable references
|
|
501
|
+
*/
|
|
502
|
+
static VARIABLE_SUBSTITUTION_PATTERN = /^\$\{[^}]+\}$/;
|
|
503
|
+
/**
|
|
504
|
+
* Check if a value is a variable substitution pattern (e.g., ${input:token})
|
|
505
|
+
*/
|
|
506
|
+
static isVariableSubstitution(value) {
|
|
507
|
+
return this.VARIABLE_SUBSTITUTION_PATTERN.test(value);
|
|
508
|
+
}
|
|
509
|
+
/**
|
|
510
|
+
* Analyze command-line arguments for potential credentials
|
|
511
|
+
*/
|
|
512
|
+
static analyzeArguments(args) {
|
|
513
|
+
if (!args || !Array.isArray(args) || args.length === 0) {
|
|
514
|
+
return {
|
|
515
|
+
hasCredentials: false,
|
|
516
|
+
credentialVars: [],
|
|
517
|
+
riskLevel: "none"
|
|
518
|
+
};
|
|
519
|
+
}
|
|
520
|
+
const credentialVars = [];
|
|
521
|
+
for (let i = 0; i < args.length - 1; i++) {
|
|
522
|
+
const arg = args[i];
|
|
523
|
+
const nextArg = args[i + 1];
|
|
524
|
+
const isHighRiskArg = this.ARGUMENT_PATTERNS.high.some((pattern) => pattern.test(arg));
|
|
525
|
+
const isLowRiskArg = this.ARGUMENT_PATTERNS.low.some((pattern) => pattern.test(arg));
|
|
526
|
+
if (isHighRiskArg || isLowRiskArg) {
|
|
527
|
+
if (nextArg && !nextArg.startsWith("-")) {
|
|
528
|
+
credentialVars.push({
|
|
529
|
+
name: arg,
|
|
530
|
+
value: this.maskValue(nextArg),
|
|
531
|
+
riskLevel: isHighRiskArg ? "high" : "low",
|
|
532
|
+
source: "args"
|
|
533
|
+
});
|
|
534
|
+
i++;
|
|
535
|
+
}
|
|
536
|
+
}
|
|
537
|
+
}
|
|
538
|
+
const hasCredentials = credentialVars.length > 0;
|
|
539
|
+
const riskLevel = this.calculateOverallRiskLevel(credentialVars);
|
|
540
|
+
return {
|
|
541
|
+
hasCredentials,
|
|
542
|
+
credentialVars,
|
|
543
|
+
riskLevel
|
|
544
|
+
};
|
|
545
|
+
}
|
|
546
|
+
/**
|
|
547
|
+
* Analyze HTTP headers for potential credentials
|
|
548
|
+
*/
|
|
549
|
+
static analyzeHeaders(headers) {
|
|
550
|
+
if (!headers || typeof headers !== "object") {
|
|
551
|
+
return {
|
|
552
|
+
hasCredentials: false,
|
|
553
|
+
credentialVars: [],
|
|
554
|
+
riskLevel: "none"
|
|
555
|
+
};
|
|
556
|
+
}
|
|
557
|
+
const credentialVars = [];
|
|
558
|
+
for (const [name, value] of Object.entries(headers)) {
|
|
559
|
+
if (this.isVariableSubstitution(value)) {
|
|
560
|
+
continue;
|
|
561
|
+
}
|
|
562
|
+
const isHighRiskHeader = this.HEADER_PATTERNS.high.some((pattern) => pattern.test(name));
|
|
563
|
+
const isLowRiskHeader = this.HEADER_PATTERNS.low.some((pattern) => pattern.test(name));
|
|
564
|
+
if (isHighRiskHeader || isLowRiskHeader) {
|
|
565
|
+
credentialVars.push({
|
|
566
|
+
name,
|
|
567
|
+
value: this.maskValue(value),
|
|
568
|
+
riskLevel: isHighRiskHeader ? "high" : "low",
|
|
569
|
+
source: "headers"
|
|
570
|
+
});
|
|
571
|
+
}
|
|
572
|
+
}
|
|
573
|
+
const hasCredentials = credentialVars.length > 0;
|
|
574
|
+
const riskLevel = this.calculateOverallRiskLevel(credentialVars);
|
|
575
|
+
return {
|
|
576
|
+
hasCredentials,
|
|
577
|
+
credentialVars,
|
|
578
|
+
riskLevel
|
|
579
|
+
};
|
|
580
|
+
}
|
|
581
|
+
/**
|
|
582
|
+
* Comprehensive analysis of server configuration for credentials
|
|
583
|
+
*/
|
|
584
|
+
static analyzeServerConfig(config) {
|
|
585
|
+
const envResult = this.analyzeEnvironmentVariables(config.env);
|
|
586
|
+
const argsResult = this.analyzeArguments(config.args);
|
|
587
|
+
const headersResult = this.analyzeHeaders(config.headers);
|
|
588
|
+
const allCredentialVars = [
|
|
589
|
+
...envResult.credentialVars,
|
|
590
|
+
...argsResult.credentialVars,
|
|
591
|
+
...headersResult.credentialVars
|
|
592
|
+
];
|
|
593
|
+
const hasCredentials = allCredentialVars.length > 0;
|
|
594
|
+
const riskLevel = this.calculateOverallRiskLevel(allCredentialVars);
|
|
595
|
+
return {
|
|
596
|
+
hasCredentials,
|
|
597
|
+
credentialVars: allCredentialVars,
|
|
598
|
+
riskLevel
|
|
599
|
+
};
|
|
600
|
+
}
|
|
409
601
|
/**
|
|
410
602
|
* Check if an environment variable name suggests it might contain credentials
|
|
411
603
|
*/
|
|
@@ -425,11 +617,15 @@ var CredentialDetectionService = class {
|
|
|
425
617
|
}
|
|
426
618
|
const credentialVars = [];
|
|
427
619
|
for (const [name, value] of Object.entries(env)) {
|
|
620
|
+
if (this.isVariableSubstitution(value)) {
|
|
621
|
+
continue;
|
|
622
|
+
}
|
|
428
623
|
if (this.isPotentialCredential(name)) {
|
|
429
624
|
credentialVars.push({
|
|
430
625
|
name,
|
|
431
626
|
value: this.maskValue(value),
|
|
432
|
-
riskLevel: this.assessRiskLevel(name)
|
|
627
|
+
riskLevel: this.assessRiskLevel(name),
|
|
628
|
+
source: "env"
|
|
433
629
|
});
|
|
434
630
|
}
|
|
435
631
|
}
|
|
@@ -551,6 +747,157 @@ var DirectoryBubbleService = class {
|
|
|
551
747
|
}
|
|
552
748
|
};
|
|
553
749
|
|
|
750
|
+
// src/services/mcp-version-detection-service.ts
|
|
751
|
+
var MCPVersionDetectionService = class {
|
|
752
|
+
static {
|
|
753
|
+
__name(this, "MCPVersionDetectionService");
|
|
754
|
+
}
|
|
755
|
+
/**
|
|
756
|
+
* Analyze a server configuration to extract version information
|
|
757
|
+
* @param command - The command used to run the server
|
|
758
|
+
* @param args - Array of arguments passed to the command
|
|
759
|
+
* @returns PackageVersionInfo if analysis is possible, null otherwise
|
|
760
|
+
*/
|
|
761
|
+
analyzeServerVersion(command, args) {
|
|
762
|
+
if (!["npx", "uvx", "uv"].includes(command)) {
|
|
763
|
+
return null;
|
|
764
|
+
}
|
|
765
|
+
if (!args || args.length === 0) {
|
|
766
|
+
return null;
|
|
767
|
+
}
|
|
768
|
+
const packageName = this.extractPackageName(command, args);
|
|
769
|
+
if (!packageName) {
|
|
770
|
+
return null;
|
|
771
|
+
}
|
|
772
|
+
const { name, version } = this.parsePackageVersion(packageName);
|
|
773
|
+
const isPinned = this.isPinnedVersion(version);
|
|
774
|
+
return {
|
|
775
|
+
packageName: name,
|
|
776
|
+
version,
|
|
777
|
+
isPinned,
|
|
778
|
+
isLatest: !isPinned
|
|
779
|
+
};
|
|
780
|
+
}
|
|
781
|
+
/**
|
|
782
|
+
* Extract the package name based on the command type
|
|
783
|
+
* @param command - The command used to run the server
|
|
784
|
+
* @param args - Array of arguments passed to the command
|
|
785
|
+
* @returns The package name/spec or null if not found
|
|
786
|
+
*/
|
|
787
|
+
extractPackageName(command, args) {
|
|
788
|
+
switch (command) {
|
|
789
|
+
case "npx":
|
|
790
|
+
return this.extractNpxPackageName(args);
|
|
791
|
+
case "uvx":
|
|
792
|
+
return this.extractUvxPackageName(args);
|
|
793
|
+
case "uv":
|
|
794
|
+
return this.extractUvPackageName(args);
|
|
795
|
+
default:
|
|
796
|
+
return null;
|
|
797
|
+
}
|
|
798
|
+
}
|
|
799
|
+
/**
|
|
800
|
+
* Extract the package name from npx arguments
|
|
801
|
+
* @param args - Array of arguments passed to npx
|
|
802
|
+
* @returns The package name/spec or null if not found
|
|
803
|
+
*/
|
|
804
|
+
extractNpxPackageName(args) {
|
|
805
|
+
if (!args || args.length === 0) {
|
|
806
|
+
return null;
|
|
807
|
+
}
|
|
808
|
+
const yIndex = args.indexOf("-y");
|
|
809
|
+
if (yIndex !== -1 && yIndex + 1 < args.length) {
|
|
810
|
+
return args[yIndex + 1];
|
|
811
|
+
}
|
|
812
|
+
const yesIndex = args.indexOf("--yes");
|
|
813
|
+
if (yesIndex !== -1 && yesIndex + 1 < args.length) {
|
|
814
|
+
return args[yesIndex + 1];
|
|
815
|
+
}
|
|
816
|
+
for (let i = 0; i < args.length; i++) {
|
|
817
|
+
const arg = args[i];
|
|
818
|
+
if (!arg.startsWith("-")) {
|
|
819
|
+
if (i > 0) {
|
|
820
|
+
const prevArg = args[i - 1];
|
|
821
|
+
if (prevArg === "--registry" || prevArg === "-r" || prevArg === "--package" || prevArg === "-p") {
|
|
822
|
+
continue;
|
|
823
|
+
}
|
|
824
|
+
}
|
|
825
|
+
return arg;
|
|
826
|
+
}
|
|
827
|
+
}
|
|
828
|
+
return null;
|
|
829
|
+
}
|
|
830
|
+
/**
|
|
831
|
+
* Extract the package name from uvx arguments
|
|
832
|
+
* @param args - Array of arguments passed to uvx
|
|
833
|
+
* @returns The package name/spec or null if not found
|
|
834
|
+
*/
|
|
835
|
+
extractUvxPackageName(args) {
|
|
836
|
+
if (!args || args.length === 0) {
|
|
837
|
+
return null;
|
|
838
|
+
}
|
|
839
|
+
return args[0];
|
|
840
|
+
}
|
|
841
|
+
/**
|
|
842
|
+
* Extract the package name from uv arguments
|
|
843
|
+
* @param args - Array of arguments passed to uv
|
|
844
|
+
* @returns The package name/spec or null if not found
|
|
845
|
+
*/
|
|
846
|
+
extractUvPackageName(args) {
|
|
847
|
+
if (!args || args.length === 0) {
|
|
848
|
+
return null;
|
|
849
|
+
}
|
|
850
|
+
const runIndex = args.indexOf("run");
|
|
851
|
+
if (runIndex !== -1 && runIndex + 1 < args.length) {
|
|
852
|
+
return args[runIndex + 1];
|
|
853
|
+
}
|
|
854
|
+
return null;
|
|
855
|
+
}
|
|
856
|
+
/**
|
|
857
|
+
* Parse a package specification to extract name and version
|
|
858
|
+
* @param packageSpec - Package specification (e.g., "package@1.0.0" or "package")
|
|
859
|
+
* @returns Object with name and optional version
|
|
860
|
+
*/
|
|
861
|
+
parsePackageVersion(packageSpec) {
|
|
862
|
+
if (!packageSpec) {
|
|
863
|
+
return { name: "", version: void 0 };
|
|
864
|
+
}
|
|
865
|
+
if (packageSpec.startsWith("@")) {
|
|
866
|
+
const parts = packageSpec.split("@");
|
|
867
|
+
if (parts.length === 2) {
|
|
868
|
+
return { name: packageSpec, version: void 0 };
|
|
869
|
+
} else if (parts.length === 3) {
|
|
870
|
+
return {
|
|
871
|
+
name: `@${parts[1]}`,
|
|
872
|
+
version: parts[2]
|
|
873
|
+
};
|
|
874
|
+
}
|
|
875
|
+
}
|
|
876
|
+
const atIndex = packageSpec.lastIndexOf("@");
|
|
877
|
+
if (atIndex > 0) {
|
|
878
|
+
return {
|
|
879
|
+
name: packageSpec.substring(0, atIndex),
|
|
880
|
+
version: packageSpec.substring(atIndex + 1)
|
|
881
|
+
};
|
|
882
|
+
}
|
|
883
|
+
return { name: packageSpec, version: void 0 };
|
|
884
|
+
}
|
|
885
|
+
/**
|
|
886
|
+
* Determine if a version represents a pinned version
|
|
887
|
+
* @param version - The version string to check
|
|
888
|
+
* @returns true if the version is pinned, false if it's latest/implicit
|
|
889
|
+
*/
|
|
890
|
+
isPinnedVersion(version) {
|
|
891
|
+
if (!version) {
|
|
892
|
+
return false;
|
|
893
|
+
}
|
|
894
|
+
if (version === "latest") {
|
|
895
|
+
return false;
|
|
896
|
+
}
|
|
897
|
+
return true;
|
|
898
|
+
}
|
|
899
|
+
};
|
|
900
|
+
|
|
554
901
|
// src/utils/url-utils.ts
|
|
555
902
|
function extractHostname(urlString) {
|
|
556
903
|
try {
|
|
@@ -575,12 +922,14 @@ var MCPConfigService = class {
|
|
|
575
922
|
currentOS;
|
|
576
923
|
debug;
|
|
577
924
|
directoryBubbleService;
|
|
925
|
+
versionDetectionService;
|
|
578
926
|
enableDirectoryBubbling;
|
|
579
927
|
constructor(options = {}) {
|
|
580
928
|
this.pathRegistry = new MCPPathRegistry();
|
|
581
929
|
this.currentOS = platform();
|
|
582
930
|
this.debug = util.debuglog("ls-mcp");
|
|
583
931
|
this.directoryBubbleService = new DirectoryBubbleService();
|
|
932
|
+
this.versionDetectionService = new MCPVersionDetectionService();
|
|
584
933
|
this.enableDirectoryBubbling = options.enableDirectoryBubbling ?? false;
|
|
585
934
|
}
|
|
586
935
|
/**
|
|
@@ -777,6 +1126,10 @@ var MCPConfigService = class {
|
|
|
777
1126
|
} else {
|
|
778
1127
|
source = serverConfig.command || "";
|
|
779
1128
|
}
|
|
1129
|
+
const versionInfo = this.versionDetectionService.analyzeServerVersion(
|
|
1130
|
+
serverConfig.command || "",
|
|
1131
|
+
Array.isArray(serverConfig.args) ? serverConfig.args : void 0
|
|
1132
|
+
);
|
|
780
1133
|
serverInfos.push({
|
|
781
1134
|
name: serverName,
|
|
782
1135
|
command: serverConfig.command || "",
|
|
@@ -786,9 +1139,15 @@ var MCPConfigService = class {
|
|
|
786
1139
|
type: serverConfig.type,
|
|
787
1140
|
source,
|
|
788
1141
|
env: serverConfig.env,
|
|
1142
|
+
headers: serverConfig.headers,
|
|
789
1143
|
status: "stopped",
|
|
790
1144
|
// Default status, will be updated by server manager
|
|
791
|
-
|
|
1145
|
+
versionInfo: versionInfo || void 0,
|
|
1146
|
+
credentials: CredentialDetectionService.analyzeServerConfig({
|
|
1147
|
+
env: serverConfig.env,
|
|
1148
|
+
args: serverConfig.args,
|
|
1149
|
+
headers: serverConfig.headers
|
|
1150
|
+
})
|
|
792
1151
|
});
|
|
793
1152
|
}
|
|
794
1153
|
}
|
package/package.json
CHANGED
package/src/bin/cli.ts
CHANGED
|
@@ -32,6 +32,7 @@ async function init () {
|
|
|
32
32
|
let totalServers = 0
|
|
33
33
|
let totalRunning = 0
|
|
34
34
|
let totalHighRiskCredentials = 0
|
|
35
|
+
let totalImplicitLatestVersions = 0
|
|
35
36
|
const transportCounts = { stdio: 0, sse: 0, http: 0 }
|
|
36
37
|
|
|
37
38
|
for (const groupName of Object.keys(mcpFilesList)) {
|
|
@@ -68,6 +69,11 @@ async function init () {
|
|
|
68
69
|
if (server.credentials?.hasCredentials && server.credentials?.riskLevel === 'high') {
|
|
69
70
|
totalHighRiskCredentials++
|
|
70
71
|
}
|
|
72
|
+
|
|
73
|
+
// Count implicit latest versions
|
|
74
|
+
if (server.versionInfo?.isLatest) {
|
|
75
|
+
totalImplicitLatestVersions++
|
|
76
|
+
}
|
|
71
77
|
}
|
|
72
78
|
|
|
73
79
|
const mcpGroupData = [
|
|
@@ -97,6 +103,7 @@ async function init () {
|
|
|
97
103
|
totalServers,
|
|
98
104
|
runningServers: totalRunning,
|
|
99
105
|
highRiskCredentials: totalHighRiskCredentials,
|
|
106
|
+
implicitLatestVersions: totalImplicitLatestVersions,
|
|
100
107
|
transportBreakdown: transportCounts
|
|
101
108
|
}
|
|
102
109
|
|
|
@@ -28,10 +28,40 @@ export default function CredentialWarningComponent (credentials: CredentialAnaly
|
|
|
28
28
|
|
|
29
29
|
const riskText = styleText([riskColor], `${riskIcon} ${riskLevel.toUpperCase()} RISK`)
|
|
30
30
|
|
|
31
|
-
//
|
|
32
|
-
const
|
|
33
|
-
|
|
34
|
-
|
|
31
|
+
// Group credentials by source for better organization
|
|
32
|
+
const credsBySource = credentialVars.reduce((acc, cv) => {
|
|
33
|
+
const source = cv.source || 'env' // Default to env for backward compatibility
|
|
34
|
+
if (!acc[source]) {
|
|
35
|
+
acc[source] = []
|
|
36
|
+
}
|
|
37
|
+
acc[source].push(cv)
|
|
38
|
+
return acc
|
|
39
|
+
}, {} as Record<string, typeof credentialVars>)
|
|
35
40
|
|
|
36
|
-
|
|
41
|
+
// Create summary with source grouping
|
|
42
|
+
const sourceSummaries = Object.entries(credsBySource).map(([source, creds]) => {
|
|
43
|
+
const sourceIcon = getSourceIcon(source)
|
|
44
|
+
const credList = creds.map(cv => `${cv.name}=${cv.value}`).join(', ')
|
|
45
|
+
return `${sourceIcon}${source}: ${credList}`
|
|
46
|
+
})
|
|
47
|
+
|
|
48
|
+
const credentialSummary = sourceSummaries.join(' | ')
|
|
49
|
+
|
|
50
|
+
return `${riskText} ${styleText(['dim'], `(${credentialVars.length} creds: ${credentialSummary})`)}`
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Get an icon/symbol for different credential sources
|
|
55
|
+
*/
|
|
56
|
+
function getSourceIcon (source: string): string {
|
|
57
|
+
switch (source) {
|
|
58
|
+
case 'env':
|
|
59
|
+
return '🌱 ' // Environment variable
|
|
60
|
+
case 'args':
|
|
61
|
+
return '⚡ ' // Command argument
|
|
62
|
+
case 'headers':
|
|
63
|
+
return '🔗 ' // HTTP header
|
|
64
|
+
default:
|
|
65
|
+
return '📋 ' // Unknown/generic
|
|
66
|
+
}
|
|
37
67
|
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { styleText } from 'node:util'
|
|
2
|
+
import type { PackageVersionInfo } from '../types/mcp-config-service.types.js'
|
|
3
|
+
|
|
4
|
+
export default function render (versionInfo?: PackageVersionInfo): string {
|
|
5
|
+
if (!versionInfo) {
|
|
6
|
+
return ''
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
const version = versionInfo.version || 'LATEST'
|
|
10
|
+
const displayVersion = version === 'latest' ? 'LATEST' : version
|
|
11
|
+
|
|
12
|
+
if (versionInfo.isPinned) {
|
|
13
|
+
// Green circle for pinned versions (stable/safe)
|
|
14
|
+
return styleText(['green'], '●') + ' ' + displayVersion
|
|
15
|
+
} else {
|
|
16
|
+
// Red circle for latest versions (higher risk)
|
|
17
|
+
return styleText(['red'], '●') + ' ' + 'LATEST'
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -4,6 +4,7 @@ interface SummaryStats {
|
|
|
4
4
|
totalServers: number
|
|
5
5
|
runningServers: number
|
|
6
6
|
highRiskCredentials: number
|
|
7
|
+
implicitLatestVersions: number
|
|
7
8
|
transportBreakdown: {
|
|
8
9
|
stdio: number
|
|
9
10
|
sse: number
|
|
@@ -12,11 +13,12 @@ interface SummaryStats {
|
|
|
12
13
|
}
|
|
13
14
|
|
|
14
15
|
export default function SummaryComponent (stats: SummaryStats): string {
|
|
15
|
-
const { totalServers, runningServers, highRiskCredentials, transportBreakdown } = stats
|
|
16
|
+
const { totalServers, runningServers, highRiskCredentials, implicitLatestVersions, transportBreakdown } = stats
|
|
16
17
|
|
|
17
18
|
// Create progress bars (20 characters wide, following existing convention)
|
|
18
19
|
const runningBar = createProgressBar(runningServers, totalServers, 20, 'green')
|
|
19
20
|
const securityBar = createProgressBar(highRiskCredentials, totalServers, 20, 'red')
|
|
21
|
+
const versionBar = createProgressBar(implicitLatestVersions, totalServers, 20, 'red')
|
|
20
22
|
|
|
21
23
|
// Format transport breakdown
|
|
22
24
|
const transportText = `stdio: ${transportBreakdown.stdio} | SSE: ${transportBreakdown.sse} | HTTP: ${transportBreakdown.http}`
|
|
@@ -26,6 +28,7 @@ export default function SummaryComponent (stats: SummaryStats): string {
|
|
|
26
28
|
'SUMMARY',
|
|
27
29
|
` SERVERS ${runningBar} ${runningServers} / ${totalServers} Running`,
|
|
28
30
|
` SECURITY ${securityBar} ${highRiskCredentials} / ${totalServers} High Risk Credentials`,
|
|
31
|
+
` VERSION ${versionBar} ${implicitLatestVersions} / ${totalServers} Implicit Latest`,
|
|
29
32
|
` TRANSPORT ${transportText}`
|
|
30
33
|
]
|
|
31
34
|
|