Technical note

I Reduced Claude Code's Initial Context by 80% (Without Removing Any MCP Servers)

A single environment variable cut my Claude Code startup context from ~150k tokens to under 30k — and the per-session startup cost from over $1 to about $0.06.

Like many Claude Code users, I went on an MCP (Model Context Protocol) installation spree.

Every time I found an interesting MCP server, I added it. GitHub, browser automation, databases, AWS… before long my Claude Code had become a Swiss Army knife.

One day I started a brand-new Claude Code session and simply typed:

Hi

Out of curiosity, I checked the context usage.

To my surprise, the initial context was already around 150,000 tokens, even though I’d only typed a single word.

That also meant the session had already consumed more than $1 worth of tokens before doing any useful work.

More importantly, every conversation was carrying a huge amount of MCP tool definitions that I wasn’t actually using. Besides the higher cost, a significant portion of Claude’s context window was already occupied before the real work even began.

Finding the cause

After a bit of investigation, I realized the issue wasn’t Claude Code itself.

Every installed MCP server exposes its available tools to Claude. As I added more and more MCP servers, all of those tool definitions were included in the initial context for every new session.

The more MCP servers I installed, the larger — and more expensive — the starting context became.

The one-line fix

While reading the Claude Code documentation, I discovered this environment variable:

export ENABLE_TOOL_SEARCH=true

I enabled it without uninstalling or disabling a single MCP server.

The difference was immediate.

Metric Before After
Initial context ~150k tokens ~30k tokens
Startup cost >$1 ~$0.06
Tool loading Every conversation loads all MCP tool definitions Only relevant tools are loaded
Context availability Large amount occupied before work begins Most context remains available for actual tasks

That’s roughly an 80% reduction in initial context size and around 20× lower startup cost.

Why it works

By default, Claude Code loads information about all available MCP tools into the conversation context.

When ENABLE_TOOL_SEARCH=true is enabled, Claude Code changes its strategy.

Instead of loading every tool definition up front, it first performs a lightweight search to determine which tools are relevant to your request. Only those relevant tools are then added to the context.

Conceptually, it changes from this:

Your prompt
+ Tool A
+ Tool B
+ Tool C
+ Tool D
...
+ Tool Z

to this:

Your prompt
+ Search available tools

Only Tool C
Only Tool G

As your collection of MCP servers grows, this optimization becomes increasingly valuable.

Who should enable this?

If you only have a couple of MCP servers installed, the impact may be minimal.

But if you’ve accumulated dozens of MCP servers like I have, this is an easy optimization that lets you keep all of them without bloating every conversation’s context.

Final thoughts

The biggest surprise wasn’t that saying “Hi” cost over a dollar.

It was discovering that every new Claude Code session started with around 150,000 tokens of context — most of it from MCP tool definitions I wasn’t using.

After enabling ENABLE_TOOL_SEARCH, the initial context dropped to under 30,000 tokens, the startup cost fell from over $1 to about $0.06, and much more of the context window was available for the work I actually wanted Claude to do.

If you’re an enthusiastic MCP collector, this is one setting that’s absolutely worth enabling.

Reference: Scale with MCP tool search