MCPcopy Create free account
hub / github.com/MatterAIOrg/OrbCode / removeMcpServer

Function removeMcpServer

src/mcp/config.ts:256–272  ·  view source on GitHub ↗
(cwd: string, name: string, scope: McpScope)

Source from the content-addressed store, hash-verified

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. */
256export 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. */

Callers 1

removeMcpServerAnyScopeFunction · 0.85

Calls 6

readProjectMcpJsonFunction · 0.85
writeProjectMcpJsonFunction · 0.85
settingsPathForScopeFunction · 0.85
readFullSettingsFunction · 0.85
normalizeServersFunction · 0.85
writeFullSettingsFunction · 0.85

Tested by

no test coverage detected