ls-mcp 1.15.2 → 1.15.3

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ls-mcp",
3
- "version": "1.15.2",
3
+ "version": "1.15.3",
4
4
  "description": "list and detect MCP servers and configurations",
5
5
  "types": "dist/main.d.ts",
6
6
  "type": "module",
@@ -26,26 +26,27 @@
26
26
  }
27
27
  },
28
28
  "engines": {
29
- "node": ">=20.13.0"
29
+ "npm": ">=11.10.0",
30
+ "node": ">=24.0.0"
30
31
  },
31
- "packageManager": "npm@8.4.0",
32
32
  "files": [
33
33
  "dist",
34
34
  "src",
35
35
  "bin"
36
36
  ],
37
37
  "scripts": {
38
- "start": "npm run build && node --import tsx src/bin/cli.ts",
39
- "build": "tsc && tsup",
40
- "lint": "eslint . && npm run lint:lockfile",
41
- "lint:fix": "eslint . --fix",
42
- "lint:lockfile": "lockfile-lint --path package-lock.json --validate-https --allowed-hosts npm yarn",
43
- "lint:markdown": "npx -y markdownlint-cli@0.45.0 -c .github/.markdownlint.yml '**/**.md' --fix",
44
- "test": "c8 node --import tsx --test __tests__/**/*.test.ts",
45
- "test:watch": "c8 node --import tsx --test --watch __tests__/**/*.test.ts",
38
+ "start": "npm run build && vpx ./src/bin/cli.ts",
39
+ "build": "vp check --no-fmt --no-lint src && vp pack",
40
+ "lint": "vp lint -c .oxlintrc.json .",
41
+ "lint:fix": "vp lint -c .oxlintrc.json --fix",
42
+ "lint:markdown": "npx --no-install markdownlint-cli -i '**/node_modules/**' -c .github/.markdownlint.yml '**/**.md'",
43
+ "test": "vp test run --coverage",
44
+ "test:watch": "vp test watch --coverage",
46
45
  "coverage:view": "open coverage/lcov-report/index.html",
47
46
  "version": "changeset version",
48
- "release": "changeset publish"
47
+ "release": "changeset publish",
48
+ "coverage:cli": "c8 --reports-dir coverage/c8 vpx ./src/bin/cli.ts",
49
+ "setup:hooks": "vp hooks enable"
49
50
  },
50
51
  "author": {
51
52
  "name": "Liran Tal",
@@ -75,30 +76,22 @@
75
76
  "url": "https://github.com/lirantal/ls-mcp.git"
76
77
  },
77
78
  "dependencies": {
78
- "agent-files": "^1.0.1",
79
- "jsonc-parser": "^3.3.1"
79
+ "agent-files": "^1.0.1"
80
80
  },
81
81
  "devDependencies": {
82
- "@changesets/changelog-git": "^0.2.1",
83
- "@changesets/changelog-github": "^0.5.0",
84
- "@changesets/cli": "^2.27.7",
85
- "@types/node": "^24.0.3",
86
- "c8": "^10.1.2",
87
- "eslint": "^9.6.0",
88
- "eslint-plugin-security": "^3.0.1",
89
- "husky": "^9.0.11",
90
- "lint-staged": "^16.0.0",
91
- "lockfile-lint": "^4.14.0",
92
- "neostandard": "^0.12.1",
93
- "tsup": "^8.1.0",
94
- "tsx": "^4.19.4",
95
- "typescript": "^5.5.3",
96
- "validate-conventional-commit": "^1.0.4"
97
- },
98
- "lint-staged": {
99
- "**/*.{js,json}": [
100
- "npm run lint:fix"
101
- ]
82
+ "@changesets/changelog-github": "^1.0.1",
83
+ "@changesets/cli": "^3.0.3",
84
+ "@types/node": "^26.0.1",
85
+ "@vitest/coverage-v8": "5.0.5",
86
+ "c8": "^12.0.0",
87
+ "eslint-plugin-n": "^18.1.0",
88
+ "eslint-plugin-security": "^4.0.0",
89
+ "markdownlint-cli": "0.50.0",
90
+ "oxfmt": "0.75.0",
91
+ "oxlint": "1.90.0",
92
+ "typescript": "~6.0.3",
93
+ "vite-plus": "1.4.0",
94
+ "vitest": "5.0.5"
102
95
  },
103
96
  "c8": {
104
97
  "exclude": [
@@ -116,5 +109,6 @@
116
109
  "lcov",
117
110
  "html"
118
111
  ]
119
- }
112
+ },
113
+ "packageManager": "npm@11.21.0"
120
114
  }
