ls-mcp 1.14.0 → 1.15.1

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 CHANGED
@@ -56,6 +56,23 @@ The `--files` flag automatically detects the configuration structure in your fil
56
56
  - `mcp.servers` - Nested configuration format
57
57
  - `context_servers` - Context-based configuration format
58
58
 
59
+ ### Show All Providers
60
+
61
+ By default, `ls-mcp` hides providers that have zero configured servers to reduce clutter. To show all providers including those with empty configurations, use the `--all` or `-a` flag:
62
+
63
+ ```bash
64
+ # Show all providers including empty ones
65
+ npx ls-mcp --all
66
+
67
+ # Short form
68
+ npx ls-mcp -a
69
+
70
+ # Combine with JSON output
71
+ npx ls-mcp --all --json
72
+ ```
73
+
74
+ **Note**: When using `--files` to analyze specific configuration files, the custom group is always shown even if it contains zero servers, as you explicitly requested to analyze those files.
75
+
59
76
  ### JSON Output
60
77
 
61
78
  To output results in JSON format (useful for programmatic consumption):
@@ -68,7 +85,7 @@ npx ls-mcp --files ./config.json --json
68
85
  ```
69
86
 
70
87
  This will return a structured JSON object containing:
71
- - `mcpFiles`: Complete MCP server configurations organized by provider (only includes providers with configured servers)
88
+ - `mcpFiles`: Complete MCP server configurations organized by provider (only includes providers with configured servers unless `--all` is specified)
72
89
  - `summary`: Statistics including total servers, running servers, credential warnings, and transport breakdown
73
90
 
74
91
  ### Debug Mode
package/dist/bin/cli.cjs CHANGED
@@ -1672,6 +1672,7 @@ var RenderService = class _RenderService {
1672
1672
  // src/bin/cli.ts
1673
1673
  var args = process.argv.slice(2);
1674
1674
  var jsonOutput = args.includes("--json");
1675
+ var showAll = args.includes("--all") || args.includes("-a");
1675
1676
  var customFiles;
1676
1677
  var filesIndex = args.findIndex((arg) => arg === "--files");
1677
1678
  if (filesIndex !== -1 && filesIndex < args.length - 1) {
@@ -1708,14 +1709,23 @@ async function init() {
1708
1709
  const transportCounts = { stdio: 0, sse: 0, http: 0 };
1709
1710
  for (const groupName of Object.keys(mcpFilesList)) {
1710
1711
  const group = mcpFilesList[groupName];
1712
+ const isCustomFilesMode = customFiles && customFiles.length > 0;
1713
+ const shouldSkipGroup = !showAll && !isCustomFilesMode && group.stats?.serversCount === 0;
1714
+ if (shouldSkipGroup) {
1715
+ continue;
1716
+ }
1711
1717
  if (group.paths.length > 0) {
1712
1718
  for (const filePathData of group.paths) {
1719
+ const totalMCPServers = filePathData.servers ? filePathData.servers.length : 0;
1720
+ const shouldSkipFile = !showAll && !isCustomFilesMode && totalMCPServers === 0;
1721
+ if (shouldSkipFile) {
1722
+ continue;
1723
+ }
1713
1724
  pathIndex++;
1714
1725
  const filePath = filePathData.filePath.replace("~", process.env.HOME || "");
1715
1726
  const filePathValid = filePathData.parsable ? "VALID" : "INVALID";
1716
1727
  const filePathDataType = filePathData.type.toUpperCase();
1717
1728
  const mcpServers = filePathData.servers || [];
1718
- const totalMCPServers = filePathData.servers ? filePathData.servers.length : 0;
1719
1729
  const totalMCPServersRunning = mcpServers.filter((server) => server.status === "running").length;
1720
1730
  totalServers += totalMCPServers;
1721
1731
  totalRunning += totalMCPServersRunning;
@@ -1751,7 +1761,12 @@ async function init() {
1751
1761
  }
1752
1762
  }
1753
1763
  if (pathIndex === 0) {
1754
- exitWithError("No MCP servers found in known configuration files.");
1764
+ const isCustomFilesMode = customFiles && customFiles.length > 0;
1765
+ if (isCustomFilesMode) {
1766
+ exitWithError("No MCP servers found in specified configuration files.");
1767
+ } else {
1768
+ exitWithError("No MCP servers found in known configuration files.");
1769
+ }
1755
1770
  }
1756
1771
  const summaryStats = {
1757
1772
  totalServers,
@@ -1761,8 +1776,21 @@ async function init() {
1761
1776
  transportBreakdown: transportCounts
1762
1777
  };
1763
1778
  if (jsonOutput) {
1779
+ const isCustomFilesMode = customFiles && customFiles.length > 0;
1764
1780
  const filteredMcpFiles = Object.fromEntries(
1765
- Object.entries(mcpFilesList).filter(([, group]) => group.paths.length > 0)
1781
+ Object.entries(mcpFilesList).map(([groupName, group]) => {
1782
+ const filteredPaths = group.paths.filter((filePathData) => {
1783
+ const fileServerCount = filePathData.servers ? filePathData.servers.length : 0;
1784
+ if (showAll || isCustomFilesMode) {
1785
+ return true;
1786
+ }
1787
+ return fileServerCount > 0;
1788
+ });
1789
+ return [groupName, { ...group, paths: filteredPaths }];
1790
+ }).filter((entry) => {
1791
+ const [, group] = entry;
1792
+ return group.paths.length > 0;
1793
+ })
1766
1794
  );
1767
1795
  const output = {
1768
1796
  mcpFiles: filteredMcpFiles,
package/dist/bin/cli.mjs CHANGED
@@ -1650,6 +1650,7 @@ var RenderService = class _RenderService {
1650
1650
  // src/bin/cli.ts
1651
1651
  var args = process.argv.slice(2);
1652
1652
  var jsonOutput = args.includes("--json");
1653
+ var showAll = args.includes("--all") || args.includes("-a");
1653
1654
  var customFiles;
1654
1655
  var filesIndex = args.findIndex((arg) => arg === "--files");
1655
1656
  if (filesIndex !== -1 && filesIndex < args.length - 1) {
@@ -1686,14 +1687,23 @@ async function init() {
1686
1687
  const transportCounts = { stdio: 0, sse: 0, http: 0 };
1687
1688
  for (const groupName of Object.keys(mcpFilesList)) {
1688
1689
  const group = mcpFilesList[groupName];
1690
+ const isCustomFilesMode = customFiles && customFiles.length > 0;
1691
+ const shouldSkipGroup = !showAll && !isCustomFilesMode && group.stats?.serversCount === 0;
1692
+ if (shouldSkipGroup) {
1693
+ continue;
1694
+ }
1689
1695
  if (group.paths.length > 0) {
1690
1696
  for (const filePathData of group.paths) {
1697
+ const totalMCPServers = filePathData.servers ? filePathData.servers.length : 0;
1698
+ const shouldSkipFile = !showAll && !isCustomFilesMode && totalMCPServers === 0;
1699
+ if (shouldSkipFile) {
1700
+ continue;
1701
+ }
1691
1702
  pathIndex++;
1692
1703
  const filePath = filePathData.filePath.replace("~", process.env.HOME || "");
1693
1704
  const filePathValid = filePathData.parsable ? "VALID" : "INVALID";
1694
1705
  const filePathDataType = filePathData.type.toUpperCase();
1695
1706
  const mcpServers = filePathData.servers || [];
1696
- const totalMCPServers = filePathData.servers ? filePathData.servers.length : 0;
1697
1707
  const totalMCPServersRunning = mcpServers.filter((server) => server.status === "running").length;
1698
1708
  totalServers += totalMCPServers;
1699
1709
  totalRunning += totalMCPServersRunning;
@@ -1729,7 +1739,12 @@ async function init() {
1729
1739
  }
1730
1740
  }
1731
1741
  if (pathIndex === 0) {
1732
- exitWithError("No MCP servers found in known configuration files.");
1742
+ const isCustomFilesMode = customFiles && customFiles.length > 0;
1743
+ if (isCustomFilesMode) {
1744
+ exitWithError("No MCP servers found in specified configuration files.");
1745
+ } else {
1746
+ exitWithError("No MCP servers found in known configuration files.");
1747
+ }
1733
1748
  }
1734
1749
  const summaryStats = {
1735
1750
  totalServers,
@@ -1739,8 +1754,21 @@ async function init() {
1739
1754
  transportBreakdown: transportCounts
1740
1755
  };
1741
1756
  if (jsonOutput) {
1757
+ const isCustomFilesMode = customFiles && customFiles.length > 0;
1742
1758
  const filteredMcpFiles = Object.fromEntries(
1743
- Object.entries(mcpFilesList).filter(([, group]) => group.paths.length > 0)
1759
+ Object.entries(mcpFilesList).map(([groupName, group]) => {
1760
+ const filteredPaths = group.paths.filter((filePathData) => {
1761
+ const fileServerCount = filePathData.servers ? filePathData.servers.length : 0;
1762
+ if (showAll || isCustomFilesMode) {
1763
+ return true;
1764
+ }
1765
+ return fileServerCount > 0;
1766
+ });
1767
+ return [groupName, { ...group, paths: filteredPaths }];
1768
+ }).filter((entry) => {
1769
+ const [, group] = entry;
1770
+ return group.paths.length > 0;
1771
+ })
1744
1772
  );
1745
1773
  const output = {
1746
1774
  mcpFiles: filteredMcpFiles,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ls-mcp",
3
- "version": "1.14.0",
3
+ "version": "1.15.1",
4
4
  "description": "list and detect MCP servers and configurations",
5
5
  "types": "dist/main.d.ts",
6
6
  "type": "module",
package/src/bin/cli.ts CHANGED
@@ -19,6 +19,7 @@ interface MCPServerInfo {
19
19
  // Parse command-line arguments
20
20
  const args = process.argv.slice(2)
21
21
  const jsonOutput = args.includes('--json')
22
+ const showAll = args.includes('--all') || args.includes('-a')
22
23
 
23
24
  // Parse --files flag
24
25
  let customFiles: string[] | undefined
@@ -67,9 +68,24 @@ async function init () {
67
68
  for (const groupName of Object.keys(mcpFilesList)) {
68
69
  const group = mcpFilesList[groupName]
69
70
 
71
+ // Skip groups with zero servers unless --all is specified or in --files mode
72
+ const isCustomFilesMode = customFiles && customFiles.length > 0
73
+ const shouldSkipGroup = !showAll && !isCustomFilesMode && (group.stats?.serversCount === 0)
74
+ if (shouldSkipGroup) {
75
+ continue
76
+ }
77
+
70
78
  if (group.paths.length > 0) {
71
79
  // handle file path list of MCP Servers
72
80
  for (const filePathData of group.paths) {
81
+ const totalMCPServers = filePathData.servers ? filePathData.servers.length : 0
82
+
83
+ // Skip file paths with zero servers unless --all is specified or in --files mode
84
+ const shouldSkipFile = !showAll && !isCustomFilesMode && totalMCPServers === 0
85
+ if (shouldSkipFile) {
86
+ continue
87
+ }
88
+
73
89
  pathIndex++
74
90
 
75
91
  const filePath = filePathData.filePath.replace('~', process.env.HOME || '')
@@ -77,7 +93,6 @@ async function init () {
77
93
  const filePathDataType = filePathData.type.toUpperCase()
78
94
  const mcpServers = filePathData.servers || []
79
95
 
80
- const totalMCPServers = filePathData.servers ? filePathData.servers.length : 0
81
96
  const totalMCPServersRunning = mcpServers.filter((server: MCPServerInfo) => server.status === 'running').length
82
97
 
83
98
  // Accumulate summary statistics
@@ -127,7 +142,12 @@ async function init () {
127
142
  }
128
143
 
129
144
  if (pathIndex === 0) {
130
- exitWithError('No MCP servers found in known configuration files.')
145
+ const isCustomFilesMode = customFiles && customFiles.length > 0
146
+ if (isCustomFilesMode) {
147
+ exitWithError('No MCP servers found in specified configuration files.')
148
+ } else {
149
+ exitWithError('No MCP servers found in known configuration files.')
150
+ }
131
151
  }
132
152
 
133
153
  // Prepare summary statistics
@@ -141,9 +161,27 @@ async function init () {
141
161
 
142
162
  // Output based on mode
143
163
  if (jsonOutput) {
144
- // Filter out providers with empty paths
164
+ // Filter out providers with zero servers unless --all is specified or in --files mode
165
+ const isCustomFilesMode = customFiles && customFiles.length > 0
145
166
  const filteredMcpFiles = Object.fromEntries(
146
- Object.entries(mcpFilesList).filter(([, group]) => group.paths.length > 0)
167
+ Object.entries(mcpFilesList)
168
+ .map(([groupName, group]) => {
169
+ // Filter individual file paths with zero servers unless --all or --files mode
170
+ const filteredPaths = group.paths.filter(filePathData => {
171
+ const fileServerCount = filePathData.servers ? filePathData.servers.length : 0
172
+ if (showAll || isCustomFilesMode) {
173
+ return true // Keep all files
174
+ }
175
+ return fileServerCount > 0 // Only keep files with servers
176
+ })
177
+
178
+ return [groupName, { ...group, paths: filteredPaths }] as const
179
+ })
180
+ .filter((entry): entry is [string, typeof entry[1]] => {
181
+ // After filtering file paths, remove groups with no remaining paths
182
+ const [, group] = entry
183
+ return group.paths.length > 0
184
+ })
147
185
  )
148
186
 
149
187
  const output = {