(filePath: string)
| 139 | } |
| 140 | |
| 141 | async function readJsonConfig(filePath: string): Promise<JsonMcpConfig> { |
| 142 | try { |
| 143 | const raw = await fsp.readFile(filePath, 'utf8') |
| 144 | const parsed = JSON.parse(raw) as unknown |
| 145 | if (parsed && typeof parsed === 'object' && !Array.isArray(parsed)) { |
| 146 | return parsed as JsonMcpConfig |
| 147 | } |
| 148 | return {} |
| 149 | } catch (err) { |
| 150 | if ((err as NodeJS.ErrnoException).code === 'ENOENT') return {} |
| 151 | throw err |
| 152 | } |
| 153 | } |
| 154 | |
| 155 | async function writeJsonConfig(filePath: string, data: JsonMcpConfig): Promise<void> { |
| 156 | await fsp.mkdir(path.dirname(filePath), { recursive: true }) |
no outgoing calls
no test coverage detected