1 min

Claude Code: how to use MCP servers without worrying about “context bloat”

Subagents get their own context window, so why not stuff all your MCP servers in there? An mcp-manager subagent + mcp-management skills keep the main context squeaky clean, even with 80 MCP servers 💪

Also in: Tiếng Việt · 中文 · 한국어 · 日本語

Right after I finished reading Anthropic's "Code execution with MCP" post, an idea suddenly flashed through my head...

As you may already know, subagents have their own context windows, while the way we use MCP today bloats the main context (anyone who's used Chrome Devtools MCP or Playwright MCP knows how much upfront context their pile of tools eats up).

I tried it out right away...

The idea: mcp-manager subagent + mcp-management skills

The idea is dead simple: an mcp-manager subagent + mcp-management skills.

  1. The mcp-management skills contain scripts that initialize an MCP Client from .claude/.mcp.json (move your .mcp.json file here so the main agent doesn't auto-load it into context from the start)
  2. The mcp-manager subagent is then equipped with the mcp-management skills

How it flows

Whenever a tool needs to be called, here's what happens:

mermaidflowchart TD
  A["Main agent needs to call a tool"] --> B["Summon the mcp-manager subagent"]
  B --> C["Activate mcp-management skills"]
  C --> D["Load MCP servers"]
  D --> E["Subagent gets the list of tools, analyzes and picks one"]
  E --> F["Call the tool and get the result"]
  F --> G["Return the result to the main agent"]

Upgrade: offloading MCP handling to gemini-cli

Actually, I upgraded it a bit after that, because even though processing such a huge number of MCP server tools doesn't pollute the main context, it still... burns tokens, so you hit your subscription plan's limit fast.

So I handed that MCP processing off to... gemini-cli 😂

ApproachMain contextSubscription plan tokens
Load MCP straight into the main agentBloated from the startBurned
mcp-manager subagentCleanStill burned when handling lots of tools
Subagent + gemini-cliCleanMCP processing moved to gemini-cli

Where's the code?

The code is... 🤌 ...right here: mrgoonie/claudekit-skills

And of course, all the CKers already have the latest version 😜