Claude Code Learning Hub
中文 Mingyu's Library

Hub / Tips / D · Cost & context

Why too many MCP servers slow you down and cost more

Every MCP server you connect touches your context budget — the good news is the default tool search already handles the biggest chunk; the rest you have to audit and turn off yourself.

The cost of MCP isn't in "being connected" — it's in whether tool definitions land in the context prefix. Understand the default mechanism and its exceptions, and you'll know exactly what to turn off and what to keep.

One-line answer

Bottom line OfficialTool search is on by default: MCP tool definitions are deferred — at session start only tool names and server instructions load, so connecting many servers has limited impact. But with alwaysLoad, non-first-party gateways, and certain cloud platforms, tools load fully into the prefix — eating context, and every server connect/disconnect then punches through the prompt cache too. Check usage with /context; turn off what you don't use in /mcp.

Steps

  1. Understand the default first: tool search.OfficialTool search is on by default, and MCP tools no longer load in full: at session start only tool names and server instructions enter the context; when a task needs one, Claude loads the specific schema on demand through a search tool, so only tools actually used enter the context. The docs state explicitly that adding more MCP servers has minimal impact on the context window, and there is no fixed per-server tool limit — the real constraint is simply your context budget. So under the default configuration, "connecting many servers inevitably blows the context" no longer holds.
  2. Know the exceptions: scenarios where tools load fully into the prefix.Official
    • ENABLE_TOOL_SEARCH=false is set, or CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS;
    • In ENABLE_TOOL_SEARCH=auto threshold mode, when the total tools fit within the threshold (default 10% of context), they go straight into the prefix;
    • A server or an individual tool is marked alwaysLoad: true;
    • ANTHROPIC_BASE_URL points at a non-first-party gateway (most proxies don't forward tool_reference, so Claude Code automatically falls back to full loading);
    • Azure-hosted Microsoft Foundry deployments (the server side rejects tool search), and models earlier than the Claude 4.5 generation on Google Cloud Agent Platform.
    With full loading, the problem doubles: server connects, disconnects, and tool-list changes all invalidate the prompt cache, forcing a full recompute next turn — and "automatic" connect/disconnects such as a stdio process exiting or an HTTP session expiring require no action from you at all. Details in Which actions invalidate the prompt cache?.
  3. Check usage with the three commands.Official/context shows the current context usage by category with optimization suggestions; /usage's attribution breakdown shows each MCP server's share of recent usage (Pro/Max/Team/Enterprise); the /mcp panel shows each server's connection status and tool count. Look at the data before acting — don't delete on gut feeling.
  4. Toggle on demand instead of deleting everything.OfficialIn the /mcp panel, toggle unused servers off: the config is kept, and the choice is remembered per project in disabledMcpServers in ~/.claude.json — flip it back on when needed. For servers you truly don't want, run claude mcp remove <name>. When installing a new server, use -s to control the scope (local / project / user), and only put it at user level when you genuinely use it in every project (see D9 · MCP).
  5. Prefer a CLI over MCP wherever one exists.OfficialCLI tools like gh, aws, gcloud, and sentry-cli add zero per-tool context overhead; the docs say outright that they're cheaper on context than MCP servers — Claude just runs the commands.
  6. Manage tool output — the other half of the cost.OfficialMCP tool output is capped at 25,000 tokens by default (with a warning past 10,000), and large outputs still eat your context; for calls that frequently return big results, consider delegating to a subagent that returns only a summary. When you need to tune tool search behavior, use ENABLE_TOOL_SEARCH:
    ValueBehavior
    (unset)Default: all MCP tools deferred, loaded on demand (gateways/certain platforms automatically fall back to full loading)
    trueForce deferral (except on platforms that reject it server-side)
    auto / auto:NThreshold mode: load everything into the prefix while tools stay within 10% (or N%) of context; defer only beyond that
    falseLoad all tools in full, no deferral

Copy-paste prompt

Audit this project's MCP configuration for me. Goal: save context and money:
1. Read the MCP server config in the project's .mcp.json, ~/.claude.json,
   and settings at every level; list every server's name, scope, and
   transport type;
2. Flag servers or tools configured with alwaysLoad: true and assess,
   one by one, whether they're truly needed on every turn;
3. Check whether ENABLE_TOOL_SEARCH or ANTHROPIC_BASE_URL is set in the
   environment or settings (gateways force full tool loading);
4. Ask me which servers I've actually used in the past two weeks, and
   sort the unused ones into two tiers: "toggle off in /mcp" or
   "claude mcp remove";
5. Remind me to run /context and /mcp myself to verify the usage (user
   commands — you can't run them for me), and tell me what to look for.

Sources & last verified

  • Officialcode.claude.com/docs/en/mcp.md (tool search mechanics and config table, alwaysLoad, /mcp panel and disabledMcpServers, output limits), fetched 2026-08-05.
  • Officialcode.claude.com/docs/en/costs.md (Reduce MCP server overhead: check usage with /context, toggle idle servers in /mcp, prefer CLIs), fetched 2026-08-05.
  • Officialcode.claude.com/docs/en/prompt-caching.md (how MCP server connects/disconnects affect the cache, the deferred-tools exception), fetched 2026-08-05.
  • Our take"Look at the data before deleting" and "user scope only when you use it in every project" are our recommendations based on the official mechanics.
  • Last verified: 2026-08-05 · volatility:high (tool search defaults and platform exceptions change across versions; official docs at v2.1.222, needs periodic re-checking).