package/src/bin/cli.ts CHANGED
@@ -13,7 +13,7 @@ interface MCPServerInfo {
13
13
  source?: string
14
14
  env?: Record<string, string>
15
15
  status?: 'running' | 'stopped'
16
- credentials?: any
16
+ credentials?: unknown
17
17
  }
18
18
 
19
19
  // Parse command-line arguments
@@ -2,7 +2,7 @@ import { styleText } from 'node:util'
2
2
 
3
3
  export default function render (text: string) {
4
4
  const formattedText = text.toLowerCase()
5
- let data = ''
5
+ let data: string
6
6
  if (formattedText === 'running') {
7
7
  data = styleText(['green'], '●')
8
8
  } else {
@@ -2,7 +2,7 @@ import { styleText } from 'node:util'
2
2
 
3
3
  export default function render (text: string) {
4
4
  const formattedText = text.toUpperCase().replace(/_/g, ' ')
5
- let data = formattedText
5
+ let data: string
6
6
  if (formattedText === 'VALID') {
7
7
  data = styleText(['green'], '●')
8
8
  } else {
package/src/main.ts CHANGED
@@ -98,7 +98,7 @@ export class MCPFiles {
98
98
 
99
99
  return mcpFilesPathsData
100
100
  } catch (error) {
101
- throw new Error(`Failed to find MCP files: ${error instanceof Error ? error.message : 'Unknown error'}`)
101
+ throw new Error(`Failed to find MCP files: ${error instanceof Error ? error.message : 'Unknown error'}`, { cause: error })
102
102
  }
103
103
  }
104
104
 
@@ -18,6 +18,15 @@ export interface MCPConfigServiceOptions {
18
18
  enableDirectoryBubbling?: boolean
19
19
  }
20
20
 
21
+ interface RawMCPServerConfig {
22
+ url?: string
23
+ command?: string
24
+ args?: string[]
25
+ type?: 'sse' | 'http' | 'stdio' | 'streamable-http'
26
+ env?: Record<string, string>
27
+ headers?: Record<string, string>
28
+ }
29
+
21
30
  export class MCPConfigService {
22
31
  private pathRegistry: MCPPathRegistry
23
32
  private currentOS: string
@@ -42,7 +51,7 @@ export class MCPConfigService {
42
51
  try {
43
52
  return this.pathRegistry.getPathsForApp(this.currentOS, appName) as MCPFilePath[]
44
53
  } catch (error) {
45
- throw new Error(`Failed to get config files for app '${appName}': ${error instanceof Error ? error.message : 'Unknown error'}`)
54
+ throw new Error(`Failed to get config files for app '${appName}': ${error instanceof Error ? error.message : 'Unknown error'}`, { cause: error })
46
55
  }
47
56
  }
48
57
 
@@ -53,7 +62,7 @@ export class MCPConfigService {
53
62
  try {
54
63
  return this.pathRegistry.getPathsForOS(this.currentOS) as MCPAppPathsRecord
55
64
  } catch (error) {
56
- throw new Error(`Failed to get all config files: ${error instanceof Error ? error.message : 'Unknown error'}`)
65
+ throw new Error(`Failed to get all config files: ${error instanceof Error ? error.message : 'Unknown error'}`, { cause: error })
57
66
  }
58
67
  }
59
68
 
@@ -72,7 +81,7 @@ export class MCPConfigService {
72
81
 
73
82
  return allServers
74
83
  } catch (error) {
75
- throw new Error(`Failed to get MCP servers for app '${appName}': ${error instanceof Error ? error.message : 'Unknown error'}`)
84
+ throw new Error(`Failed to get MCP servers for app '${appName}': ${error instanceof Error ? error.message : 'Unknown error'}`, { cause: error })
76
85
  }
77
86
  }
78
87
 
@@ -96,7 +105,7 @@ export class MCPConfigService {
96
105
 
97
106
  return allServers
98
107
  } catch (error) {
99
- throw new Error(`Failed to get all MCP servers: ${error instanceof Error ? error.message : 'Unknown error'}`)
108
+ throw new Error(`Failed to get all MCP servers: ${error instanceof Error ? error.message : 'Unknown error'}`, { cause: error })
100
109
  }
101
110
  }
102
111
 
@@ -114,7 +123,7 @@ export class MCPConfigService {
114
123
  paths: (appPaths as MCPAppPathsRecord)[appName] || []
115
124
  }))
