Skip to content
Guide

How to disable an MCP server in Claude Code

There is no disable command. As of Claude Code 2.1, `claude mcp` can add, list, get, remove, log in and log out of a server, and that is all. Turning one off without losing it means editing configuration by hand. For a server defined in a project .mcp.json, add its name to disabledMcpjsonServers in settings.json and it stops loading while the entry stays where it is. For one session only, start Claude with --strict-mcp-config. Deleting works too, but you lose the command, the arguments and the environment variables with it.

Where MCP configuration actually lives

Two files, and knowing which one holds a server decides how you switch it off. A server added with --scope project goes into a file in the repository; local and user scope both go into a single file in your home directory.

.mcp.json
Project scope, in the repository root. Meant to be committed and shared, so everyone on the team gets the same servers. Claude asks for approval before connecting to one it has not seen.
~/.claude.json
User scope (every project on the machine) and local scope (this project only, not shared). Both live in this one file.
.claude/settings.json
Not where servers are defined, but where you say which of the .mcp.json ones are allowed to load.

What the claude mcp command does and does not do

claude mcp list                 # every configured server, health-checked
claude mcp get <name>           # one server: transport, command, scope, status
claude mcp add <name> ...       # --scope local | user | project
claude mcp add-json <name> ...  # the same, from a JSON string
claude mcp remove <name>        # deletes the entry
claude mcp login <name>         # OAuth for HTTP and SSE servers
claude mcp logout <name>        # clears the stored credentials
The full set of subcommands, as of Claude Code 2.1.

No enable, no disable, no toggle. That is the whole reason issues #4879 and #30595 exist on anthropics/claude-code, and why #30138 asks for a way to remove servers and plugins without editing files. Until one of them ships, remove is the only subcommand that stops a server loading, and it takes the configuration with it.

Turning one off and keeping the config

For servers defined in a project .mcp.json, settings.json decides which ones load. The name in the list is the key from the mcpServers object, spelled exactly.

{
  "disabledMcpjsonServers": ["playwright", "sentry"],
  "enabledMcpjsonServers": ["postgres"],
  "enableAllProjectMcpServers": false
}
.claude/settings.json: the server stays in .mcp.json, it just stops loading.

For a single session, skip the files entirely: --strict-mcp-config tells Claude to use only the servers passed with --mcp-config and ignore every other MCP configuration. Nothing on disk changes, and the next run without the flag is back to normal.

claude --mcp-config ./only-this.json --strict-mcp-config

claude --strict-mcp-config          # no MCP servers at all, this session
  • A server in ~/.claude.json under user or local scope is not covered by disabledMcpjsonServers: that setting is about .mcp.json servers.
  • An unapproved .mcp.json server is already not connected: claude mcp list shows it as pending approval. Declining approval is a disable you get for free.
  • Removing and re-adding a server loses its environment variables and headers unless you wrote them down first. Copy the entry before you delete it.

Why disabling beats deleting

Every connected server sends its tool definitions into the context window at the start of the session, under names like mcp__sentry__search_issues. They are there whether or not you use them, which is what issue #3036 ("Having multiple MCP servers running Eats into Context Window") is about. Turning off the three servers you are not using today is the cheapest thing you can do to the context window.

The reason to disable rather than delete is that MCP entries are not one line. A stdio server carries a command, its arguments and its environment; an HTTP one carries a URL, headers and an OAuth session. Delete it and getting it back is a small archaeology job. Disable it and the entry sits there, unchanged, until you need it again next month.

Questions

How do I disable an MCP server in Claude Code without deleting it?
For a project server, add its name to disabledMcpjsonServers in .claude/settings.json. The entry stays in .mcp.json and stops loading. For a one-off, run claude with --strict-mcp-config, which ignores every MCP configuration except the one you pass with --mcp-config.
Is there a claude mcp disable command?
Not as of Claude Code 2.1. The subcommands are add, add-json, add-from-claude-desktop, get, list, login, logout and remove. Issues #4879 and #30595 on anthropics/claude-code both request an enable/disable toggle.
Do MCP servers use up my context window even if I never call them?
Yes. A connected server loads its tool definitions at the start of the session, so the cost is paid whether or not a tool is ever called. Disabling the servers you are not using in a given project is the fix, and it is what issue #3036 asks for.

Loadout shows all of this in one list, with usage counts

A free Mac app that reads the same folders this guide describes: every skill, subagent, slash command, plugin and MCP server, and how often each one actually fires. Nothing leaves your machine.