ls-mcp 1.9.1 → 1.11.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.
- package/README.md +29 -3
- package/dist/bin/cli.cjs +952 -289
- package/dist/bin/cli.mjs +935 -272
- package/dist/main.cjs +814 -263
- package/dist/main.d.cts +82 -14
- package/dist/main.d.ts +82 -14
- package/dist/main.mjs +814 -265
- package/package.json +3 -1
- package/src/bin/cli.ts +37 -5
- package/src/components/credential-warning.ts +37 -0
- package/src/components/summary.ts +57 -0
- package/src/main.ts +50 -140
- package/src/services/credential-detection-service.ts +166 -0
- package/src/services/directory-bubble-service.ts +82 -0
- package/src/services/mcp-config-linter-service.ts +13 -74
- package/src/services/mcp-config-parser.ts +234 -0
- package/src/services/mcp-config-service.ts +304 -0
- package/src/services/mcp-path-registry.ts +164 -0
- package/src/services/mcp-server-manager-service.ts +5 -4
- package/src/services/render-service.ts +46 -2
- package/src/types/mcp-config-service.types.ts +76 -0
- package/src/types.ts +1 -1
- package/src/utils/url-utils.ts +24 -0
- package/src/utils/os-paths.ts +0 -102
|
@@ -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
|
+
}
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import path from 'node:path'
|
|
2
2
|
import { execSync } from 'node:child_process'
|
|
3
3
|
import { platform } from 'node:os'
|
|
4
|
+
import { extractHostname } from '../utils/url-utils.js'
|
|
4
5
|
|
|
5
6
|
interface MCPServerConfig {
|
|
6
7
|
name: string
|
|
7
8
|
command: string
|
|
8
9
|
args?: string[]
|
|
9
|
-
transport?: 'stdio' | 'sse'
|
|
10
|
+
transport?: 'stdio' | 'sse' | 'http'
|
|
10
11
|
url?: string
|
|
11
|
-
type?: 'sse' | 'http' | 'stdio'
|
|
12
|
+
type?: 'sse' | 'http' | 'stdio' | 'streamable-http'
|
|
12
13
|
env?: Record<string, string>
|
|
13
14
|
}
|
|
14
15
|
|
|
@@ -38,7 +39,7 @@ export class MCPServerManagerService {
|
|
|
38
39
|
if (serverConfig?.type && serverConfig.type === 'sse') {
|
|
39
40
|
this.transport = 'sse'
|
|
40
41
|
}
|
|
41
|
-
if (serverConfig?.type && serverConfig.type === 'http') {
|
|
42
|
+
if (serverConfig?.type && (serverConfig.type === 'http' || serverConfig.type === 'streamable-http')) {
|
|
42
43
|
this.transport = 'http'
|
|
43
44
|
}
|
|
44
45
|
if (serverConfig?.type && serverConfig.type === 'stdio') {
|
|
@@ -46,7 +47,7 @@ export class MCPServerManagerService {
|
|
|
46
47
|
}
|
|
47
48
|
|
|
48
49
|
if (serverConfig.url) {
|
|
49
|
-
this.source = serverConfig.url
|
|
50
|
+
this.source = extractHostname(serverConfig.url)
|
|
50
51
|
this.transport = 'http' // URLs always use http transport
|
|
51
52
|
} else {
|
|
52
53
|
// Build the full command with arguments
|
|
@@ -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,76 @@
|
|
|
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
|
+
url?: string
|
|
15
|
+
env?: Record<string, string>
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export interface MCPAppMetadata {
|
|
19
|
+
name: string
|
|
20
|
+
friendlyName: string
|
|
21
|
+
paths: MCPFilePath[]
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export interface MCPFilePath {
|
|
25
|
+
filePath: string
|
|
26
|
+
type: 'local' | 'global'
|
|
27
|
+
parsable?: boolean
|
|
28
|
+
servers?: MCPServerInfo[]
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export interface MCPServerInfo {
|
|
32
|
+
name: string
|
|
33
|
+
command: string
|
|
34
|
+
args?: string[]
|
|
35
|
+
transport?: 'stdio' | 'sse' | 'http'
|
|
36
|
+
type?: 'sse' | 'http' | 'stdio' | 'streamable-http'
|
|
37
|
+
source?: string
|
|
38
|
+
env?: Record<string, string>
|
|
39
|
+
status?: 'running' | 'stopped'
|
|
40
|
+
credentials?: CredentialAnalysisResult
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export interface MCPFileGroups {
|
|
44
|
+
name: string
|
|
45
|
+
friendlyName: string
|
|
46
|
+
paths: MCPFilePath[]
|
|
47
|
+
stats?: {
|
|
48
|
+
serversCount?: number
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export interface MCPFileGroupsResult {
|
|
53
|
+
name: string
|
|
54
|
+
friendlyName: string
|
|
55
|
+
paths: MCPFilePath[]
|
|
56
|
+
stats: {
|
|
57
|
+
serversCount?: number
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export type MCPFilePathGroupsRecord = Record<string, MCPFileGroups>
|
|
62
|
+
export type MCPFileGroupsResultRecord = Record<string, MCPFileGroups>
|
|
63
|
+
export type MCPAppPathsRecord = Record<string, MCPFilePath[]>
|
|
64
|
+
|
|
65
|
+
// Credential detection types
|
|
66
|
+
export interface CredentialVariable {
|
|
67
|
+
name: string
|
|
68
|
+
value: string
|
|
69
|
+
riskLevel: 'low' | 'high'
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
export interface CredentialAnalysisResult {
|
|
73
|
+
hasCredentials: boolean
|
|
74
|
+
credentialVars: CredentialVariable[]
|
|
75
|
+
riskLevel: 'none' | 'low' | 'high'
|
|
76
|
+
}
|
package/src/types.ts
CHANGED
|
@@ -3,7 +3,7 @@ export interface MCPServerInfo {
|
|
|
3
3
|
command: string
|
|
4
4
|
args?: string[]
|
|
5
5
|
transport?: 'stdio' | 'sse' | 'http',
|
|
6
|
-
type?: 'sse' | 'http' | 'stdio'
|
|
6
|
+
type?: 'sse' | 'http' | 'stdio' | 'streamable-http'
|
|
7
7
|
source?: string
|
|
8
8
|
env?: Record<string, string>
|
|
9
9
|
status?: 'running' | 'stopped'
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Utility functions for URL operations
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Extract hostname from a URL string
|
|
7
|
+
* @param urlString - The URL string to extract hostname from
|
|
8
|
+
* @returns The hostname if valid URL, or the original string if parsing fails
|
|
9
|
+
*/
|
|
10
|
+
export function extractHostname (urlString: string): string {
|
|
11
|
+
try {
|
|
12
|
+
// Handle URLs without protocol by adding a default one
|
|
13
|
+
let urlToParse = urlString
|
|
14
|
+
if (!urlToParse.includes('://')) {
|
|
15
|
+
urlToParse = `http://${urlToParse}`
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
const url = new URL(urlToParse)
|
|
19
|
+
return url.hostname
|
|
20
|
+
} catch (error) {
|
|
21
|
+
// If URL parsing fails, return the original string
|
|
22
|
+
return urlString
|
|
23
|
+
}
|
|
24
|
+
}
|
package/src/utils/os-paths.ts
DELETED
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
import path from 'node:path'
|
|
2
|
-
import { type MCPFilePath } from '../types.ts'
|
|
3
|
-
|
|
4
|
-
const appData = process.env.APPDATA || ''
|
|
5
|
-
const localAppData = process.env.LOCALAPPDATA || ''
|
|
6
|
-
const homeDir = process.env.HOME || ''
|
|
7
|
-
|
|
8
|
-
export function getWindowsPaths (): Record<string, MCPFilePath[]> {
|
|
9
|
-
return {
|
|
10
|
-
claude: [
|
|
11
|
-
{ filePath: path.join(appData, 'Claude', 'claude_desktop_config.json'), type: 'global' }
|
|
12
|
-
],
|
|
13
|
-
claude_code: [
|
|
14
|
-
{ filePath: '.mcp.json', type: 'local' }
|
|
15
|
-
],
|
|
16
|
-
cursor: [
|
|
17
|
-
{ filePath: path.join(homeDir, '.cursor', 'mcp.json'), type: 'global' },
|
|
18
|
-
{ filePath: path.join('.cursor', 'mcp.json'), type: 'local' }
|
|
19
|
-
],
|
|
20
|
-
vscode: [
|
|
21
|
-
{ filePath: path.join('.vscode', 'mcp.json'), type: 'local' },
|
|
22
|
-
{ filePath: path.join(appData, 'Code', 'User', 'settings.json'), type: 'global' },
|
|
23
|
-
{ filePath: path.join(appData, 'Code - Insiders', 'User', 'settings.json'), type: 'global' },
|
|
24
|
-
{ filePath: path.join(appData, 'Code', 'User', 'mcp.json'), type: 'global' },
|
|
25
|
-
{ filePath: path.join(appData, 'Code - Insiders', 'User', 'mcp.json'), type: 'global' }
|
|
26
|
-
],
|
|
27
|
-
cline: [
|
|
28
|
-
{ filePath: path.join(appData, 'Code', 'User', 'globalStorage', 'saoudrizwan.claude-dev', 'settings', 'cline_mcp_settings.json'), type: 'global' },
|
|
29
|
-
{ filePath: path.join(appData, 'Code - Insiders', 'User', 'globalStorage', 'saoudrizwan.claude-dev', 'settings', 'cline_mcp_settings.json'), type: 'global' }
|
|
30
|
-
],
|
|
31
|
-
windsurf: [
|
|
32
|
-
{ filePath: path.join('.codeium', 'windsurf', 'mcp_config.json'), type: 'local' },
|
|
33
|
-
],
|
|
34
|
-
roo: [
|
|
35
|
-
{ filePath: path.join(appData, 'Code', 'User', 'globalStorage', 'rooveterinaryinc.roo-cline', 'settings', 'cline_mcp_settings.json'), type: 'global' },
|
|
36
|
-
{ filePath: path.join(appData, 'Code - Insiders', 'User', 'globalStorage', 'rooveterinaryinc.roo-cline', 'settings', 'cline_mcp_settings.json'), type: 'global' },
|
|
37
|
-
],
|
|
38
|
-
'intellij-github-copilot': [
|
|
39
|
-
{ filePath: path.join(localAppData, 'github-copilot', 'intellij', 'mcp.json'), type: 'global' },
|
|
40
|
-
],
|
|
41
|
-
junie: [
|
|
42
|
-
{ filePath: path.join(homeDir, '.junie', 'mcp', 'mcp.json'), type: 'global' },
|
|
43
|
-
],
|
|
44
|
-
zed: [
|
|
45
|
-
{ filePath: path.join(localAppData, 'zed', 'settings.json'), type: 'global' },
|
|
46
|
-
{ filePath: path.join('.zed', 'settings.json'), type: 'local' }
|
|
47
|
-
],
|
|
48
|
-
gemini: [
|
|
49
|
-
{ filePath: path.join(homeDir, '.gemini', 'settings.json'), type: 'global' },
|
|
50
|
-
{ filePath: path.join('.gemini', 'settings.json'), type: 'local' }
|
|
51
|
-
]
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
export function getDarwinPaths (): Record<string, MCPFilePath[]> {
|
|
56
|
-
return {
|
|
57
|
-
claude: [
|
|
58
|
-
{ filePath: path.join(homeDir, 'Library', 'Application Support', 'Claude', 'claude_desktop_config.json'), type: 'global' }
|
|
59
|
-
],
|
|
60
|
-
claude_code: [
|
|
61
|
-
{ filePath: '.mcp.json', type: 'local' }
|
|
62
|
-
],
|
|
63
|
-
cursor: [
|
|
64
|
-
{ filePath: path.join(homeDir, '.cursor', 'mcp.json'), type: 'global' },
|
|
65
|
-
{ filePath: path.join('.cursor', 'mcp.json'), type: 'local' }
|
|
66
|
-
],
|
|
67
|
-
vscode: [
|
|
68
|
-
{ filePath: path.join('.vscode', 'mcp.json'), type: 'local' },
|
|
69
|
-
{ filePath: path.join(homeDir, 'Library', 'Application Support', 'Code', 'User', 'settings.json'), type: 'global' },
|
|
70
|
-
{ filePath: path.join(homeDir, 'Library', 'Application Support', 'Code', 'User', 'mcp.json'), type: 'global' },
|
|
71
|
-
{ filePath: path.join(homeDir, 'Library', 'Application Support', 'Code - Insiders', 'User', 'settings.json'), type: 'global' },
|
|
72
|
-
{ filePath: path.join(homeDir, 'Library', 'Application Support', 'Code - Insiders', 'User', 'mcp.json'), type: 'global' }
|
|
73
|
-
],
|
|
74
|
-
cline: [
|
|
75
|
-
{ filePath: path.join(homeDir, 'Library', 'Application Support', 'Code', 'User', 'globalStorage', 'saoudrizwan.claude-dev', 'settings', 'cline_mcp_settings.json'), type: 'global' },
|
|
76
|
-
{ filePath: path.join(homeDir, 'Library', 'Application Support', 'Code - Insiders', 'User', 'globalStorage', 'saoudrizwan.claude-dev', 'settings', 'cline_mcp_settings.json'), type: 'global' }
|
|
77
|
-
],
|
|
78
|
-
windsurf: [
|
|
79
|
-
{ filePath: path.join('.codeium', 'windsurf', 'mcp_config.json'), type: 'local' },
|
|
80
|
-
],
|
|
81
|
-
roo: [
|
|
82
|
-
{ filePath: path.join(homeDir, 'Library', 'Application Support', 'Code', 'User', 'globalStorage', 'rooveterinaryinc.roo-cline', 'settings', 'cline_mcp_settings.json'), type: 'global' },
|
|
83
|
-
{ filePath: path.join(homeDir, 'Library', 'Application Support', 'Code - Insiders', 'User', 'globalStorage', 'rooveterinaryinc.roo-cline', 'settings', 'cline_mcp_settings.json'), type: 'global' },
|
|
84
|
-
],
|
|
85
|
-
'intellij-github-copilot': [
|
|
86
|
-
{ filePath: path.join(homeDir, '.config', 'github-copilot', 'intellij', 'mcp.json'), type: 'global' },
|
|
87
|
-
],
|
|
88
|
-
junie: [
|
|
89
|
-
{ filePath: path.join(homeDir, '.junie', 'mcp', 'mcp.json'), type: 'global' },
|
|
90
|
-
{ filePath: path.join('.junie', 'mcp', 'mcp.json'), type: 'local' }
|
|
91
|
-
],
|
|
92
|
-
|
|
93
|
-
zed: [
|
|
94
|
-
{ filePath: path.join(homeDir, '.config', 'zed', 'settings.json'), type: 'global' },
|
|
95
|
-
{ filePath: path.join('.zed', 'settings.json'), type: 'local' }
|
|
96
|
-
],
|
|
97
|
-
gemini: [
|
|
98
|
-
{ filePath: path.join(homeDir, '.gemini', 'settings.json'), type: 'global' },
|
|
99
|
-
{ filePath: path.join('.gemini', 'settings.json'), type: 'local' }
|
|
100
|
-
]
|
|
101
|
-
}
|
|
102
|
-
}
|