ls-mcp 1.9.0 → 1.10.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.
@@ -0,0 +1,164 @@
1
+ import path from 'node:path'
2
+ import { type MCPAppPathsRecord, type MCPFilePath } from '../types/mcp-config-service.types.js'
3
+
4
+ export class MCPPathRegistry {
5
+ private static readonly WINDOWS_PATHS: MCPAppPathsRecord = {
6
+ claude: [
7
+ { filePath: path.join(process.env.APPDATA || '', 'Claude', 'claude_desktop_config.json'), type: 'global' }
8
+ ],
9
+ claude_code: [
10
+ { filePath: '.mcp.json', type: 'local' }
11
+ ],
12
+ cursor: [
13
+ { filePath: path.join(process.env.HOME || '', '.cursor', 'mcp.json'), type: 'global' },
14
+ { filePath: path.join('.cursor', 'mcp.json'), type: 'local' }
15
+ ],
16
+ vscode: [
17
+ { filePath: path.join('.vscode', 'mcp.json'), type: 'local' },
18
+ { filePath: path.join(process.env.APPDATA || '', 'Code', 'User', 'settings.json'), type: 'global' },
19
+ { filePath: path.join(process.env.APPDATA || '', 'Code - Insiders', 'User', 'settings.json'), type: 'global' },
20
+ { filePath: path.join(process.env.APPDATA || '', 'Code', 'User', 'mcp.json'), type: 'global' },
21
+ { filePath: path.join(process.env.APPDATA || '', 'Code - Insiders', 'User', 'mcp.json'), type: 'global' }
22
+ ],
23
+ cline: [
24
+ { filePath: path.join(process.env.APPDATA || '', 'Code', 'User', 'globalStorage', 'saoudrizwan.claude-dev', 'settings', 'cline_mcp_settings.json'), type: 'global' },
25
+ { filePath: path.join(process.env.APPDATA || '', 'Code - Insiders', 'User', 'globalStorage', 'saoudrizwan.claude-dev', 'settings', 'cline_mcp_settings.json'), type: 'global' }
26
+ ],
27
+ windsurf: [
28
+ { filePath: path.join('.codeium', 'windsurf', 'mcp_config.json'), type: 'local' }
29
+ ],
30
+ roo: [
31
+ { filePath: path.join(process.env.APPDATA || '', 'Code', 'User', 'globalStorage', 'rooveterinaryinc.roo-cline', 'settings', 'cline_mcp_settings.json'), type: 'global' },
32
+ { filePath: path.join(process.env.APPDATA || '', 'Code - Insiders', 'User', 'globalStorage', 'rooveterinaryinc.roo-cline', 'settings', 'cline_mcp_settings.json'), type: 'global' }
33
+ ],
34
+ 'intellij-github-copilot': [
35
+ { filePath: path.join(process.env.LOCALAPPDATA || '', 'github-copilot', 'intellij', 'mcp.json'), type: 'global' }
36
+ ],
37
+ junie: [
38
+ { filePath: path.join(process.env.HOME || '', '.junie', 'mcp', 'mcp.json'), type: 'global' }
39
+ ],
40
+ zed: [
41
+ { filePath: path.join(process.env.LOCALAPPDATA || '', 'zed', 'settings.json'), type: 'global' },
42
+ { filePath: path.join('.zed', 'settings.json'), type: 'local' }
43
+ ],
44
+ gemini: [
45
+ { filePath: path.join(process.env.HOME || '', '.gemini', 'settings.json'), type: 'global' },
46
+ { filePath: path.join('.gemini', 'settings.json'), type: 'local' }
47
+ ]
48
+ }
49
+
50
+ private static readonly DARWIN_PATHS: MCPAppPathsRecord = {
51
+ claude: [
52
+ { filePath: path.join(process.env.HOME || '', 'Library', 'Application Support', 'Claude', 'claude_desktop_config.json'), type: 'global' }
53
+ ],
54
+ claude_code: [
55
+ { filePath: '.mcp.json', type: 'local' }
56
+ ],
57
+ cursor: [
58
+ { filePath: path.join(process.env.HOME || '', '.cursor', 'mcp.json'), type: 'global' },
59
+ { filePath: path.join('.cursor', 'mcp.json'), type: 'local' }
60
+ ],
61
+ vscode: [
62
+ { filePath: path.join('.vscode', 'mcp.json'), type: 'local' },
63
+ { filePath: path.join(process.env.HOME || '', 'Library', 'Application Support', 'Code', 'User', 'settings.json'), type: 'global' },
64
+ { filePath: path.join(process.env.HOME || '', 'Library', 'Application Support', 'Code', 'User', 'mcp.json'), type: 'global' },
65
+ { filePath: path.join(process.env.HOME || '', 'Library', 'Application Support', 'Code - Insiders', 'User', 'settings.json'), type: 'global' },
66
+ { filePath: path.join(process.env.HOME || '', 'Library', 'Application Support', 'Code - Insiders', 'User', 'mcp.json'), type: 'global' }
67
+ ],
68
+ cline: [
69
+ { filePath: path.join(process.env.HOME || '', 'Library', 'Application Support', 'Code', 'User', 'globalStorage', 'saoudrizwan.claude-dev', 'settings', 'cline_mcp_settings.json'), type: 'global' },
70
+ { filePath: path.join(process.env.HOME || '', 'Library', 'Application Support', 'Code - Insiders', 'User', 'globalStorage', 'saoudrizwan.claude-dev', 'settings', 'cline_mcp_settings.json'), type: 'global' }
71
+ ],
72
+ windsurf: [
73
+ { filePath: path.join('.codeium', 'windsurf', 'mcp_config.json'), type: 'local' }
74
+ ],
75
+ roo: [
76
+ { filePath: path.join(process.env.HOME || '', 'Library', 'Application Support', 'Code', 'User', 'globalStorage', 'rooveterinaryinc.roo-cline', 'settings', 'cline_mcp_settings.json'), type: 'global' },
77
+ { filePath: path.join(process.env.HOME || '', 'Library', 'Application Support', 'Code - Insiders', 'User', 'globalStorage', 'rooveterinaryinc.roo-cline', 'settings', 'cline_mcp_settings.json'), type: 'global' }
78
+ ],
79
+ 'intellij-github-copilot': [
80
+ { filePath: path.join(process.env.HOME || '', '.config', 'github-copilot', 'intellij', 'mcp.json'), type: 'global' }
81
+ ],
82
+ junie: [
83
+ { filePath: path.join(process.env.HOME || '', '.junie', 'mcp', 'mcp.json'), type: 'global' },
84
+ { filePath: path.join('.junie', 'mcp', 'mcp.json'), type: 'local' }
85
+ ],
86
+ zed: [
87
+ { filePath: path.join(process.env.HOME || '', '.config', 'zed', 'settings.json'), type: 'global' },
88
+ { filePath: path.join('.zed', 'settings.json'), type: 'local' }
89
+ ],
90
+ gemini: [
91
+ { filePath: path.join(process.env.HOME || '', '.gemini', 'settings.json'), type: 'global' },
92
+ { filePath: path.join('.gemini', 'settings.json'), type: 'local' }
93
+ ]
94
+ }
95
+
96
+ private customApps: Map<string, MCPAppPathsRecord> = new Map()
97
+
98
+ /**
99
+ * Get all MCP configuration file paths for a specific operating system
100
+ */
101
+ getPathsForOS (os: string): MCPAppPathsRecord {
102
+ switch (os.toLowerCase()) {
103
+ case 'win32':
104
+ case 'windows':
105
+ return { ...MCPPathRegistry.WINDOWS_PATHS }
106
+ case 'darwin':
107
+ case 'macos':
108
+ return { ...MCPPathRegistry.DARWIN_PATHS }
109
+ default:
110
+ throw new Error(`Unsupported operating system: ${os}`)
111
+ }
112
+ }
113
+
114
+ /**
115
+ * Get MCP configuration file paths for a specific app on a specific OS
116
+ */
117
+ getPathsForApp (os: string, appName: string): MCPFilePath[] {
118
+ const osPaths = this.getPathsForOS(os)
119
+ const appPaths = osPaths[appName]
120
+
121
+ if (!appPaths) {
122
+ throw new Error(`App '${appName}' not found for OS '${os}'`)
123
+ }
124
+
125
+ return [...appPaths]
126
+ }
127
+
128
+ /**
129
+ * Get all supported app names for a specific OS
130
+ */
131
+ getSupportedApps (os: string): string[] {
132
+ const osPaths = this.getPathsForOS(os)
133
+ return Object.keys(osPaths)
134
+ }
135
+
136
+ /**
137
+ * Get all supported operating systems
138
+ */
139
+ getSupportedOperatingSystems (): string[] {
140
+ return ['win32', 'darwin']
141
+ }
142
+
143
+ /**
144
+ * Register a custom app with custom paths for a specific OS
145
+ */
146
+ registerCustomApp (os: string, appName: string, paths: MCPFilePath[]): void {
147
+ if (!this.customApps.has(os)) {
148
+ this.customApps.set(os, {})
149
+ }
150
+
151
+ const osCustomApps = this.customApps.get(os)!
152
+ osCustomApps[appName] = [...paths]
153
+ }
154
+
155
+ /**
156
+ * Get paths including custom registered apps
157
+ */
158
+ getPathsForOSWithCustom (os: string): MCPAppPathsRecord {
159
+ const basePaths = this.getPathsForOS(os)
160
+ const customPaths = this.customApps.get(os) || {}
161
+
162
+ return { ...basePaths, ...customPaths }
163
+ }
164
+ }
@@ -6,9 +6,9 @@ interface MCPServerConfig {
6
6
  name: string
7
7
  command: string
8
8
  args?: string[]
9
- transport?: 'stdio' | 'sse'
9
+ transport?: 'stdio' | 'sse' | 'http'
10
10
  url?: string
11
- type?: 'sse' | 'http' | 'stdio'
11
+ type?: 'sse' | 'http' | 'stdio' | 'streamable-http'
12
12
  env?: Record<string, string>
13
13
  }
