()
| 1821 | // Nested: needs closure access to sdkMcpConfigs, applyMcpServerChanges, |
| 1822 | // updateSdkMcp. |
| 1823 | async function applyPluginMcpDiff(): Promise<void> { |
| 1824 | const { servers: newConfigs } = await getAllMcpConfigs() |
| 1825 | const supportedConfigs: Record<string, McpServerConfigForProcessTransport> = |
| 1826 | {} |
| 1827 | for (const [name, config] of Object.entries(newConfigs)) { |
| 1828 | const type = config.type |
| 1829 | if ( |
| 1830 | type === undefined || |
| 1831 | type === 'stdio' || |
| 1832 | type === 'sse' || |
| 1833 | type === 'http' || |
| 1834 | type === 'sdk' |
| 1835 | ) { |
| 1836 | supportedConfigs[name] = config |
| 1837 | } |
| 1838 | } |
| 1839 | for (const [name, config] of Object.entries(sdkMcpConfigs)) { |
| 1840 | if (config.type === 'sdk' && !(name in supportedConfigs)) { |
| 1841 | supportedConfigs[name] = config |
| 1842 | } |
| 1843 | } |
| 1844 | const { response, sdkServersChanged } = |
| 1845 | await applyMcpServerChanges(supportedConfigs) |
| 1846 | if (sdkServersChanged) { |
| 1847 | void updateSdkMcp() |
| 1848 | } |
| 1849 | logForDebugging( |
| 1850 | `Headless MCP refresh: added=${response.added.length}, removed=${response.removed.length}`, |
| 1851 | ) |
| 1852 | } |
| 1853 | |
| 1854 | // Subscribe to skill changes for hot reloading |
| 1855 | const unsubscribeSkillChanges = skillChangeDetector.subscribe(() => { |
no test coverage detected