ls-mcp 1.13.0 → 1.13.2
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/README.md +12 -0
- package/dist/bin/cli.cjs +72 -51
- package/dist/bin/cli.mjs +72 -51
- package/package.json +1 -1
- package/src/bin/cli.ts +40 -17
- package/src/components/summary.ts +10 -5
package/README.md
CHANGED
|
@@ -35,6 +35,18 @@
|
|
|
35
35
|
npx ls-mcp
|
|
36
36
|
```
|
|
37
37
|
|
|
38
|
+
### JSON Output
|
|
39
|
+
|
|
40
|
+
To output results in JSON format (useful for programmatic consumption):
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
npx ls-mcp --json
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
This will return a structured JSON object containing:
|
|
47
|
+
- `mcpFiles`: Complete MCP server configurations organized by provider (only includes providers with configured servers)
|
|
48
|
+
- `summary`: Statistics including total servers, running servers, credential warnings, and transport breakdown
|
|
49
|
+
|
|
38
50
|
### Debug Mode
|
|
39
51
|
|
|
40
52
|
To enable verbose debugging output, set the `NODE_DEBUG` environment variable:
|
package/dist/bin/cli.cjs
CHANGED
|
@@ -535,8 +535,8 @@ var CredentialDetectionService = class {
|
|
|
535
535
|
/**
|
|
536
536
|
* Analyze command-line arguments for potential credentials
|
|
537
537
|
*/
|
|
538
|
-
static analyzeArguments(
|
|
539
|
-
if (!
|
|
538
|
+
static analyzeArguments(args2) {
|
|
539
|
+
if (!args2 || !Array.isArray(args2) || args2.length === 0) {
|
|
540
540
|
return {
|
|
541
541
|
hasCredentials: false,
|
|
542
542
|
credentialVars: [],
|
|
@@ -544,9 +544,9 @@ var CredentialDetectionService = class {
|
|
|
544
544
|
};
|
|
545
545
|
}
|
|
546
546
|
const credentialVars = [];
|
|
547
|
-
for (let i = 0; i <
|
|
548
|
-
const arg =
|
|
549
|
-
const nextArg =
|
|
547
|
+
for (let i = 0; i < args2.length - 1; i++) {
|
|
548
|
+
const arg = args2[i];
|
|
549
|
+
const nextArg = args2[i + 1];
|
|
550
550
|
const isHighRiskArg = this.ARGUMENT_PATTERNS.high.some((pattern) => pattern.test(arg));
|
|
551
551
|
const isLowRiskArg = this.ARGUMENT_PATTERNS.low.some((pattern) => pattern.test(arg));
|
|
552
552
|
if (isHighRiskArg || isLowRiskArg) {
|
|
@@ -784,14 +784,14 @@ var MCPVersionDetectionService = class {
|
|
|
784
784
|
* @param args - Array of arguments passed to the command
|
|
785
785
|
* @returns PackageVersionInfo if analysis is possible, null otherwise
|
|
786
786
|
*/
|
|
787
|
-
analyzeServerVersion(command,
|
|
787
|
+
analyzeServerVersion(command, args2) {
|
|
788
788
|
if (!["npx", "uvx", "uv"].includes(command)) {
|
|
789
789
|
return null;
|
|
790
790
|
}
|
|
791
|
-
if (!
|
|
791
|
+
if (!args2 || args2.length === 0) {
|
|
792
792
|
return null;
|
|
793
793
|
}
|
|
794
|
-
const packageName = this.extractPackageName(command,
|
|
794
|
+
const packageName = this.extractPackageName(command, args2);
|
|
795
795
|
if (!packageName) {
|
|
796
796
|
return null;
|
|
797
797
|
}
|
|
@@ -810,14 +810,14 @@ var MCPVersionDetectionService = class {
|
|
|
810
810
|
* @param args - Array of arguments passed to the command
|
|
811
811
|
* @returns The package name/spec or null if not found
|
|
812
812
|
*/
|
|
813
|
-
extractPackageName(command,
|
|
813
|
+
extractPackageName(command, args2) {
|
|
814
814
|
switch (command) {
|
|
815
815
|
case "npx":
|
|
816
|
-
return this.extractNpxPackageName(
|
|
816
|
+
return this.extractNpxPackageName(args2);
|
|
817
817
|
case "uvx":
|
|
818
|
-
return this.extractUvxPackageName(
|
|
818
|
+
return this.extractUvxPackageName(args2);
|
|
819
819
|
case "uv":
|
|
820
|
-
return this.extractUvPackageName(
|
|
820
|
+
return this.extractUvPackageName(args2);
|
|
821
821
|
default:
|
|
822
822
|
return null;
|
|
823
823
|
}
|
|
@@ -827,23 +827,23 @@ var MCPVersionDetectionService = class {
|
|
|
827
827
|
* @param args - Array of arguments passed to npx
|
|
828
828
|
* @returns The package name/spec or null if not found
|
|
829
829
|
*/
|
|
830
|
-
extractNpxPackageName(
|
|
831
|
-
if (!
|
|
830
|
+
extractNpxPackageName(args2) {
|
|
831
|
+
if (!args2 || args2.length === 0) {
|
|
832
832
|
return null;
|
|
833
833
|
}
|
|
834
|
-
const yIndex =
|
|
835
|
-
if (yIndex !== -1 && yIndex + 1 <
|
|
836
|
-
return
|
|
834
|
+
const yIndex = args2.indexOf("-y");
|
|
835
|
+
if (yIndex !== -1 && yIndex + 1 < args2.length) {
|
|
836
|
+
return args2[yIndex + 1];
|
|
837
837
|
}
|
|
838
|
-
const yesIndex =
|
|
839
|
-
if (yesIndex !== -1 && yesIndex + 1 <
|
|
840
|
-
return
|
|
838
|
+
const yesIndex = args2.indexOf("--yes");
|
|
839
|
+
if (yesIndex !== -1 && yesIndex + 1 < args2.length) {
|
|
840
|
+
return args2[yesIndex + 1];
|
|
841
841
|
}
|
|
842
|
-
for (let i = 0; i <
|
|
843
|
-
const arg =
|
|
842
|
+
for (let i = 0; i < args2.length; i++) {
|
|
843
|
+
const arg = args2[i];
|
|
844
844
|
if (!arg.startsWith("-")) {
|
|
845
845
|
if (i > 0) {
|
|
846
|
-
const prevArg =
|
|
846
|
+
const prevArg = args2[i - 1];
|
|
847
847
|
if (prevArg === "--registry" || prevArg === "-r" || prevArg === "--package" || prevArg === "-p") {
|
|
848
848
|
continue;
|
|
849
849
|
}
|
|
@@ -858,24 +858,24 @@ var MCPVersionDetectionService = class {
|
|
|
858
858
|
* @param args - Array of arguments passed to uvx
|
|
859
859
|
* @returns The package name/spec or null if not found
|
|
860
860
|
*/
|
|
861
|
-
extractUvxPackageName(
|
|
862
|
-
if (!
|
|
861
|
+
extractUvxPackageName(args2) {
|
|
862
|
+
if (!args2 || args2.length === 0) {
|
|
863
863
|
return null;
|
|
864
864
|
}
|
|
865
|
-
return
|
|
865
|
+
return args2[0];
|
|
866
866
|
}
|
|
867
867
|
/**
|
|
868
868
|
* Extract the package name from uv arguments
|
|
869
869
|
* @param args - Array of arguments passed to uv
|
|
870
870
|
* @returns The package name/spec or null if not found
|
|
871
871
|
*/
|
|
872
|
-
extractUvPackageName(
|
|
873
|
-
if (!
|
|
872
|
+
extractUvPackageName(args2) {
|
|
873
|
+
if (!args2 || args2.length === 0) {
|
|
874
874
|
return null;
|
|
875
875
|
}
|
|
876
|
-
const runIndex =
|
|
877
|
-
if (runIndex !== -1 && runIndex + 1 <
|
|
878
|
-
return
|
|
876
|
+
const runIndex = args2.indexOf("run");
|
|
877
|
+
if (runIndex !== -1 && runIndex + 1 < args2.length) {
|
|
878
|
+
return args2[runIndex + 1];
|
|
879
879
|
}
|
|
880
880
|
return null;
|
|
881
881
|
}
|
|
@@ -1810,9 +1810,9 @@ __name(getSourceIcon, "getSourceIcon");
|
|
|
1810
1810
|
var import_node_util11 = require("util");
|
|
1811
1811
|
function SummaryComponent(stats) {
|
|
1812
1812
|
const { totalServers, runningServers, highRiskCredentials, implicitLatestVersions, transportBreakdown } = stats;
|
|
1813
|
-
const runningBar = createProgressBar(runningServers, totalServers, 20, "green");
|
|
1814
|
-
const securityBar = createProgressBar(highRiskCredentials, totalServers, 20, "red");
|
|
1815
|
-
const versionBar = createProgressBar(implicitLatestVersions, totalServers, 20, "red");
|
|
1813
|
+
const runningBar = createProgressBar(runningServers, totalServers, 20, "green", false);
|
|
1814
|
+
const securityBar = createProgressBar(highRiskCredentials, totalServers, 20, "red", true);
|
|
1815
|
+
const versionBar = createProgressBar(implicitLatestVersions, totalServers, 20, "red", true);
|
|
1816
1816
|
const transportText = `stdio: ${transportBreakdown.stdio} | SSE: ${transportBreakdown.sse} | HTTP: ${transportBreakdown.http}`;
|
|
1817
1817
|
const lines = [
|
|
1818
1818
|
"SUMMARY",
|
|
@@ -1824,7 +1824,7 @@ function SummaryComponent(stats) {
|
|
|
1824
1824
|
return lines.join("\n");
|
|
1825
1825
|
}
|
|
1826
1826
|
__name(SummaryComponent, "SummaryComponent");
|
|
1827
|
-
function createProgressBar(count, total, width, color) {
|
|
1827
|
+
function createProgressBar(count, total, width, color, emptyIsGood = false) {
|
|
1828
1828
|
if (total === 0) {
|
|
1829
1829
|
const emptyBar = "\u2591".repeat(width);
|
|
1830
1830
|
return emptyBar;
|
|
@@ -1839,7 +1839,11 @@ function createProgressBar(count, total, width, color) {
|
|
|
1839
1839
|
empty = (0, import_node_util11.styleText)(["green"], "\u2591".repeat(emptyWidth));
|
|
1840
1840
|
} else {
|
|
1841
1841
|
filled = (0, import_node_util11.styleText)(["redBright"], "\u2588".repeat(filledWidth));
|
|
1842
|
-
|
|
1842
|
+
if (count === 0 && emptyIsGood) {
|
|
1843
|
+
empty = (0, import_node_util11.styleText)(["green"], "\u2591".repeat(emptyWidth));
|
|
1844
|
+
} else {
|
|
1845
|
+
empty = (0, import_node_util11.styleText)(["red"], "\u2591".repeat(emptyWidth));
|
|
1846
|
+
}
|
|
1843
1847
|
}
|
|
1844
1848
|
return `${filled}${empty}`;
|
|
1845
1849
|
}
|
|
@@ -2035,9 +2039,13 @@ var RenderService = class _RenderService {
|
|
|
2035
2039
|
};
|
|
2036
2040
|
|
|
2037
2041
|
// src/bin/cli.ts
|
|
2042
|
+
var args = process.argv.slice(2);
|
|
2043
|
+
var jsonOutput = args.includes("--json");
|
|
2038
2044
|
async function init() {
|
|
2039
|
-
|
|
2040
|
-
|
|
2045
|
+
if (!jsonOutput) {
|
|
2046
|
+
console.log();
|
|
2047
|
+
console.log("[+] Detecting MCP Server configurations...");
|
|
2048
|
+
}
|
|
2041
2049
|
const mcpFilesManager = new MCPFiles();
|
|
2042
2050
|
const mcpFilesList = await mcpFilesManager.findFiles();
|
|
2043
2051
|
if (Object.keys(mcpFilesList).length === 0) {
|
|
@@ -2076,18 +2084,20 @@ async function init() {
|
|
|
2076
2084
|
totalImplicitLatestVersions++;
|
|
2077
2085
|
}
|
|
2078
2086
|
}
|
|
2079
|
-
|
|
2080
|
-
|
|
2081
|
-
|
|
2082
|
-
|
|
2083
|
-
|
|
2084
|
-
|
|
2085
|
-
|
|
2086
|
-
|
|
2087
|
-
|
|
2088
|
-
|
|
2089
|
-
|
|
2090
|
-
|
|
2087
|
+
if (!jsonOutput) {
|
|
2088
|
+
const mcpGroupData = [
|
|
2089
|
+
{ key: "PROVIDER", value: group.friendlyName },
|
|
2090
|
+
{ key: "FILE", value: filePath },
|
|
2091
|
+
{ key: "TYPE", value: filePathDataType },
|
|
2092
|
+
{ key: "PARSABLE", value: filePathValid }
|
|
2093
|
+
];
|
|
2094
|
+
const groupMetadata = {
|
|
2095
|
+
mcpServersTotal: totalMCPServers,
|
|
2096
|
+
mcpServersRunning: totalMCPServersRunning
|
|
2097
|
+
};
|
|
2098
|
+
RenderService.printMcpGroup(pathIndex, mcpGroupData, groupMetadata);
|
|
2099
|
+
RenderService.printMcpServers(mcpServers);
|
|
2100
|
+
}
|
|
2091
2101
|
}
|
|
2092
2102
|
}
|
|
2093
2103
|
}
|
|
@@ -2101,7 +2111,18 @@ async function init() {
|
|
|
2101
2111
|
implicitLatestVersions: totalImplicitLatestVersions,
|
|
2102
2112
|
transportBreakdown: transportCounts
|
|
2103
2113
|
};
|
|
2104
|
-
|
|
2114
|
+
if (jsonOutput) {
|
|
2115
|
+
const filteredMcpFiles = Object.fromEntries(
|
|
2116
|
+
Object.entries(mcpFilesList).filter(([, group]) => group.paths.length > 0)
|
|
2117
|
+
);
|
|
2118
|
+
const output = {
|
|
2119
|
+
mcpFiles: filteredMcpFiles,
|
|
2120
|
+
summary: summaryStats
|
|
2121
|
+
};
|
|
2122
|
+
console.log(JSON.stringify(output, null, 2));
|
|
2123
|
+
} else {
|
|
2124
|
+
RenderService.printSummary(summaryStats);
|
|
2125
|
+
}
|
|
2105
2126
|
}
|
|
2106
2127
|
__name(init, "init");
|
|
2107
2128
|
init().then(() => {
|
package/dist/bin/cli.mjs
CHANGED
|
@@ -513,8 +513,8 @@ var CredentialDetectionService = class {
|
|
|
513
513
|
/**
|
|
514
514
|
* Analyze command-line arguments for potential credentials
|
|
515
515
|
*/
|
|
516
|
-
static analyzeArguments(
|
|
517
|
-
if (!
|
|
516
|
+
static analyzeArguments(args2) {
|
|
517
|
+
if (!args2 || !Array.isArray(args2) || args2.length === 0) {
|
|
518
518
|
return {
|
|
519
519
|
hasCredentials: false,
|
|
520
520
|
credentialVars: [],
|
|
@@ -522,9 +522,9 @@ var CredentialDetectionService = class {
|
|
|
522
522
|
};
|
|
523
523
|
}
|
|
524
524
|
const credentialVars = [];
|
|
525
|
-
for (let i = 0; i <
|
|
526
|
-
const arg =
|
|
527
|
-
const nextArg =
|
|
525
|
+
for (let i = 0; i < args2.length - 1; i++) {
|
|
526
|
+
const arg = args2[i];
|
|
527
|
+
const nextArg = args2[i + 1];
|
|
528
528
|
const isHighRiskArg = this.ARGUMENT_PATTERNS.high.some((pattern) => pattern.test(arg));
|
|
529
529
|
const isLowRiskArg = this.ARGUMENT_PATTERNS.low.some((pattern) => pattern.test(arg));
|
|
530
530
|
if (isHighRiskArg || isLowRiskArg) {
|
|
@@ -762,14 +762,14 @@ var MCPVersionDetectionService = class {
|
|
|
762
762
|
* @param args - Array of arguments passed to the command
|
|
763
763
|
* @returns PackageVersionInfo if analysis is possible, null otherwise
|
|
764
764
|
*/
|
|
765
|
-
analyzeServerVersion(command,
|
|
765
|
+
analyzeServerVersion(command, args2) {
|
|
766
766
|
if (!["npx", "uvx", "uv"].includes(command)) {
|
|
767
767
|
return null;
|
|
768
768
|
}
|
|
769
|
-
if (!
|
|
769
|
+
if (!args2 || args2.length === 0) {
|
|
770
770
|
return null;
|
|
771
771
|
}
|
|
772
|
-
const packageName = this.extractPackageName(command,
|
|
772
|
+
const packageName = this.extractPackageName(command, args2);
|
|
773
773
|
if (!packageName) {
|
|
774
774
|
return null;
|
|
775
775
|
}
|
|
@@ -788,14 +788,14 @@ var MCPVersionDetectionService = class {
|
|
|
788
788
|
* @param args - Array of arguments passed to the command
|
|
789
789
|
* @returns The package name/spec or null if not found
|
|
790
790
|
*/
|
|
791
|
-
extractPackageName(command,
|
|
791
|
+
extractPackageName(command, args2) {
|
|
792
792
|
switch (command) {
|
|
793
793
|
case "npx":
|
|
794
|
-
return this.extractNpxPackageName(
|
|
794
|
+
return this.extractNpxPackageName(args2);
|
|
795
795
|
case "uvx":
|
|
796
|
-
return this.extractUvxPackageName(
|
|
796
|
+
return this.extractUvxPackageName(args2);
|
|
797
797
|
case "uv":
|
|
798
|
-
return this.extractUvPackageName(
|
|
798
|
+
return this.extractUvPackageName(args2);
|
|
799
799
|
default:
|
|
800
800
|
return null;
|
|
801
801
|
}
|
|
@@ -805,23 +805,23 @@ var MCPVersionDetectionService = class {
|
|
|
805
805
|
* @param args - Array of arguments passed to npx
|
|
806
806
|
* @returns The package name/spec or null if not found
|
|
807
807
|
*/
|
|
808
|
-
extractNpxPackageName(
|
|
809
|
-
if (!
|
|
808
|
+
extractNpxPackageName(args2) {
|
|
809
|
+
if (!args2 || args2.length === 0) {
|
|
810
810
|
return null;
|
|
811
811
|
}
|
|
812
|
-
const yIndex =
|
|
813
|
-
if (yIndex !== -1 && yIndex + 1 <
|
|
814
|
-
return
|
|
812
|
+
const yIndex = args2.indexOf("-y");
|
|
813
|
+
if (yIndex !== -1 && yIndex + 1 < args2.length) {
|
|
814
|
+
return args2[yIndex + 1];
|
|
815
815
|
}
|
|
816
|
-
const yesIndex =
|
|
817
|
-
if (yesIndex !== -1 && yesIndex + 1 <
|
|
818
|
-
return
|
|
816
|
+
const yesIndex = args2.indexOf("--yes");
|
|
817
|
+
if (yesIndex !== -1 && yesIndex + 1 < args2.length) {
|
|
818
|
+
return args2[yesIndex + 1];
|
|
819
819
|
}
|
|
820
|
-
for (let i = 0; i <
|
|
821
|
-
const arg =
|
|
820
|
+
for (let i = 0; i < args2.length; i++) {
|
|
821
|
+
const arg = args2[i];
|
|
822
822
|
if (!arg.startsWith("-")) {
|
|
823
823
|
if (i > 0) {
|
|
824
|
-
const prevArg =
|
|
824
|
+
const prevArg = args2[i - 1];
|
|
825
825
|
if (prevArg === "--registry" || prevArg === "-r" || prevArg === "--package" || prevArg === "-p") {
|
|
826
826
|
continue;
|
|
827
827
|
}
|
|
@@ -836,24 +836,24 @@ var MCPVersionDetectionService = class {
|
|
|
836
836
|
* @param args - Array of arguments passed to uvx
|
|
837
837
|
* @returns The package name/spec or null if not found
|
|
838
838
|
*/
|
|
839
|
-
extractUvxPackageName(
|
|
840
|
-
if (!
|
|
839
|
+
extractUvxPackageName(args2) {
|
|
840
|
+
if (!args2 || args2.length === 0) {
|
|
841
841
|
return null;
|
|
842
842
|
}
|
|
843
|
-
return
|
|
843
|
+
return args2[0];
|
|
844
844
|
}
|
|
845
845
|
/**
|
|
846
846
|
* Extract the package name from uv arguments
|
|
847
847
|
* @param args - Array of arguments passed to uv
|
|
848
848
|
* @returns The package name/spec or null if not found
|
|
849
849
|
*/
|
|
850
|
-
extractUvPackageName(
|
|
851
|
-
if (!
|
|
850
|
+
extractUvPackageName(args2) {
|
|
851
|
+
if (!args2 || args2.length === 0) {
|
|
852
852
|
return null;
|
|
853
853
|
}
|
|
854
|
-
const runIndex =
|
|
855
|
-
if (runIndex !== -1 && runIndex + 1 <
|
|
856
|
-
return
|
|
854
|
+
const runIndex = args2.indexOf("run");
|
|
855
|
+
if (runIndex !== -1 && runIndex + 1 < args2.length) {
|
|
856
|
+
return args2[runIndex + 1];
|
|
857
857
|
}
|
|
858
858
|
return null;
|
|
859
859
|
}
|
|
@@ -1788,9 +1788,9 @@ __name(getSourceIcon, "getSourceIcon");
|
|
|
1788
1788
|
import { styleText as styleText10 } from "util";
|
|
1789
1789
|
function SummaryComponent(stats) {
|
|
1790
1790
|
const { totalServers, runningServers, highRiskCredentials, implicitLatestVersions, transportBreakdown } = stats;
|
|
1791
|
-
const runningBar = createProgressBar(runningServers, totalServers, 20, "green");
|
|
1792
|
-
const securityBar = createProgressBar(highRiskCredentials, totalServers, 20, "red");
|
|
1793
|
-
const versionBar = createProgressBar(implicitLatestVersions, totalServers, 20, "red");
|
|
1791
|
+
const runningBar = createProgressBar(runningServers, totalServers, 20, "green", false);
|
|
1792
|
+
const securityBar = createProgressBar(highRiskCredentials, totalServers, 20, "red", true);
|
|
1793
|
+
const versionBar = createProgressBar(implicitLatestVersions, totalServers, 20, "red", true);
|
|
1794
1794
|
const transportText = `stdio: ${transportBreakdown.stdio} | SSE: ${transportBreakdown.sse} | HTTP: ${transportBreakdown.http}`;
|
|
1795
1795
|
const lines = [
|
|
1796
1796
|
"SUMMARY",
|
|
@@ -1802,7 +1802,7 @@ function SummaryComponent(stats) {
|
|
|
1802
1802
|
return lines.join("\n");
|
|
1803
1803
|
}
|
|
1804
1804
|
__name(SummaryComponent, "SummaryComponent");
|
|
1805
|
-
function createProgressBar(count, total, width, color) {
|
|
1805
|
+
function createProgressBar(count, total, width, color, emptyIsGood = false) {
|
|
1806
1806
|
if (total === 0) {
|
|
1807
1807
|
const emptyBar = "\u2591".repeat(width);
|
|
1808
1808
|
return emptyBar;
|
|
@@ -1817,7 +1817,11 @@ function createProgressBar(count, total, width, color) {
|
|
|
1817
1817
|
empty = styleText10(["green"], "\u2591".repeat(emptyWidth));
|
|
1818
1818
|
} else {
|
|
1819
1819
|
filled = styleText10(["redBright"], "\u2588".repeat(filledWidth));
|
|
1820
|
-
|
|
1820
|
+
if (count === 0 && emptyIsGood) {
|
|
1821
|
+
empty = styleText10(["green"], "\u2591".repeat(emptyWidth));
|
|
1822
|
+
} else {
|
|
1823
|
+
empty = styleText10(["red"], "\u2591".repeat(emptyWidth));
|
|
1824
|
+
}
|
|
1821
1825
|
}
|
|
1822
1826
|
return `${filled}${empty}`;
|
|
1823
1827
|
}
|
|
@@ -2013,9 +2017,13 @@ var RenderService = class _RenderService {
|
|
|
2013
2017
|
};
|
|
2014
2018
|
|
|
2015
2019
|
// src/bin/cli.ts
|
|
2020
|
+
var args = process.argv.slice(2);
|
|
2021
|
+
var jsonOutput = args.includes("--json");
|
|
2016
2022
|
async function init() {
|
|
2017
|
-
|
|
2018
|
-
|
|
2023
|
+
if (!jsonOutput) {
|
|
2024
|
+
console.log();
|
|
2025
|
+
console.log("[+] Detecting MCP Server configurations...");
|
|
2026
|
+
}
|
|
2019
2027
|
const mcpFilesManager = new MCPFiles();
|
|
2020
2028
|
const mcpFilesList = await mcpFilesManager.findFiles();
|
|
2021
2029
|
if (Object.keys(mcpFilesList).length === 0) {
|
|
@@ -2054,18 +2062,20 @@ async function init() {
|
|
|
2054
2062
|
totalImplicitLatestVersions++;
|
|
2055
2063
|
}
|
|
2056
2064
|
}
|
|
2057
|
-
|
|
2058
|
-
|
|
2059
|
-
|
|
2060
|
-
|
|
2061
|
-
|
|
2062
|
-
|
|
2063
|
-
|
|
2064
|
-
|
|
2065
|
-
|
|
2066
|
-
|
|
2067
|
-
|
|
2068
|
-
|
|
2065
|
+
if (!jsonOutput) {
|
|
2066
|
+
const mcpGroupData = [
|
|
2067
|
+
{ key: "PROVIDER", value: group.friendlyName },
|
|
2068
|
+
{ key: "FILE", value: filePath },
|
|
2069
|
+
{ key: "TYPE", value: filePathDataType },
|
|
2070
|
+
{ key: "PARSABLE", value: filePathValid }
|
|
2071
|
+
];
|
|
2072
|
+
const groupMetadata = {
|
|
2073
|
+
mcpServersTotal: totalMCPServers,
|
|
2074
|
+
mcpServersRunning: totalMCPServersRunning
|
|
2075
|
+
};
|
|
2076
|
+
RenderService.printMcpGroup(pathIndex, mcpGroupData, groupMetadata);
|
|
2077
|
+
RenderService.printMcpServers(mcpServers);
|
|
2078
|
+
}
|
|
2069
2079
|
}
|
|
2070
2080
|
}
|
|
2071
2081
|
}
|
|
@@ -2079,7 +2089,18 @@ async function init() {
|
|
|
2079
2089
|
implicitLatestVersions: totalImplicitLatestVersions,
|
|
2080
2090
|
transportBreakdown: transportCounts
|
|
2081
2091
|
};
|
|
2082
|
-
|
|
2092
|
+
if (jsonOutput) {
|
|
2093
|
+
const filteredMcpFiles = Object.fromEntries(
|
|
2094
|
+
Object.entries(mcpFilesList).filter(([, group]) => group.paths.length > 0)
|
|
2095
|
+
);
|
|
2096
|
+
const output = {
|
|
2097
|
+
mcpFiles: filteredMcpFiles,
|
|
2098
|
+
summary: summaryStats
|
|
2099
|
+
};
|
|
2100
|
+
console.log(JSON.stringify(output, null, 2));
|
|
2101
|
+
} else {
|
|
2102
|
+
RenderService.printSummary(summaryStats);
|
|
2103
|
+
}
|
|
2083
2104
|
}
|
|
2084
2105
|
__name(init, "init");
|
|
2085
2106
|
init().then(() => {
|
package/package.json
CHANGED
package/src/bin/cli.ts
CHANGED
|
@@ -16,10 +16,16 @@ interface MCPServerInfo {
|
|
|
16
16
|
credentials?: any
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
+
// Parse command-line arguments
|
|
20
|
+
const args = process.argv.slice(2)
|
|
21
|
+
const jsonOutput = args.includes('--json')
|
|
22
|
+
|
|
19
23
|
async function init () {
|
|
20
|
-
// Start the CLI with a new line for better readability
|
|
21
|
-
|
|
22
|
-
|
|
24
|
+
// Start the CLI with a new line for better readability (only in non-JSON mode)
|
|
25
|
+
if (!jsonOutput) {
|
|
26
|
+
console.log()
|
|
27
|
+
console.log('[+] Detecting MCP Server configurations...')
|
|
28
|
+
}
|
|
23
29
|
|
|
24
30
|
const mcpFilesManager = new MCPFiles()
|
|
25
31
|
const mcpFilesList = await mcpFilesManager.findFiles()
|
|
@@ -76,20 +82,23 @@ async function init () {
|
|
|
76
82
|
}
|
|
77
83
|
}
|
|
78
84
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
+
// Only render in non-JSON mode
|
|
86
|
+
if (!jsonOutput) {
|
|
87
|
+
const mcpGroupData = [
|
|
88
|
+
{ key: 'PROVIDER', value: group.friendlyName },
|
|
89
|
+
{ key: 'FILE', value: filePath },
|
|
90
|
+
{ key: 'TYPE', value: filePathDataType },
|
|
91
|
+
{ key: 'PARSABLE', value: filePathValid },
|
|
92
|
+
]
|
|
93
|
+
|
|
94
|
+
const groupMetadata = {
|
|
95
|
+
mcpServersTotal: totalMCPServers,
|
|
96
|
+
mcpServersRunning: totalMCPServersRunning,
|
|
97
|
+
}
|
|
85
98
|
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
mcpServersRunning: totalMCPServersRunning,
|
|
99
|
+
RenderService.printMcpGroup(pathIndex, mcpGroupData, groupMetadata)
|
|
100
|
+
RenderService.printMcpServers(mcpServers)
|
|
89
101
|
}
|
|
90
|
-
|
|
91
|
-
RenderService.printMcpGroup(pathIndex, mcpGroupData, groupMetadata)
|
|
92
|
-
RenderService.printMcpServers(mcpServers)
|
|
93
102
|
}
|
|
94
103
|
}
|
|
95
104
|
}
|
|
@@ -98,7 +107,7 @@ async function init () {
|
|
|
98
107
|
exitWithError('No MCP servers found in known configuration files.')
|
|
99
108
|
}
|
|
100
109
|
|
|
101
|
-
//
|
|
110
|
+
// Prepare summary statistics
|
|
102
111
|
const summaryStats = {
|
|
103
112
|
totalServers,
|
|
104
113
|
runningServers: totalRunning,
|
|
@@ -107,7 +116,21 @@ async function init () {
|
|
|
107
116
|
transportBreakdown: transportCounts
|
|
108
117
|
}
|
|
109
118
|
|
|
110
|
-
|
|
119
|
+
// Output based on mode
|
|
120
|
+
if (jsonOutput) {
|
|
121
|
+
// Filter out providers with empty paths
|
|
122
|
+
const filteredMcpFiles = Object.fromEntries(
|
|
123
|
+
Object.entries(mcpFilesList).filter(([, group]) => group.paths.length > 0)
|
|
124
|
+
)
|
|
125
|
+
|
|
126
|
+
const output = {
|
|
127
|
+
mcpFiles: filteredMcpFiles,
|
|
128
|
+
summary: summaryStats
|
|
129
|
+
}
|
|
130
|
+
console.log(JSON.stringify(output, null, 2))
|
|
131
|
+
} else {
|
|
132
|
+
RenderService.printSummary(summaryStats)
|
|
133
|
+
}
|
|
111
134
|
}
|
|
112
135
|
|
|
113
136
|
init().then(() => {
|
|
@@ -16,9 +16,9 @@ export default function SummaryComponent (stats: SummaryStats): string {
|
|
|
16
16
|
const { totalServers, runningServers, highRiskCredentials, implicitLatestVersions, transportBreakdown } = stats
|
|
17
17
|
|
|
18
18
|
// Create progress bars (20 characters wide, following existing convention)
|
|
19
|
-
const runningBar = createProgressBar(runningServers, totalServers, 20, 'green')
|
|
20
|
-
const securityBar = createProgressBar(highRiskCredentials, totalServers, 20, 'red')
|
|
21
|
-
const versionBar = createProgressBar(implicitLatestVersions, totalServers, 20, 'red')
|
|
19
|
+
const runningBar = createProgressBar(runningServers, totalServers, 20, 'green', false)
|
|
20
|
+
const securityBar = createProgressBar(highRiskCredentials, totalServers, 20, 'red', true)
|
|
21
|
+
const versionBar = createProgressBar(implicitLatestVersions, totalServers, 20, 'red', true)
|
|
22
22
|
|
|
23
23
|
// Format transport breakdown
|
|
24
24
|
const transportText = `stdio: ${transportBreakdown.stdio} | SSE: ${transportBreakdown.sse} | HTTP: ${transportBreakdown.http}`
|
|
@@ -35,7 +35,7 @@ export default function SummaryComponent (stats: SummaryStats): string {
|
|
|
35
35
|
return lines.join('\n')
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
-
function createProgressBar (count: number, total: number, width: number, color: 'green' | 'red'): string {
|
|
38
|
+
function createProgressBar (count: number, total: number, width: number, color: 'green' | 'red', emptyIsGood: boolean = false): string {
|
|
39
39
|
if (total === 0) {
|
|
40
40
|
const emptyBar = '░'.repeat(width)
|
|
41
41
|
return emptyBar
|
|
@@ -53,7 +53,12 @@ function createProgressBar (count: number, total: number, width: number, color:
|
|
|
53
53
|
empty = styleText(['green'], '░'.repeat(emptyWidth))
|
|
54
54
|
} else { // red
|
|
55
55
|
filled = styleText(['redBright'], '█'.repeat(filledWidth))
|
|
56
|
-
empty
|
|
56
|
+
// If count is 0 and emptyIsGood is true, use green for empty sections (0 issues is good)
|
|
57
|
+
if (count === 0 && emptyIsGood) {
|
|
58
|
+
empty = styleText(['green'], '░'.repeat(emptyWidth))
|
|
59
|
+
} else {
|
|
60
|
+
empty = styleText(['red'], '░'.repeat(emptyWidth))
|
|
61
|
+
}
|
|
57
62
|
}
|
|
58
63
|
|
|
59
64
|
return `${filled}${empty}`
|