14
14
 
@@ -38,7 +38,7 @@ export class MCPServerManagerService {
38
38
  if (serverConfig?.type && serverConfig.type === 'sse') {
39
39
  this.transport = 'sse'
40
40
  }
41
- if (serverConfig?.type && serverConfig.type === 'http') {
41
+ if (serverConfig?.type && (serverConfig.type === 'http' || serverConfig.type === 'streamable-http')) {
42
42
  this.transport = 'http'
43
43
  }
44
44
  if (serverConfig?.type && serverConfig.type === 'stdio') {
@@ -6,12 +6,25 @@ import MCPServerNameComponent from '../components/mcp-server-name.js'
6
6
  import MCPServerSourceComponent from '../components/mcp-server-source.js'
7
7
  import FilePathComponent from '../components/file-path.js'
8
8
  import MCPServersConfigParsableComponent from '../components/mcp-servers-config-parsable.js'
9
+ import CredentialWarningComponent from '../components/credential-warning.js'
10
+ import SummaryComponent from '../components/summary.js'
9
11
 
10
12
  interface GroupMetadata {
11
13
  mcpServersRunning?: number
12
14
  mcpServersTotal?: number
13
15
  }
14
16
 
17
+ interface SummaryStats {
18
+ totalServers: number
19
+ runningServers: number
20
+ highRiskCredentials: number
21
+ transportBreakdown: {
22
+ stdio: number
23
+ sse: number
24
+ http: number
25
+ }
26
+ }
27
+
15
28
  export class RenderService {
16
29
  // Example mocked data for rendering the servers information
17
30
  // const mcpServersDataMock = [
@@ -28,8 +41,8 @@ export class RenderService {
28
41
  static printMcpServers (data: any[]) {
29
42
  if (data.length === 0) return
30
43
 
31
- const headers = ['STATUS', 'NAME', 'SOURCE', 'TRANSPORT']
32
- const keys = ['status', 'name', 'source', 'transport']
44
+ const headers = ['STATUS', 'NAME', 'SOURCE', 'TRANSPORT', 'CREDENTIALS']
45
+ const keys = ['status', 'name', 'source', 'transport', 'credentials']
33
46
  const centerColumns = [0, 2, 3] // STATUS and TRANSPORT column indices
34
47
  const leftPadding = ' ' // 6 characters
35
48
 
@@ -56,6 +69,10 @@ export class RenderService {
56
69
  text = MCPServerNameComponent(text)
57
70
  }
58
71
 
72
+ if (keys[index] === 'credentials') {
73
+ text = CredentialWarningComponent(row[keys[index]])
74
+ }
75
+
59
76
  return RenderService.getVisibleLength(text)
60
77
  }))
61
78
  return Math.max(headerWidth, dataWidth)
@@ -119,6 +136,10 @@ export class RenderService {
119
136
  text = MCPServerNameComponent(text)
120
137
  }
121
138
 
139
+ if (key === 'credentials') {
140
+ text = CredentialWarningComponent(row[key])
141
+ }
142
+
122
143
  // Apply alignment
123
144
  if (centerColumns.includes(index)) {
124
145
  return centerText(text, columnWidths[index])
@@ -220,4 +241,27 @@ export class RenderService {
220
241
 
221
242
  return `${filled}${empty} ${count} / ${total} ${label}`
222
243
  }
244
+
245
+ /**
246
+ * Print summary statistics at the end of the output
247
+ */
248
+ static printSummary (stats: SummaryStats): void {
249
+ console.log('\n')
250
+ console.log(' ▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄')
251
+ console.log()
252
+
253
+ const summaryOutput = SummaryComponent(stats)
254
+ const lines = summaryOutput.split('\n')
255
+
256
+ for (const line of lines) {
257
+ if (line === 'SUMMARY') {
258
+ console.log(' ' + line)
259
+ } else {
260
+ console.log(' ' + line)
261
+ }
262
+ }
263
+
264
+ console.log()
265
+ console.log(' ▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄')
266
+ }
223
267
  }
@@ -0,0 +1,75 @@
1
+ export interface MCPConfigData {
2
+ raw: any
3
+ parsed: boolean
4
+ valid: boolean
5
+ servers: Record<string, MCPServerConfig>
6
+ }
7
+
8
+ export interface MCPServerConfig {
9
+ name: string
10
+ command: string
11
+ args?: string[]
12
+ transport?: 'stdio' | 'sse' | 'http'
13
+ type?: 'sse' | 'http' | 'stdio' | 'streamable-http'
14
+ env?: Record<string, string>
15
+ }
16
+
17
+ export interface MCPAppMetadata {
18
+ name: string
19
+ friendlyName: string
20
+ paths: MCPFilePath[]
21
+ }
22
+
23
+ export interface MCPFilePath {
24
+ filePath: string
25
+ type: 'local' | 'global'
26
+ parsable?: boolean
27
+ servers?: MCPServerInfo[]
28
+ }
29
+
30
+ export interface MCPServerInfo {
31
+ name: string
32
+ command: string
33
+ args?: string[]
34
+ transport?: 'stdio' | 'sse' | 'http'
35
+ type?: 'sse' | 'http' | 'stdio' | 'streamable-http'
36
+ source?: string
37
+ env?: Record<string, string>
38
+ status?: 'running' | 'stopped'
39
+ credentials?: CredentialAnalysisResult
40
+ }
41
+
42
+ export interface MCPFileGroups {
43
+ name: string
44
+ friendlyName: string
45
+ paths: MCPFilePath[]
46
+ stats?: {
47
+ serversCount?: number
48
+ }
49
+ }
50
+
51
+ export interface MCPFileGroupsResult {
52
+ name: string
53
+ friendlyName: string
54
+ paths: MCPFilePath[]
55
+ stats: {
56
+ serversCount?: number
57
+ }
58
+ }
59
+
60
+ export type MCPFilePathGroupsRecord = Record<string, MCPFileGroups>
61
+ export type MCPFileGroupsResultRecord = Record<string, MCPFileGroups>
62
+ export type MCPAppPathsRecord = Record<string, MCPFilePath[]>
63
+
64
+ // Credential detection types
65
+ export interface CredentialVariable {
66
+ name: string
67
+ value: string
68
+ riskLevel: 'low' | 'high'
69
+ }
70
+
71
+ export interface CredentialAnalysisResult {
72
+ hasCredentials: boolean
73
+ credentialVars: CredentialVariable[]
74
+ riskLevel: 'none' | 'low' | 'high'
75
+ }
package/src/types.ts ADDED
@@ -0,0 +1,38 @@
1
+ export interface MCPServerInfo {
2
+ name: string
3
+ command: string
4
+ args?: string[]
5
+ transport?: 'stdio' | 'sse' | 'http',
6
+ type?: 'sse' | 'http' | 'stdio' | 'streamable-http'
7
+ source?: string
8
+ env?: Record<string, string>
9
+ status?: 'running' | 'stopped'
10
+ }
11
+
12
+ export interface MCPFilePath {
13
+ filePath: string
14
+ type: 'local' | 'global'
15
+ parsable?: boolean
16
+ servers?: MCPServerInfo[]
17
+ }
18
+
19
+ export interface MCPFileGroups {
20
+ name: string
21
+ friendlyName: string
22
+ paths: MCPFilePath[]
23
+ stats?: {
24
+ serversCount?: number
25
+ }
26
+ }
27
+
28
+ export interface MCPFileGroupsResult {
29
+ name: string
30
+ friendlyName: string
31
+ paths: MCPFilePath[]
32
+ stats: {
33
+ serversCount?: number
34
+ }
35
+ }
36
+
37
+ export type MCPFilePathGroupsRecord = Record<string, MCPFileGroups>
38
+ export type MCPFileGroupsResultRecord = Record<string, MCPFileGroupsResult>