ls-mcp 1.15.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/dist/bin/cli.cjs CHANGED
@@ -1716,12 +1716,16 @@ async function init() {
1716
1716
  }
1717
1717
  if (group.paths.length > 0) {
1718
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
+ }
1719
1724
  pathIndex++;
1720
1725
  const filePath = filePathData.filePath.replace("~", process.env.HOME || "");
1721
1726
  const filePathValid = filePathData.parsable ? "VALID" : "INVALID";
1722
1727
  const filePathDataType = filePathData.type.toUpperCase();
1723
1728
  const mcpServers = filePathData.servers || [];
1724
- const totalMCPServers = filePathData.servers ? filePathData.servers.length : 0;
1725
1729
  const totalMCPServersRunning = mcpServers.filter((server) => server.status === "running").length;
1726
1730
  totalServers += totalMCPServers;
1727
1731
  totalRunning += totalMCPServersRunning;
@@ -1774,11 +1778,18 @@ async function init() {
1774
1778
  if (jsonOutput) {
1775
1779
  const isCustomFilesMode = customFiles && customFiles.length > 0;
1776
1780
  const filteredMcpFiles = Object.fromEntries(
1777
- Object.entries(mcpFilesList).filter(([, group]) => {
1778
- if (showAll || isCustomFilesMode) {
1779
- return group.paths.length > 0;
1780
- }
1781
- return (group.stats?.serversCount ?? 0) > 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;
1782
1793
  })
1783
1794
  );
1784
1795
  const output = {
package/dist/bin/cli.mjs CHANGED
@@ -1694,12 +1694,16 @@ async function init() {
1694
1694
  }
1695
1695
  if (group.paths.length > 0) {
1696
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
+ }
1697
1702
  pathIndex++;
1698
1703
  const filePath = filePathData.filePath.replace("~", process.env.HOME || "");
1699
1704
  const filePathValid = filePathData.parsable ? "VALID" : "INVALID";
1700
1705
  const filePathDataType = filePathData.type.toUpperCase();
1701
1706
  const mcpServers = filePathData.servers || [];
1702
- const totalMCPServers = filePathData.servers ? filePathData.servers.length : 0;
1703
1707
  const totalMCPServersRunning = mcpServers.filter((server) => server.status === "running").length;
1704
1708
  totalServers += totalMCPServers;
1705
1709
  totalRunning += totalMCPServersRunning;
@@ -1752,11 +1756,18 @@ async function init() {
1752
1756
  if (jsonOutput) {
1753
1757
  const isCustomFilesMode = customFiles && customFiles.length > 0;
1754
1758
  const filteredMcpFiles = Object.fromEntries(
1755
- Object.entries(mcpFilesList).filter(([, group]) => {
1756
- if (showAll || isCustomFilesMode) {
1757
- return group.paths.length > 0;
1758
- }
1759
- return (group.stats?.serversCount ?? 0) > 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;
1760
1771
  })
1761
1772
  );
1762
1773
  const output = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ls-mcp",
3
- "version": "1.15.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
@@ -78,6 +78,14 @@ async function init () {
78
78
  if (group.paths.length > 0) {
79
79
  // handle file path list of MCP Servers
80
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
+
81
89
  pathIndex++
82
90
 
83
91
  const filePath = filePathData.filePath.replace('~', process.env.HOME || '')
@@ -85,7 +93,6 @@ async function init () {
85
93
  const filePathDataType = filePathData.type.toUpperCase()
86
94
  const mcpServers = filePathData.servers || []
87
95
 
88
- const totalMCPServers = filePathData.servers ? filePathData.servers.length : 0
89
96
  const totalMCPServersRunning = mcpServers.filter((server: MCPServerInfo) => server.status === 'running').length
90
97
 
91
98
  // Accumulate summary statistics
@@ -157,12 +164,24 @@ async function init () {
157
164
  // Filter out providers with zero servers unless --all is specified or in --files mode
158
165
  const isCustomFilesMode = customFiles && customFiles.length > 0
159
166
  const filteredMcpFiles = Object.fromEntries(
160
- Object.entries(mcpFilesList).filter(([, group]) => {
161
- if (showAll || isCustomFilesMode) {
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
162
183
  return group.paths.length > 0
163
- }
164
- return (group.stats?.serversCount ?? 0) > 0
165
- })
184
+ })
166
185
  )
167
186
 
168
187
  const output = {