116
125
  } catch (error) {
117
- throw new Error(`Failed to get supported apps: ${error instanceof Error ? error.message : 'Unknown error'}`)
126
+ throw new Error(`Failed to get supported apps: ${error instanceof Error ? error.message : 'Unknown error'}`, { cause: error })
118
127
  }
119
128
  }
120
129
 
@@ -133,7 +142,7 @@ export class MCPConfigService {
133
142
  await fs.access(filePath)
134
143
  const parser = this.createParser(filePath)
135
144
  return await parser.isValidSyntax()
136
- } catch (error) {
145
+ } catch {
137
146
  return false
138
147
  }
139
148
  }
@@ -174,7 +183,7 @@ export class MCPConfigService {
174
183
  try {
175
184
  await fs.access(resolvedPath)
176
185
  // File exists in current directory, no need to bubble up
177
- } catch (error) {
186
+ } catch {
178
187
  // File not found in current directory, try to bubble up
179
188
  const bubbledPath = await this.directoryBubbleService.findLocalConfigInParentDirectories(
180
189
  filePathData.filePath,
@@ -221,7 +230,7 @@ export class MCPConfigService {
221
230
 
222
231
  return mcpFilesPathsData
223
232
  } catch (error) {
224
- throw new Error(`Failed to get MCP file groups: ${error instanceof Error ? error.message : 'Unknown error'}`)
233
+ throw new Error(`Failed to get MCP file groups: ${error instanceof Error ? error.message : 'Unknown error'}`, { cause: error })
225
234
  }
226
235
  }
227
236
 
@@ -290,7 +299,7 @@ export class MCPConfigService {
290
299
 
291
300
  return mcpFilesPathsData
292
301
  } catch (error) {
293
- throw new Error(`Failed to parse custom files: ${error instanceof Error ? error.message : 'Unknown error'}`)
302
+ throw new Error(`Failed to parse custom files: ${error instanceof Error ? error.message : 'Unknown error'}`, { cause: error })
294
303
  }
295
304
  }
296
305
 
@@ -301,7 +310,7 @@ export class MCPConfigService {
301
310
  try {
302
311
  this.pathRegistry.registerCustomApp(this.currentOS, appName, paths)
303
312
  } catch (error) {
304
- throw new Error(`Failed to register custom app '${appName}': ${error instanceof Error ? error.message : 'Unknown error'}`)
313
+ throw new Error(`Failed to register custom app '${appName}': ${error instanceof Error ? error.message : 'Unknown error'}`, { cause: error })
305
314
  }
306
315
  }
307
316
 
@@ -322,7 +331,7 @@ export class MCPConfigService {
322
331
  /**
323
332
  * Convert parsed server configs to MCPServerInfo format
324
333
  */
325
- private async convertToMCPServerInfo (servers: Record<string, any>): Promise<MCPServerInfo[]> {
334
+ private async convertToMCPServerInfo (servers: Record<string, RawMCPServerConfig>): Promise<MCPServerInfo[]> {
326
335
  const serverInfos: MCPServerInfo[] = []
327
336
 
328
337
  for (const [serverName, serverConfig] of Object.entries(servers)) {
@@ -140,7 +140,7 @@ export class MCPServerManagerService {
140
140
  let mcpServerDetection: MatchedProcess | undefined
141
141
 
142
142
  for (const [pid, processData] of processMap) {
143
- const commandMatchLinux = this.isCommandMatch(processData.commandTokens, pid, processData.ppid)
143
+ const commandMatchLinux = this.isCommandMatch(processData.commandTokens)
144
144
  let commandMatchWin32 = false
145
145
  if (platform() === 'win32') {
146
146
  // for Windows, we need to change commandTokens to also match another pattern
@@ -160,7 +160,7 @@ export class MCPServerManagerService {
160
160
  }
161
161
  }
162
162
 
163
- commandMatchWin32 = this.isCommandMatch(commandTokensOnWin32, pid, processData.ppid)
163
+ commandMatchWin32 = this.isCommandMatch(commandTokensOnWin32)
164
164
  }
165
165
 
166
166
  const commandMatch = commandMatchLinux || commandMatchWin32
@@ -196,7 +196,7 @@ export class MCPServerManagerService {
196
196
  }
197
197
 
198
198
  return false
199
- } catch (error) {
199
+ } catch {
200
200
  return false
201
201
  }
202
202
  }
@@ -233,7 +233,7 @@ export class MCPServerManagerService {
233
233
  }
234
234
  }
235
235
 
236
- private isCommandMatch (commandTokens: string[], pid: string, ppid: string): boolean {
236
+ private isCommandMatch (commandTokens: string[]): boolean {
237
237
  // If no command tokens, cannot match
238
238
  if (commandTokens.length === 0) return false
239
239
 
@@ -534,7 +534,7 @@ export class MCPServerManagerService {
534
534
  // Check if it's the expected npm exec pattern
535
535
  if (commandTokens[1] !== 'exec') return false
536
536
 
537
- let argsToMatch: string[] = []
537
+ let argsToMatch: string[]
538
538
  const yIndex = this.args.indexOf('-y')
539
539
 
540
540
  if (yIndex !== -1 && yIndex + 1 < this.args.length) {
@@ -9,6 +9,7 @@ import FilePathComponent from '../components/file-path.js'
9
9
  import MCPServersConfigParsableComponent from '../components/mcp-servers-config-parsable.js'
10
10
  import CredentialWarningComponent from '../components/credential-warning.js'
11
11
  import SummaryComponent from '../components/summary.js'
12
+ import type { MCPServerInfo } from '../types/mcp-config-service.types.js'
12
13
 
13
14
  interface GroupMetadata {
14
15
  mcpServersRunning?: number
@@ -40,7 +41,7 @@ export class RenderService {
40
41
  return text.replace(/\u001b\[[0-9;]*m/g, '').length
41
42
  }
42
43
 
43
- static printMcpServers (data: any[]) {
44
+ static printMcpServers (data: MCPServerInfo[]) {
44
45
  if (data.length === 0) return
45
46
 
46
47
  const headers = ['STATUS', 'NAME', 'VERSION', 'SOURCE', 'TRANSPORT', 'CREDENTIALS']
@@ -52,7 +53,7 @@ export class RenderService {
52
53
  const columnWidths = headers.map((header, index) => {
53
54
  const headerWidth = RenderService.getVisibleLength(ColumnNameComponent(header))
54
55
  const dataWidth = Math.max(...data.map(row => {
55
- let text = String(row[keys[index]])
56
+ let text = String((row as unknown as Record<string, unknown>)[keys[index]])
56
57
 
57
58
  // Apply the same transformations used in rendering
58
59
  if (keys[index] === 'transport') {
@@ -72,11 +73,11 @@ export class RenderService {
72
73
  }
73
74
 
74
75
  if (keys[index] === 'versionInfo') {
75
- text = MCPServerVersionComponent(row[keys[index]])
76
+ text = MCPServerVersionComponent(row.versionInfo)
76
77
  }
77
78
 
78
79
  if (keys[index] === 'credentials') {
79
- text = CredentialWarningComponent(row[keys[index]])
80
+ text = CredentialWarningComponent(row.credentials)
80
81
  }
81
82
 
82
83
  return RenderService.getVisibleLength(text)
@@ -123,7 +124,7 @@ export class RenderService {
123
124
  // Print data rows
124
125
  for (const row of data) {
125
126
  const dataRow = keys.map((key, index) => {
126
- let text = String(row[key])
127
+ let text = String((row as unknown as Record<string, unknown>)[key])
127
128
 
128
129
  // Apply styling transformations
129
130
  if (key === 'transport') {
@@ -143,11 +144,11 @@ export class RenderService {
143
144
  }
144
145
 
145
146
  if (key === 'versionInfo') {
146
- text = MCPServerVersionComponent(row[key])
147
+ text = MCPServerVersionComponent(row.versionInfo)
147
148
  }
148
149
 
149
150
  if (key === 'credentials') {
150
- text = CredentialWarningComponent(row[key])
151
+ text = CredentialWarningComponent(row.credentials)
151
152
  }
152
153
 
153
154
  // Apply alignment
@@ -167,7 +168,7 @@ export class RenderService {
167
168
  // { key: 'STATUS', value: '[✓ VALID] [GLOBAL] [5 MCP SERVERS]' }
168
169
  // ]
169
170
 
170
- static printMcpGroup (id: number, data: any[], groupMetadata: GroupMetadata = {}) {
171
+ static printMcpGroup (id: number, data: Array<Record<string, string>>, groupMetadata: GroupMetadata = {}) {
171
172
  if (data.length === 0) return
172
173
 
173
174
  console.log('\n')
@@ -17,7 +17,7 @@ export function extractHostname (urlString: string): string {
17
17
 
18
18
  const url = new URL(urlToParse)
19
19
  return url.hostname
20
- } catch (error) {
20
+ } catch {
21
21
  // If URL parsing fails, return the original string
22
22
  return urlString
23
23
  }