Repository navigation
How do I remove an MCP server from Claude Code, Codex, Cursor or Gemini CLI without breaking the config? #6
Unanswered
nemesisLLC
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Short answer: use the agent's own command where there is one, because then the agent edits its own file.
Use the name exactly as
... mcp listshows it. In Claude Code, add--scope projector--scope userif the same name exists in more than one place.Agents without a remove command
~/.cursor/mcp.json(or.cursor/mcp.jsonin a project), or switch it off in Cursor's MCP settings.claude_desktop_config.json(Settings → Developer → Edit Config) and restart the app.When you edit JSON by hand, check the comma on the line before the entry you removed. A trailing comma makes the whole file invalid, and some agents then load none of your servers.
Check for copies
A server can be defined twice: your user config and a project's
.mcp.json, for example. Claude Code and GitHub Copilot both read a project's.mcp.json, so removing it from one user config can leave it active in a project. Search the project for the server name before you assume it's gone.Remove, or switch off?
Switch it off if you might want it back: it stops loading (and stops costing tokens on every request) but keeps its settings and key. Codex has
enabled = false; Cursor has a switch in settings.Full guide: https://calyban.com/blog/remove-mcp-server-claude-code-codex-cursor
All reactions