Blog / How agents load MCP tools

Why your MCP server fills the context window, and which agents actually pay for it

“My MCP server uses too many tokens” can mean two different things: the window gets full, or the bill gets big. They have different causes and different fixes. We measured both on real runs.

Leonid Bugaev · Published 21 Oct 2026

Two numbers, not one

A server can be safe on peak and expensive on cumulative. That's what we found.

What we measured live

Codex CLI and Claude Code answered the same 8 read-only jobs, 5 runs each, on a 99-tool production MCP server.

Codex: avg peak, % of 258,400
46,794 tokens (18.1%)
Claude Code: avg peak, % of 1M
40,910 tokens (4.1%)
Codex: avg cumulative per question
218,032 tokens
Claude Code: avg cumulative per question
209,722 tokens

No live run came close to overflowing; Codex's worst single request was 24.4% of its window. But a simple read question cost 114k–301k input tokens on Codex, depending on the job, because it made 4–8 model requests.

Find out what your MCP server costs each agent.

We measure peak and cumulative context per job and per agent app on your server, and show which tools and results to cut first.

Measure your MCP

What fills the window

In the live Codex runs, the average largest request (46,794 tokens) split roughly as:

App prompt + hidden
17,062
Tool search output
16,366
MCP results
11,734 (23%)

Across all our groups, MCP results were 12–46% of the largest request. Clear-cut waste inside them was small (0.2% of the largest request in live runs) except where a tool returned its own audit log: 7.1%. Records nobody used were the bigger, fuzzier share: up to 12.5%. More: reduce tool response size.

Bytes aren't tokens. One overview result was 77,123 bytes on the wire and 14,517 tokens. What the model sees can also be less than the server sent: some apps cut long results. See output limits by agent.

Which agents pay

AppHow it loads 99 toolsEffect
Claude Code (tool search on)Names only, definitions on demand+1.7k tokens
CodexTool search+0 up front; search output 11–16k per request
OpenCodePreloads every definition+73k tokens; avg peak 51% of 204.8k, max 84.5%

With a trimmed tool set (v2), OpenCode's largest request shrank 4–5×, to 11.2% of its window. Details: how much context MCP tools use.

Go deeper: How much MCP output is waste, Tool count and context, How Codex finds MCP tools.

What to cut first

  1. If users run preloading apps: trim definitions. They're resent in every request.
  2. If cumulative is high: cut the number of requests. Fewer round trips means fewer resends. Make the obvious tool return the answer in one call.
  3. Then results: drop audit logs and records the question didn't ask for; add filters and summaries.
  4. Measure tokens per job and per app, peak and cumulative, not bytes.

Back to the MCP tool discovery guide.

How we measured

FAQ

Why does my MCP server use so much context?

Three things add up: tool definitions (or tool search output), tool results, and repeated requests. In our runs MCP results were 12–46% of the largest request; the rest was definitions, search output, the app's prompt and the model's own turns.

What's the difference between peak and cumulative context?

Peak is the largest single request in a run, which decides whether the window overflows. Cumulative is the sum over every request in the run, which is roughly what you pay for. An agent making 6 requests of 40k tokens peaks at 40k but bills 240k.

Which agent apps load all MCP tools up front?

In our tests OpenCode preloaded all tool definitions (+73k tokens for 99 tools). Claude Code with tool search on added about 1.7k; Codex loads tools through search.

Are bytes on the wire the same as tokens?

No. One 77,123-byte result was 14,517 tokens. Measure tokens with a tokenizer, not response size.

Find out what your MCP server costs each agent.

We measure peak and cumulative context per job and per agent app on your server, and show which tools and results to cut first.

Measure your MCP