[BUG] /context reports 0 tokens for MCP server instructions that cost 653 per turn
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code
What's Wrong?
A MCP server's instructions field reaches the model and is billed on every turn, but /context attributes it 0 tokens and leaves the total unchanged.
Measured against the API, same host binary 2.1.273, neutral directory, tokens counted rather than estimated:
| Run | Prompt tokens | Delta |
| --- | --- | --- |
| no server | 26,686 | |
| server, instructions emptied | 26,732 | +46 |
| server, full instructions | 27,385 | +699 |
The tool costs 46 tokens, the instructions 653, on every turn. /context credits the tool with 66 and the instructions with nothing. The totals for the two images are identical at 16.7k, and the sum of the printed categories confirms nothing was silently folded in.
The instructions used are 1,953 characters, 345 words. That is deliberately under the 2,048-character per-server cap Claude Code applies before building the system prompt, so this measures the omission and not the cap. The cap bounds what one server can hide, not what a session accumulates. The omission is per server.
This is distinct from anthropics/claude-ai-mcp anthropics/claude-ai-mcp#93 and anthropics/claude-ai-mcp#131, where the field never reaches the model. Here it does. See the control under Steps to Reproduce.
What Should Happen?
Server instructions should appear in the /context breakdown, as their own category or alongside the server's MCP tools, and count toward the total. A user adding a server currently has no way to see what it costs per turn.
Error Messages/Logs
Steps to Reproduce
Two images, custom/ copied twice, differing only in config/mcp.json. Both carry the same Python layer and pinned mcp SDK; only ctx-mcp declares the server.
scripts/build-image.sh ctx-base
scripts/build-image.sh ctx-mcp
scripts/benchmark-image.sh --model claude-opus-5 ctx-base:2.1.273 | tee context-base.txt
scripts/benchmark-image.sh --model claude-opus-5 ctx-mcp:2.1.273 | tee context-mcp.txt
diff context-base.txt context-mcp.txt
The diff is twelve lines: an MCP Tools section appears, the tool is credited 66 tokens, the instructions appear nowhere, the total is unchanged.
Control that the instructions do reach the model. The last line of instructions.txt defines a safe word. With the server attached the model answers it; without, it reports having no server instructions in context. Placing it last means truncation would have removed it first, so the field arrives whole.
Everything is on branch context-omits-mcp-instructions of <https://github.com/hash-hich/claude-code-docker>: ctx-base/, ctx-mcp/, the two outputs, the diff, and the method in ctx-mcp/README.md. The benchmark runs offline with no API key and sends nothing to Anthropic.
Claude Model
Opus
Is this a regression?
I don't know
Last Working Version
_No response_
Claude Code Version
2.1.273
Platform
Anthropic API
Operating System
macOS
Terminal/Shell
Terminal.app (macOS)
Additional Information
/context estimates the startup context while the API figures include what a live session adds on top, which is why 16.7k and 26,686 differ. The claim rests on the deltas between the three runs, taken in an identical environment, not on either absolute.
This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