Add mcp search tool, lazy mcp load, reduce mcp tool occupying a lot of context
Resolved 💬 7 comments Opened Jan 15, 2026 by saidelike Closed Aug 5, 2026
💡 Likely answer: A maintainer (etraut-openai, contributor)
responded on this thread — see the highlighted reply below.
What feature would you like to see?
When MCP tool descriptions exceed 10% of the context window, they are automatically deferred and discovered via the MCPSearch tool instead of being loaded upfront. This reduces context usage for users with many MCP tools configured.
References:
- high level description: https://x.com/i/status/2011523109871108570
- tool search specification: https://platform.claude.com/docs/en/agents-and-tools/tool-use/tool-search-tool
- original Claude Code issue: https://github.com/anthropics/claude-code/issues/7336
Related issues:
Additional information
_No response_
7 Comments
I implemented optional / lazy loading of MCP servers in my fork, xCodex (
xcodex), and shipped it in v0.3.5.xCodex: https://github.com/Eriz1818/xCodex
Release notes: https://github.com/Eriz1818/xCodex/blob/main/docs/xcodex/releases/0.3.5.md
Docs: https://github.com/Eriz1818/xCodex/blob/main/docs/xcodex/lazy-mcp-loading.md
What it adds:
/mcp load <name>(plus/mcpstatus +/mcp retry ...)xcodex --mcp-startup-mode lazy(or eager/manual)This keeps startup fast for sessions that don’t use MCP, while still making it easy to opt-in when you do. AND saving on context!
wow nice. Would you be able to do a PR for the official codex repo? Seems very useful :)
This is very much needed
While waiting for native lazy loading support, you can at least identify which MCP servers are the worst offenders using mcp-checkup:
It analyzes your setup, measures token cost per server/tool, and grades them A-F. Users with many MCP servers often discover 2-3 servers account for 80% of context overhead — disabling just those gives you most of the benefit of lazy loading without client-side changes.
Zero config, just
npxand go.+1
Lazy MCP loading probably needs four states, not only eager versus lazy: configured, manifest-known, started, and invoked.
Tool search can operate over manifest-known servers without paying startup cost, then start a server only when a selected tool needs execution. The metric to watch is also two numbers: manifest tokens loaded into the prompt and first-use latency after tool selection. That prevents the fix from trading context overhead for opaque stalls on the first real MCP call.
---
_Generated with ax._
tool_searchavoids eagerly loading every MCP tool.