Blog

Claude Code MCP token usage and CLAUDE.md size

Every MCP server adds its tool names, descriptions and schemas to every request, used or not, and CLAUDE.md loads the same way. That fixed overhead takes window space and is re-sent every turn. Run /context to size it, disconnect servers you do not use, scope the rest per project and keep CLAUDE.md to rules the agent needs.

98.6%
token cache hit rate
67.7%
of spend is still cache reads
72.3%
less on a 938-turn session through condense

Where Claude Code's fixed token overhead comes from

Before your first message the request already holds all of this, and every request re-sends it. The last three are yours, and they only grow.

SourceWhat gets sentWho controls it
System promptClaude Code's own instructionsAnthropic
Built-in toolsRead, Edit, Bash, Grep and othersAnthropic
MCP serversEvery tool's name, description and JSON schemaYou
CLAUDE.md filesUser, project and imported filesYou
Custom agents and skillsShort descriptions so Claude knows they existYou

Measure MCP and CLAUDE.md tokens with /context

  1. 1
    Fresh session, then /context

    Everything except messages is fixed overhead: system prompt, system tools, MCP tools, memory files.

  2. 2
    Run /mcp

    A server with dozens of long-described tools is usually the biggest single item.

  3. 3
    Read the MCP tools line

    A large share before any work is room you lose later, and it brings auto-compact closer.

Why tool definition tokens matter more than they look

Caching makes a fixed block cheaper, not free, and cached tokens still count toward plan limits. See prompt caching vs context compression.

  • Paid on every turn, hundreds of times a session.
  • Less room for real work. Every definition token is one not available for files and history.
  • More ways to choose wrong. A hundred tools is a hundred chances to pick the wrong one.
  • Changing them mid-session is a cache miss. They sit near the top of the prefix.

How to cut MCP server overhead

  1. 1
    Disconnect what you do not use

    Go through /mcp. Unused for a week means not loaded on every request.

  2. 2
    Scope servers per project

    claude mcp add --scope project keeps a server in the repo’s .mcp.json, not everywhere.

  3. 3
    Prefer a CLI when one exists

    If the agent can run gh, kubectl or psql, the MCP server adds definitions, not capability.

  4. 4
    Pick lean servers

    Enable a subset of tools where you can. Fewer, shorter descriptions cost less.

  5. 5
    Set up before you start

    Decide on servers before a long session to avoid the cache miss.

How to keep CLAUDE.md lean

CLAUDE.md is for rules that must hold every turn, which is why it is expensive. The same applies to AGENTS.md in Codex.

KeepCut
Build, test and lint commandsDescriptions of the architecture the code already shows
Conventions the agent gets wrong without being toldGeneral advice like "write clean code"
Hard constraints: files never to touchHistory of past incidents and decisions
Where to find things in a large repoLong examples better kept in a doc the agent can open
  • Directory rules go in a CLAUDE.md in that directory, loaded only when Claude works there.
  • @ imports still load the file, so they organize but do not save tokens.
  • Reference material belongs in a file read on demand or a skill, which loads in full only when used. More in context engineering for coding agents.

A five-minute overhead audit

  1. 1
    Take a baseline

    Fresh session, /context. Note MCP tools and memory files.

  2. 2
    List servers

    /mcp. Disable any you did not use on this project last week.

  3. 3
    Read CLAUDE.md as the agent would

    If a line would not change its behavior, delete it or move it to a file it can open.

  4. 4
    Re-measure

    Another fresh session, /context. The difference is room back on every turn.

  5. 5
    Share it

    Commit .mcp.json and CLAUDE.md, and repeat when someone adds a server.

What compression can and cannot do about it

Fixed overhead is your job to trim. condense saves on the part that grows; a real 938-turn session came in 72.3% under baseline in the anatomy of a token bill.

Part of the requestWho handles it
System prompt and your messagesNever rewritten by condense
MCP definitions and CLAUDE.mdYou, with the audit above
Tool results, file reads, finished agent loopscondense compresses them

Trim first, then run dense claude so the session stays small as it grows. dense info shows context sent against forwarded.

Frequently asked questions

How many tokens do MCP servers use in Claude Code?

It depends on how many tools a server has and how long their descriptions and schemas are. /context shows the MCP tools total for your setup.

Do MCP tools use tokens if I never call them?

Yes, the definitions are in every request. Recent Claude Code versions can defer some until needed, so check /context.

How long should CLAUDE.md be?

As short as it can be while still changing behavior. Keep commands, conventions and hard constraints; cut what the code already shows.

Does prompt caching make MCP and CLAUDE.md overhead free?

No. Cached tokens are cheaper but still billed, still count toward plan limits and still take window space.

Does AGENTS.md have the same overhead in Codex?

Yes. Codex loads it at session start, so keep it short and put directory-specific guidance next to the code.

All posts