Same as `readMcpServers` but takes a pre-parsed object.
( obj: Record<string, unknown>, )
| 230 | |
| 231 | /** Same as `readMcpServers` but takes a pre-parsed object. */ |
| 232 | function readMcpServersFromObject( |
| 233 | obj: Record<string, unknown>, |
| 234 | ): Record<string, McpServerConfig> { |
| 235 | const block = obj.mcpServers; |
| 236 | if (!isPlainObject(block)) return {}; |
| 237 | const out: Record<string, McpServerConfig> = {}; |
| 238 | for (const [name, raw] of Object.entries(block)) { |
| 239 | if (!/^[A-Za-z0-9_-]+$/.test(name)) continue; |
| 240 | const config = normalizeExternalServer(raw); |
| 241 | if (config) out[name] = config; |
| 242 | } |
| 243 | return out; |
| 244 | } |
| 245 | |
| 246 | /** Discover every available migration source on the current machine. */ |
| 247 | export function discoverSources(): MigrationSource[] { |
no test coverage detected