(cwd: string, name: string, scope: McpScope)
| 254 | /** Remove a server from the given scope's config file. Returns true if it |
| 255 | * existed and was removed, false if it wasn't found. */ |
| 256 | export function removeMcpServer(cwd: string, name: string, scope: McpScope): boolean { |
| 257 | if (scope === "project") { |
| 258 | const existing = readProjectMcpJson(cwd) |
| 259 | if (!(name in existing)) return false |
| 260 | delete existing[name] |
| 261 | writeProjectMcpJson(cwd, existing) |
| 262 | return true |
| 263 | } |
| 264 | const filePath = settingsPathForScope(cwd, scope) |
| 265 | const settings = readFullSettings(filePath) |
| 266 | const servers = normalizeServers(settings.mcpServers) |
| 267 | if (!(name in servers)) return false |
| 268 | delete servers[name] |
| 269 | settings.mcpServers = servers |
| 270 | writeFullSettings(filePath, settings) |
| 271 | return true |
| 272 | } |
| 273 | |
| 274 | /** Find which scope a server name lives in (highest-precedence scope wins). |
| 275 | * Returns undefined if the name isn't configured anywhere. */ |
no test coverage detected