ls-mcp 1.9.1 → 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,233 @@
1
+ import fs from 'node:fs/promises'
2
+ import { parse } from 'jsonc-parser'
3
+ import { type MCPConfigData, type MCPServerConfig } from '../types/mcp-config-service.types.js'
4
+
5
+ export class MCPConfigParser {
6
+ private filePath: string
7
+ private fileContents: string | null = null
8
+ private parsed: boolean = false
9
+ private valid: boolean = false
10
+ private fileContentsData: any | null = null
11
+
12
+ constructor (filePath: string) {
13
+ this.filePath = filePath
14
+ }
15
+
16
+ /**
17
+ * Parse the configuration file and return structured data
18
+ */
19
+ async parseConfigFile (): Promise<MCPConfigData> {
20
+ if (this.parsed) {
21
+ return {
22
+ raw: this.fileContentsData,
23
+ parsed: this.parsed,
24
+ valid: this.valid,
25
+ servers: await this.extractMCPServers(this.fileContentsData)
26
+ }
27
+ }
28
+
29
+ this.parsed = true
30
+ const fileContent = await this.getFileContent()
31
+
32
+ // Try parsing as standard JSON first
33
+ try {
34
+ this.fileContentsData = JSON.parse(fileContent)
35
+ if (typeof this.fileContentsData === 'object') {
36
+ this.valid = true
37
+ }
38
+ } catch (e) {
39
+ // Ignore JSON parse errors, try JSONC next
40
+ }
41
+
42
+ // Try parsing as JSONC if standard JSON failed
43
+ if (!this.valid) {
44
+ try {
45
+ this.fileContentsData = parse(fileContent)
46
+ if (typeof this.fileContentsData === 'object') {
47
+ this.valid = true
48
+ }
49
+ } catch (error) {
50
+ // Ignore JSONC parse errors
51
+ }
52
+ }
53
+
54
+ // @TODO: Add support for YAML and other formats in the future
55
+
56
+ if (!this.valid) {
57
+ throw new Error(`Failed to parse configuration file: ${this.filePath}`)
58
+ }
59
+
60
+ return {
61
+ raw: this.fileContentsData,
62
+ parsed: this.parsed,
63
+ valid: this.valid,
64
+ servers: await this.extractMCPServers(this.fileContentsData)
65
+ }
66
+ }
67
+
68
+ /**
69
+ * Extract MCP servers from parsed configuration data
70
+ */
71
+ async extractMCPServers (configData: any): Promise<Record<string, MCPServerConfig>> {
72
+ if (!configData || typeof configData !== 'object') {
73
+ return {}
74
+ }
75
+
76
+ // VS Code uses `servers`
77
+ if (configData.servers && typeof configData.servers === 'object') {
78
+ return this.normalizeServerConfigs(configData.servers)
79
+ }
80
+
81
+ // VS Code global settings.json file uses `mcp` -> `servers`
82
+ if (configData.mcp?.servers && typeof configData.mcp.servers === 'object') {
83
+ return this.normalizeServerConfigs(configData.mcp.servers)
84
+ }
85
+
86
+ // Claude and Cursor use the `mcpServers` key
87
+ if (configData.mcpServers && typeof configData.mcpServers === 'object') {
88
+ return this.normalizeServerConfigs(configData.mcpServers)
89
+ }
90
+
91
+ // Zed uses `context_servers` key
92
+ if (configData.context_servers && typeof configData.context_servers === 'object') {
93
+ return this.normalizeServerConfigs(configData.context_servers)
94
+ }
95
+
96
+ return {}
97
+ }
98
+
99
+ /**
100
+ * Normalize server configurations to ensure consistent structure
101
+ */
102
+ private normalizeServerConfigs (servers: Record<string, any>): Record<string, MCPServerConfig> {
103
+ const normalized: Record<string, MCPServerConfig> = {}
104
+
105
+ for (const [serverName, serverConfig] of Object.entries(servers)) {
106
+ if (serverConfig && typeof serverConfig === 'object') {
107
+ const env = serverConfig.env && typeof serverConfig.env === 'object' ? serverConfig.env : undefined
108
+
109
+ normalized[serverName] = {
110
+ name: serverName,
111
+ command: serverConfig.command || '',
112
+ args: Array.isArray(serverConfig.args) ? serverConfig.args : undefined,
113
+ type: this.validateType(serverConfig.type) ? serverConfig.type : this.inferTransportType(serverConfig),
114
+ env
115
+ }
116
+ }
117
+ }
118
+
119
+ return normalized
120
+ }
121
+
122
+ /**
123
+ * Validate type value
124
+ */
125
+ private validateType (type: any): type is 'sse' | 'http' | 'stdio' | 'streamable-http' {
126
+ return ['sse', 'http', 'stdio', 'streamable-http'].includes(type)
127
+ }
128
+
129
+ /**
130
+ * Infer transport type from server configuration when type field is not explicitly set
131
+ */
132
+ private inferTransportType (serverConfig: any): 'sse' | 'http' | 'stdio' | undefined {
133
+ // Rule 1: If URL is present, infer HTTP transport
134
+ if (serverConfig.url && typeof serverConfig.url === 'string') {
135
+ return 'http'
136
+ }
137
+
138
+ // Rule 2-4: Search through args array for transport indicators
139
+ if (Array.isArray(serverConfig.args)) {
140
+ const argsString = serverConfig.args.join(' ').toLowerCase()
141
+
142
+ // Check for stdio indicators
143
+ if (argsString.includes('stdio')) {
144
+ return 'stdio'
145
+ }
146
+
147
+ // Check for HTTP indicators
148
+ if (argsString.includes('http')) {
149
+ return 'http'
150
+ }
151
+
152
+ // Check for SSE indicators
153
+ if (argsString.includes('sse')) {
154
+ return 'sse'
155
+ }
156
+ }
157
+
158
+ // Rule 5: Default to stdio if command is present but no other indicators found
159
+ // This is a reasonable default since most MCP servers use stdio transport
160
+ if (serverConfig.command && typeof serverConfig.command === 'string') {
161
+ return 'stdio'
162
+ }
163
+
164
+ // No transport type could be inferred
165
+ return undefined
166
+ }
167
+
168
+ /**
169
+ * Validate server configuration
170
+ */
171
+ validateServerConfig (serverConfig: MCPServerConfig): boolean {
172
+ if (!serverConfig || typeof serverConfig !== 'object') {
173
+ return false
174
+ }
175
+
176
+ if (!serverConfig.name || typeof serverConfig.name !== 'string') {
177
+ return false
178
+ }
179
+
180
+ if (!serverConfig.command || typeof serverConfig.command !== 'string') {
181
+ return false
182
+ }
183
+
184
+ return true
185
+ }
186
+
187
+ /**
188
+ * Get supported configuration keys that the parser recognizes
189
+ */
190
+ getSupportedConfigKeys (): string[] {
191
+ return ['servers', 'mcp.servers', 'mcpServers', 'context_servers']
192
+ }
193
+
194
+ /**
195
+ * Check if the configuration file has valid syntax
196
+ */
197
+ async isValidSyntax (): Promise<boolean> {
198
+ try {
199
+ const configData = await this.parseConfigFile()
200
+ return configData.valid
201
+ } catch (error) {
202
+ return false
203
+ }
204
+ }
205
+
206
+ /**
207
+ * Count the number of MCP servers in the configuration
208
+ */
209
+ async countMCPServers (): Promise<number> {
210
+ try {
211
+ const configData = await this.parseConfigFile()
212
+ return Object.keys(configData.servers).length
213
+ } catch (error) {
214
+ return 0
215
+ }
216
+ }
217
+
218
+ /**
219
+ * Get the raw file content
220
+ */
221
+ private async getFileContent (): Promise<string> {
222
+ if (this.fileContents) {
223
+ return this.fileContents
224
+ }
225
+
226
+ try {
227
+ this.fileContents = await fs.readFile(this.filePath, 'utf-8')
228
+ return this.fileContents
229
+ } catch (error) {
230
+ throw new Error(`Failed to read file: ${this.filePath}`)
231
+ }
232
+ }
233
+ }
@@ -0,0 +1,267 @@
1
+ import { platform } from 'node:os'
2
+ import path from 'node:path'
3
+ import fs from 'node:fs/promises'
4
+ import util from 'node:util'
5
+ import { MCPPathRegistry } from './mcp-path-registry.js'
6
+ import { MCPConfigParser } from './mcp-config-parser.js'
7
+ import { CredentialDetectionService } from './credential-detection-service.js'
8
+ import {
9
+ type MCPAppPathsRecord,
10
+ type MCPFilePath,
11
+ type MCPServerInfo,
12
+ type MCPAppMetadata,
13
+ type MCPFileGroupsResultRecord
14
+ } from '../types/mcp-config-service.types.js'
15
+
16
+ export class MCPConfigService {
17
+ private pathRegistry: MCPPathRegistry
18
+ private currentOS: string
19
+ private debug: util.DebugLogger
20
+
21
+ constructor () {
22
+ this.pathRegistry = new MCPPathRegistry()
23
+ this.currentOS = platform()
24
+ this.debug = util.debuglog('ls-mcp')
25
+ }
26
+
27
+ /**
28
+ * Get MCP configuration files for a specific AI application on the current OS
29
+ */
30
+ getConfigFilesPerApp (appName: string): MCPFilePath[] {
31
+ try {
32
+ return this.pathRegistry.getPathsForApp(this.currentOS, appName)
33
+ } catch (error) {
34
+ throw new Error(`Failed to get config files for app '${appName}': ${error instanceof Error ? error.message : 'Unknown error'}`)
35
+ }
36
+ }
37
+
38
+ /**
39
+ * Get MCP configuration files for all AI applications on the current OS
40
+ */
41
+ getAllConfigFiles (): MCPAppPathsRecord {
42
+ try {
43
+ return this.pathRegistry.getPathsForOS(this.currentOS)
44
+ } catch (error) {
45
+ throw new Error(`Failed to get all config files: ${error instanceof Error ? error.message : 'Unknown error'}`)
46
+ }
47
+ }
48
+
49
+ /**
50
+ * Get MCP servers configured for a specific AI application on the current OS
51
+ */
52
+ async getMCPServersPerApp (appName: string): Promise<MCPServerInfo[]> {
53
+ try {
54
+ const appPaths = this.getConfigFilesPerApp(appName)
55
+ const allServers: MCPServerInfo[] = []
56
+
57
+ for (const filePath of appPaths) {
58
+ const servers = await this.parseConfigFileForServers(filePath.filePath)
59
+ allServers.push(...servers)
60
+ }
61
+
62
+ return allServers
63
+ } catch (error) {
64
+ throw new Error(`Failed to get MCP servers for app '${appName}': ${error instanceof Error ? error.message : 'Unknown error'}`)
65
+ }
66
+ }
67
+
68
+ /**
69
+ * Get MCP servers configured for all AI applications on the current OS
70
+ */
71
+ async getAllMCPServers (): Promise<Record<string, MCPServerInfo[]>> {
72
+ try {
73
+ const allApps = this.pathRegistry.getSupportedApps(this.currentOS)
74
+ const allServers: Record<string, MCPServerInfo[]> = {}
75
+
76
+ for (const appName of allApps) {
77
+ try {
78
+ allServers[appName] = await this.getMCPServersPerApp(appName)
79
+ } catch (error) {
80
+ // Log error but continue with other apps
81
+ this.debug(`Failed to get servers for app '${appName}': ${error instanceof Error ? error.message : 'Unknown error'}`)
82
+ allServers[appName] = []
83
+ }
84
+ }
85
+
86
+ return allServers
87
+ } catch (error) {
88
+ throw new Error(`Failed to get all MCP servers: ${error instanceof Error ? error.message : 'Unknown error'}`)
89
+ }
90
+ }
91
+
92
+ /**
93
+ * Get metadata for all supported AI applications on the current OS
94
+ */
95
+ getSupportedApps (): MCPAppMetadata[] {
96
+ try {
97
+ const appNames = this.pathRegistry.getSupportedApps(this.currentOS)
98
+ const appPaths = this.pathRegistry.getPathsForOS(this.currentOS)
99
+
100
+ return appNames.map(appName => ({
101
+ name: appName,
102
+ friendlyName: this.getFriendlyName(appName),
103
+ paths: appPaths[appName] || []
104
+ }))
105
+ } catch (error) {
106
+ throw new Error(`Failed to get supported apps: ${error instanceof Error ? error.message : 'Unknown error'}`)
107
+ }
108
+ }
109
+
110
+ /**
111
+ * Get all supported operating systems
112
+ */
113
+ getSupportedOperatingSystems (): string[] {
114
+ return this.pathRegistry.getSupportedOperatingSystems()
115
+ }
116
+
117
+ /**
118
+ * Validate if a configuration file exists and is parsable
119
+ */
120
+ async validateConfigFile (filePath: string): Promise<boolean> {
121
+ try {
122
+ await fs.access(filePath)
123
+ const parser = this.createParser(filePath)
124
+ return await parser.isValidSyntax()
125
+ } catch (error) {
126
+ return false
127
+ }
128
+ }
129
+
130
+ /**
131
+ * Create a parser instance (can be overridden for testing)
132
+ */
133
+ protected createParser (filePath: string): MCPConfigParser {
134
+ return new MCPConfigParser(filePath)
135
+ }
136
+
137
+ /**
138
+ * Get MCP file groups with resolved paths and server information
139
+ */
140
+ async getMCPFileGroups (): Promise<MCPFileGroupsResultRecord> {
141
+ try {
142
+ const appPaths = this.getAllConfigFiles()
143
+ const mcpFilesPathsData: MCPFileGroupsResultRecord = {}
144
+
145
+ for (const [groupName, paths] of Object.entries(appPaths)) {
146
+ mcpFilesPathsData[groupName] = {
147
+ name: groupName,
148
+ friendlyName: this.getFriendlyName(groupName),
149
+ paths: [],
150
+ stats: { serversCount: 0 }
151
+ }
152
+
153
+ const uniqueFilePaths = new Set<string>()
154
+ let totalServersCount = 0
155
+
156
+ for (const filePathData of paths) {
157
+ const resolvedPath = filePathData.filePath.replace('~', process.env.HOME || '')
158
+ const absolutePath = path.resolve(resolvedPath)
159
+
160
+ if (uniqueFilePaths.has(absolutePath)) {
161
+ continue
162
+ }
163
+ uniqueFilePaths.add(absolutePath)
164
+
165
+ try {
166
+ await fs.access(resolvedPath)
167
+
168
+ const parser = this.createParser(resolvedPath)
169
+ const parsable = await parser.isValidSyntax()
170
+ filePathData.parsable = parsable
171
+
172
+ if (parsable) {
173
+ const configData = await parser.parseConfigFile()
174
+ const servers = await this.convertToMCPServerInfo(configData.servers || {})
175
+ filePathData.servers = servers
176
+ totalServersCount += servers.length
177
+ }
178
+
179
+ mcpFilesPathsData[groupName].paths.push(filePathData)
180
+ } catch (error) {
181
+ // File does not exist or is not accessible, continue to next
182
+ this.debug(`Skipping file ${resolvedPath}: ${error instanceof Error ? error.message : 'Unknown error'}`)
183
+ }
184
+ }
185
+
186
+ if (mcpFilesPathsData[groupName] && mcpFilesPathsData[groupName].stats) {
187
+ mcpFilesPathsData[groupName].stats.serversCount = totalServersCount
188
+ }
189
+ }
190
+
191
+ return mcpFilesPathsData
192
+ } catch (error) {
193
+ throw new Error(`Failed to get MCP file groups: ${error instanceof Error ? error.message : 'Unknown error'}`)
194
+ }
195
+ }
196
+
197
+ /**
198
+ * Register a custom app with custom paths for the current OS
199
+ */
200
+ registerCustomApp (appName: string, paths: MCPFilePath[]): void {
201
+ try {
202
+ this.pathRegistry.registerCustomApp(this.currentOS, appName, paths)
203
+ } catch (error) {
204
+ throw new Error(`Failed to register custom app '${appName}': ${error instanceof Error ? error.message : 'Unknown error'}`)
205
+ }
206
+ }
207
+
208
+ /**
209
+ * Parse a configuration file and return server information
210
+ */
211
+ private async parseConfigFileForServers (filePath: string): Promise<MCPServerInfo[]> {
212
+ try {
213
+ const parser = this.createParser(filePath)
214
+ const configData = await parser.parseConfigFile()
215
+ return await this.convertToMCPServerInfo(configData.servers || {})
216
+ } catch (error) {
217
+ this.debug(`Failed to parse config file ${filePath}: ${error instanceof Error ? error.message : 'Unknown error'}`)
218
+ return []
219
+ }
220
+ }
221
+
222
+ /**
223
+ * Convert parsed server configs to MCPServerInfo format
224
+ */
225
+ private async convertToMCPServerInfo (servers: Record<string, any>): Promise<MCPServerInfo[]> {
226
+ const serverInfos: MCPServerInfo[] = []
227
+
228
+ for (const [serverName, serverConfig] of Object.entries(servers)) {
229
+ if (serverConfig && typeof serverConfig === 'object') {
230
+ serverInfos.push({
231
+ name: serverName,
232
+ command: serverConfig.command || '',
233
+ args: Array.isArray(serverConfig.args) ? serverConfig.args : undefined,
234
+ transport: serverConfig.type === 'streamable-http' ? 'http' : serverConfig.type, // Map streamable-http to http
235
+ type: serverConfig.type,
236
+ source: serverConfig.command || '',
237
+ env: serverConfig.env,
238
+ status: 'stopped', // Default status, will be updated by server manager
239
+ credentials: CredentialDetectionService.analyzeEnvironmentVariables(serverConfig.env)
240
+ })
241
+ }
242
+ }
243
+
244
+ return serverInfos
245
+ }
246
+
247
+ /**
248
+ * Get friendly name for an app
249
+ */
250
+ private getFriendlyName (appName: string): string {
251
+ const friendlyNames: Record<string, string> = {
252
+ claude: 'Claude Desktop',
253
+ claude_code: 'Claude Code',
254
+ cursor: 'Cursor',
255
+ vscode: 'VS Code',
256
+ cline: 'Cline',
257
+ windsurf: 'Windsurf',
258
+ roo: 'Roo',
259
+ 'intellij-github-copilot': 'IntelliJ GitHub Copilot',
260
+ junie: 'IntelliJ Junie',
261
+ zed: 'Zed',
262
+ gemini: 'Gemini CLI'
263
+ }
264
+
265
+ return friendlyNames[appName] || appName
266
+ }
267
+ }
@@ -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') {