ls-mcp 1.13.2 → 1.13.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/dist/bin/cli.cjs +22 -479
- package/dist/bin/cli.mjs +12 -469
- package/dist/main.cjs +22 -479
- package/dist/main.d.cts +3 -38
- package/dist/main.d.ts +3 -38
- package/dist/main.mjs +12 -469
- package/package.json +2 -1
- package/src/services/mcp-config-service.ts +6 -7
- package/src/types/mcp-config-service.types.ts +2 -20
- package/src/services/directory-bubble-service.ts +0 -82
- package/src/services/mcp-config-linter-service.ts +0 -34
- package/src/services/mcp-config-parser.ts +0 -234
- package/src/services/mcp-path-registry.ts +0 -213
|
@@ -1,20 +1,4 @@
|
|
|
1
|
-
|
|
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
|
-
url?: string
|
|
15
|
-
env?: Record<string, string>
|
|
16
|
-
headers?: Record<string, string>
|
|
17
|
-
}
|
|
1
|
+
import type { MCPFilePath as AgentFilePath } from 'agent-files'
|
|
18
2
|
|
|
19
3
|
export interface MCPAppMetadata {
|
|
20
4
|
name: string
|
|
@@ -22,9 +6,7 @@ export interface MCPAppMetadata {
|
|
|
22
6
|
paths: MCPFilePath[]
|
|
23
7
|
}
|
|
24
8
|
|
|
25
|
-
export interface MCPFilePath {
|
|
26
|
-
filePath: string
|
|
27
|
-
type: 'local' | 'global'
|
|
9
|
+
export interface MCPFilePath extends AgentFilePath {
|
|
28
10
|
parsable?: boolean
|
|
29
11
|
servers?: MCPServerInfo[]
|
|
30
12
|
}
|
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
import path from 'node:path'
|
|
2
|
-
import fs from 'node:fs/promises'
|
|
3
|
-
import { homedir } from 'node:os'
|
|
4
|
-
|
|
5
|
-
export class DirectoryBubbleService {
|
|
6
|
-
/**
|
|
7
|
-
* Find a local MCP config file by bubbling up the directory tree
|
|
8
|
-
* @param localPath - The relative path to search for (e.g., '.vscode/mcp.json')
|
|
9
|
-
* @param startDir - The directory to start searching from
|
|
10
|
-
* @returns The absolute path to the found config file, or null if not found
|
|
11
|
-
*/
|
|
12
|
-
async findLocalConfigInParentDirectories (
|
|
13
|
-
localPath: string,
|
|
14
|
-
startDir: string
|
|
15
|
-
): Promise<string | null> {
|
|
16
|
-
try {
|
|
17
|
-
let currentDir = path.resolve(startDir)
|
|
18
|
-
const homeDir = homedir()
|
|
19
|
-
const rootDir = '/'
|
|
20
|
-
let iterationCount = 0
|
|
21
|
-
const maxIterations = 100 // Safety limit to prevent infinite loops
|
|
22
|
-
|
|
23
|
-
// Check the start directory first
|
|
24
|
-
const startDirResult = await this.checkDirectoryForConfig(currentDir, localPath)
|
|
25
|
-
if (startDirResult) {
|
|
26
|
-
return path.join(currentDir, localPath)
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
// Bubble up directory tree until we reach home directory or root
|
|
30
|
-
while (currentDir !== homeDir && currentDir !== rootDir && iterationCount < maxIterations) {
|
|
31
|
-
const parentDir = this.getParentDirectory(currentDir)
|
|
32
|
-
if (!parentDir || parentDir === currentDir) {
|
|
33
|
-
break
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
// Additional safety check: ensure we're actually moving up the tree
|
|
37
|
-
if (parentDir === currentDir || parentDir.length >= currentDir.length) {
|
|
38
|
-
break
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
currentDir = parentDir
|
|
42
|
-
iterationCount++
|
|
43
|
-
|
|
44
|
-
const found = await this.checkDirectoryForConfig(currentDir, localPath)
|
|
45
|
-
if (found) {
|
|
46
|
-
return path.join(currentDir, localPath)
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
return null
|
|
51
|
-
} catch (error) {
|
|
52
|
-
// Silently catch errors as per requirements
|
|
53
|
-
return null
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
/**
|
|
58
|
-
* Check if a config file exists in the specified directory
|
|
59
|
-
* @param dir - The directory to check
|
|
60
|
-
* @param configPath - The relative path to the config file
|
|
61
|
-
* @returns True if the config file exists and is accessible
|
|
62
|
-
*/
|
|
63
|
-
private async checkDirectoryForConfig (dir: string, configPath: string): Promise<boolean> {
|
|
64
|
-
try {
|
|
65
|
-
const fullPath = path.join(dir, configPath)
|
|
66
|
-
await fs.access(fullPath)
|
|
67
|
-
return true
|
|
68
|
-
} catch (error) {
|
|
69
|
-
return false
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
/**
|
|
74
|
-
* Get the parent directory of the specified directory
|
|
75
|
-
* @param dir - The directory to get the parent of
|
|
76
|
-
* @returns The parent directory path, or null if already at root
|
|
77
|
-
*/
|
|
78
|
-
private getParentDirectory (dir: string): string | null {
|
|
79
|
-
const parent = path.dirname(dir)
|
|
80
|
-
return parent === dir ? null : parent
|
|
81
|
-
}
|
|
82
|
-
}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { MCPConfigParser } from './mcp-config-parser.js'
|
|
2
|
-
|
|
3
|
-
export class MCPConfigLinterService {
|
|
4
|
-
private parser: MCPConfigParser
|
|
5
|
-
|
|
6
|
-
constructor (filePath: string) {
|
|
7
|
-
this.parser = new MCPConfigParser(filePath)
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
async parseFile (): Promise<void> {
|
|
11
|
-
// This method is kept for backward compatibility but now delegates to the parser
|
|
12
|
-
await this.parser.parseConfigFile()
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
async isValidSyntax (): Promise<boolean> {
|
|
16
|
-
return await this.parser.isValidSyntax()
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
async countMCPServers (): Promise<number> {
|
|
20
|
-
return await this.parser.countMCPServers()
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
async getMCPServers (): Promise<Record<string, object>> {
|
|
24
|
-
const configData = await this.parser.parseConfigFile()
|
|
25
|
-
return configData.servers
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
async getFileContent (): Promise<string> {
|
|
29
|
-
// This method is kept for backward compatibility but the parser handles file reading internally
|
|
30
|
-
// We'll need to access the parser's internal file content
|
|
31
|
-
const configData = await this.parser.parseConfigFile()
|
|
32
|
-
return JSON.stringify(configData.raw, null, 2)
|
|
33
|
-
}
|
|
34
|
-
}
|
|
@@ -1,234 +0,0 @@
|
|
|
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
|
-
url: serverConfig.url,
|
|
115
|
-
env
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
return normalized
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
/**
|
|
124
|
-
* Validate type value
|
|
125
|
-
*/
|
|
126
|
-
private validateType (type: any): type is 'sse' | 'http' | 'stdio' | 'streamable-http' {
|
|
127
|
-
return ['sse', 'http', 'stdio', 'streamable-http'].includes(type)
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
/**
|
|
131
|
-
* Infer transport type from server configuration when type field is not explicitly set
|
|
132
|
-
*/
|
|
133
|
-
private inferTransportType (serverConfig: any): 'sse' | 'http' | 'stdio' | undefined {
|
|
134
|
-
// Rule 1: If URL is present, infer HTTP transport
|
|
135
|
-
if (serverConfig.url && typeof serverConfig.url === 'string') {
|
|
136
|
-
return 'http'
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
// Rule 2-4: Search through args array for transport indicators
|
|
140
|
-
if (Array.isArray(serverConfig.args)) {
|
|
141
|
-
const argsString = serverConfig.args.join(' ').toLowerCase()
|
|
142
|
-
|
|
143
|
-
// Check for stdio indicators
|
|
144
|
-
if (argsString.includes('stdio')) {
|
|
145
|
-
return 'stdio'
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
// Check for HTTP indicators
|
|
149
|
-
if (argsString.includes('http')) {
|
|
150
|
-
return 'http'
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
// Check for SSE indicators
|
|
154
|
-
if (argsString.includes('sse')) {
|
|
155
|
-
return 'sse'
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
// Rule 5: Default to stdio if command is present but no other indicators found
|
|
160
|
-
// This is a reasonable default since most MCP servers use stdio transport
|
|
161
|
-
if (serverConfig.command && typeof serverConfig.command === 'string') {
|
|
162
|
-
return 'stdio'
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
// No transport type could be inferred
|
|
166
|
-
return undefined
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
/**
|
|
170
|
-
* Validate server configuration
|
|
171
|
-
*/
|
|
172
|
-
validateServerConfig (serverConfig: MCPServerConfig): boolean {
|
|
173
|
-
if (!serverConfig || typeof serverConfig !== 'object') {
|
|
174
|
-
return false
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
if (!serverConfig.name || typeof serverConfig.name !== 'string') {
|
|
178
|
-
return false
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
if (!serverConfig.command || typeof serverConfig.command !== 'string') {
|
|
182
|
-
return false
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
return true
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
/**
|
|
189
|
-
* Get supported configuration keys that the parser recognizes
|
|
190
|
-
*/
|
|
191
|
-
getSupportedConfigKeys (): string[] {
|
|
192
|
-
return ['servers', 'mcp.servers', 'mcpServers', 'context_servers']
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
/**
|
|
196
|
-
* Check if the configuration file has valid syntax
|
|
197
|
-
*/
|
|
198
|
-
async isValidSyntax (): Promise<boolean> {
|
|
199
|
-
try {
|
|
200
|
-
const configData = await this.parseConfigFile()
|
|
201
|
-
return configData.valid
|
|
202
|
-
} catch (error) {
|
|
203
|
-
return false
|
|
204
|
-
}
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
/**
|
|
208
|
-
* Count the number of MCP servers in the configuration
|
|
209
|
-
*/
|
|
210
|
-
async countMCPServers (): Promise<number> {
|
|
211
|
-
try {
|
|
212
|
-
const configData = await this.parseConfigFile()
|
|
213
|
-
return Object.keys(configData.servers).length
|
|
214
|
-
} catch (error) {
|
|
215
|
-
return 0
|
|
216
|
-
}
|
|
217
|
-
}
|
|
218
|
-
|
|
219
|
-
/**
|
|
220
|
-
* Get the raw file content
|
|
221
|
-
*/
|
|
222
|
-
private async getFileContent (): Promise<string> {
|
|
223
|
-
if (this.fileContents) {
|
|
224
|
-
return this.fileContents
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
try {
|
|
228
|
-
this.fileContents = await fs.readFile(this.filePath, 'utf-8')
|
|
229
|
-
return this.fileContents
|
|
230
|
-
} catch (error) {
|
|
231
|
-
throw new Error(`Failed to read file: ${this.filePath}`)
|
|
232
|
-
}
|
|
233
|
-
}
|
|
234
|
-
}
|
|
@@ -1,213 +0,0 @@
|
|
|
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 static readonly LINUX_PATHS: MCPAppPathsRecord = {
|
|
97
|
-
claude: [
|
|
98
|
-
{ filePath: path.join(process.env.HOME || '', '.config', 'Claude', 'claude_desktop_config.json'), type: 'global' }
|
|
99
|
-
],
|
|
100
|
-
claude_code: [
|
|
101
|
-
{ filePath: '.mcp.json', type: 'local' }
|
|
102
|
-
],
|
|
103
|
-
cursor: [
|
|
104
|
-
{ filePath: path.join(process.env.HOME || '', '.cursor', 'mcp.json'), type: 'global' },
|
|
105
|
-
{ filePath: path.join('.cursor', 'mcp.json'), type: 'local' }
|
|
106
|
-
],
|
|
107
|
-
vscode: [
|
|
108
|
-
{ filePath: path.join('.vscode', 'mcp.json'), type: 'local' },
|
|
109
|
-
{ filePath: path.join(process.env.HOME || '', '.config', 'Code', 'User', 'settings.json'), type: 'global' },
|
|
110
|
-
{ filePath: path.join(process.env.HOME || '', '.config', 'Code - Insiders', 'User', 'settings.json'), type: 'global' },
|
|
111
|
-
{ filePath: path.join(process.env.HOME || '', '.config', 'Code', 'User', 'mcp.json'), type: 'global' },
|
|
112
|
-
{ filePath: path.join(process.env.HOME || '', '.config', 'Code - Insiders', 'User', 'mcp.json'), type: 'global' },
|
|
113
|
-
{ filePath: path.join(process.env.HOME || '', '.mcp.json'), type: 'global' }
|
|
114
|
-
],
|
|
115
|
-
cline: [
|
|
116
|
-
{ filePath: path.join(process.env.HOME || '', '.config', 'Code', 'User', 'globalStorage', 'saoudrizwan.claude-dev', 'settings', 'cline_mcp_settings.json'), type: 'global' },
|
|
117
|
-
{ filePath: path.join(process.env.HOME || '', '.config', 'Code - Insiders', 'User', 'globalStorage', 'saoudrizwan.claude-dev', 'settings', 'cline_mcp_settings.json'), type: 'global' }
|
|
118
|
-
],
|
|
119
|
-
windsurf: [
|
|
120
|
-
{ filePath: path.join('.codeium', 'windsurf', 'mcp_config.json'), type: 'local' }
|
|
121
|
-
],
|
|
122
|
-
roo: [
|
|
123
|
-
{ filePath: path.join(process.env.HOME || '', '.config', 'Code', 'User', 'globalStorage', 'rooveterinaryinc.roo-cline', 'settings', 'cline_mcp_settings.json'), type: 'global' },
|
|
124
|
-
{ filePath: path.join(process.env.HOME || '', '.config', 'Code - Insiders', 'User', 'globalStorage', 'rooveterinaryinc.roo-cline', 'settings', 'cline_mcp_settings.json'), type: 'global' }
|
|
125
|
-
],
|
|
126
|
-
'intellij-github-copilot': [
|
|
127
|
-
{ filePath: path.join(process.env.HOME || '', '.config', 'github-copilot', 'intellij', 'mcp.json'), type: 'global' }
|
|
128
|
-
],
|
|
129
|
-
junie: [
|
|
130
|
-
{ filePath: path.join(process.env.HOME || '', '.junie', 'mcp.json'), type: 'global' },
|
|
131
|
-
{ filePath: path.join('.junie', 'mcp', 'mcp.json'), type: 'local' }
|
|
132
|
-
],
|
|
133
|
-
zed: [
|
|
134
|
-
{ filePath: path.join(process.env.HOME || '', '.config', 'zed', 'settings.json'), type: 'global' },
|
|
135
|
-
{ filePath: path.join('.zed', 'settings.json'), type: 'local' }
|
|
136
|
-
],
|
|
137
|
-
gemini: [
|
|
138
|
-
{ filePath: path.join(process.env.HOME || '', '.gemini', 'settings.json'), type: 'global' },
|
|
139
|
-
{ filePath: path.join('.gemini', 'settings.json'), type: 'local' }
|
|
140
|
-
]
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
private customApps: Map<string, MCPAppPathsRecord> = new Map()
|
|
144
|
-
|
|
145
|
-
/**
|
|
146
|
-
* Get all MCP configuration file paths for a specific operating system
|
|
147
|
-
*/
|
|
148
|
-
getPathsForOS (os: string): MCPAppPathsRecord {
|
|
149
|
-
switch (os.toLowerCase()) {
|
|
150
|
-
case 'win32':
|
|
151
|
-
case 'windows':
|
|
152
|
-
return { ...MCPPathRegistry.WINDOWS_PATHS }
|
|
153
|
-
case 'darwin':
|
|
154
|
-
case 'macos':
|
|
155
|
-
return { ...MCPPathRegistry.DARWIN_PATHS }
|
|
156
|
-
case 'linux':
|
|
157
|
-
return { ...MCPPathRegistry.LINUX_PATHS }
|
|
158
|
-
default:
|
|
159
|
-
throw new Error(`Unsupported operating system: ${os}`)
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
/**
|
|
164
|
-
* Get MCP configuration file paths for a specific app on a specific OS
|
|
165
|
-
*/
|
|
166
|
-
getPathsForApp (os: string, appName: string): MCPFilePath[] {
|
|
167
|
-
const osPaths = this.getPathsForOS(os)
|
|
168
|
-
const appPaths = osPaths[appName]
|
|
169
|
-
|
|
170
|
-
if (!appPaths) {
|
|
171
|
-
throw new Error(`App '${appName}' not found for OS '${os}'`)
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
return [...appPaths]
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
/**
|
|
178
|
-
* Get all supported app names for a specific OS
|
|
179
|
-
*/
|
|
180
|
-
getSupportedApps (os: string): string[] {
|
|
181
|
-
const osPaths = this.getPathsForOS(os)
|
|
182
|
-
return Object.keys(osPaths)
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
/**
|
|
186
|
-
* Get all supported operating systems
|
|
187
|
-
*/
|
|
188
|
-
getSupportedOperatingSystems (): string[] {
|
|
189
|
-
return ['win32', 'darwin', 'linux']
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
/**
|
|
193
|
-
* Register a custom app with custom paths for a specific OS
|
|
194
|
-
*/
|
|
195
|
-
registerCustomApp (os: string, appName: string, paths: MCPFilePath[]): void {
|
|
196
|
-
if (!this.customApps.has(os)) {
|
|
197
|
-
this.customApps.set(os, {})
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
const osCustomApps = this.customApps.get(os)!
|
|
201
|
-
osCustomApps[appName] = [...paths]
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
/**
|
|
205
|
-
* Get paths including custom registered apps
|
|
206
|
-
*/
|
|
207
|
-
getPathsForOSWithCustom (os: string): MCPAppPathsRecord {
|
|
208
|
-
const basePaths = this.getPathsForOS(os)
|
|
209
|
-
const customPaths = this.customApps.get(os) || {}
|
|
210
|
-
|
|
211
|
-
return { ...basePaths, ...customPaths }
|
|
212
|
-
}
|
|
213
|
-
}
|