How many tokens do MCP servers use, and how do you cut it?
By default Claude Code puts only MCP tool names and server instructions into context and loads a full tool definition when it is used, so a few more servers cost little. On Codex, every MCP server adds context to every message. The fix is the same on both: turn off what you do not use.
Codex
Every MCP server adds context to each message and uses more of your limit. OpenAI says to use fewer and turn them off when you do not need them.
Type /mcp in the CLI to see the servers in this session, or run codex mcp list for everything you have configured. You do not have to delete a server to stop paying for it: under its [mcp_servers.<name>] entry in ~/.codex/config.toml, write enabled = false, and change it back when you need it. If you use only one or two tools from a server, list them in enabled_tools; the rest are not given to the model. OpenAI does not document whether Codex loads tool definitions on demand.
What the official docs say
Limit the number of MCP servers you use. Every MCP server adds more context to your messages and uses more of your limit. Disable MCP servers when you don't need them.enabled (optional): Set false to disable a server without deleting it.enabled_tools (optional): Tool allow list.Claude
Very little by default: only tool names and server instructions enter context. Check with /context and turn off unused servers in /mcp.
Claude Code has tool search on by default: full tool definitions stay out of context until Claude uses a tool, which is why Anthropic says more servers have minimal impact. The other cost is what tools return. Claude Code warns when one MCP output passes 10,000 tokens and caps it at 25,000 by default; anything larger is saved to a file and only the path stays in the conversation. A server you turn off in /mcp is off for the current project only, and its configuration is kept.
What the official docs say
MCP tool definitions are deferred by default, so only tool names and server instructions enter context until Claude uses a specific tool. Run /context to see what's consuming space.Only tool names and server instructions load at session start, so adding more MCP servers has minimal impact on your context window.Output warning threshold: Claude Code displays a warning when any MCP tool output exceeds 10,000 tokensDefault limit: the default maximum is 25,000 tokensPrefer CLI tools when available: Tools like gh, aws, gcloud, and sentry-cli are still more context-efficient than MCP servers because they don't add any per-tool listing.On a Pro, Max, Team, or Enterprise plan, /usage also shows a breakdown of what counts against your plan limits: Attribution: recent usage attributed to skills, subagents, plugins, and individual MCP servers, each shown as a percentage of the total.If you've logged into Claude Code with a claude.ai account, MCP servers you've added in claude.ai, known as connectors, are automatically available in Claude CodeYou can also run /mcp to toggle any connector Claude Code fetches on or off for the current project only.Through a third-party proxy, every tool definition loads
There is one exception to the default. When ANTHROPIC_BASE_URL points to a host that is not Anthropic, such as a relay or a gateway, Claude Code turns tool search off, because most proxies do not forward the blocks it depends on.
From then on every MCP tool definition goes into context up front, and the number of servers you have installed starts to matter. If you use a proxy, type /context first to see what MCP takes, then turn off the servers this project does not need.
What the official docs say
Tool search is enabled by default: MCP tools are deferred and discovered on demand. Claude Code disables it when ANTHROPIC_BASE_URL points to a non-first-party host, since most proxies don't forward tool_reference blocks.Common misconceptions
- An MCP server you never call costs nothing
Not true. On Codex, every enabled server adds context to every message, used or not. Claude Code carries only tool names by default, which is small but not zero; through a third-party proxy, or with alwaysLoad set, it carries every tool definition. Turn off what you do not use.
- In Claude Code, more MCP servers always means more tokens
Not by default. Claude Code defers tool definitions, and Anthropic says adding more MCP servers has minimal impact on your context. Two things do cost: tool search being off, which is common behind a proxy, and a tool that returns a lot of content in one call.
- The tool list is what uses the tokens
Not only. The tool list is a fixed cost; what tools return is usually the larger one. Every result stays in the conversation and is sent again with each later message. One MCP output can reach 25,000 tokens by default, which outweighs a lot of tool definitions.
Tips
- Claude Code: type /context to see how much context MCP tools take.
- Claude Code: type /mcp and turn off the servers this project does not need. Turn them back on when you do.
- Claude Code: type /usage to see what share of recent usage each MCP server accounts for. Start with the ones that are high and rarely needed.
- Where a command-line tool exists (gh, aws, gcloud, sentry-cli), let the agent run the command instead of adding the matching MCP server.
- Claude Code: do not set alwaysLoad: true on a server unless its tools are needed on every turn. With it, every tool from that server loads at session start.
- Claude Code: if you sign in with a claude.ai account, the connectors you added on claude.ai appear in Claude Code automatically. Turn off the ones this project does not use in /mcp, or set "disableClaudeAiConnectors": true in your settings to turn them all off.
- Codex: in ~/.codex/config.toml, write enabled = false for servers you are not using, and enabled_tools for servers where you need only a few tools.
- Ask for less: limit the range and the number of rows when you query, and do not pull back a whole table or a whole page.