Feature request: Lazy MCP server initialization (connect on demand)
Problem
All configured MCP servers connect at chat startup, registering their full tool lists into context immediately. For users with multiple MCP servers (Gmail, Google Calendar, Notion, Figma, Kling, etc.), this consumes significant context window space before any work begins — even if most servers won't be used in that session.
The current "deferred tools" mechanism helps (only names loaded, full schemas on demand), but the server processes still spin up and the name list still grows with every added server.
Desired behavior
MCP servers should support lazy initialization — credentials stored locally (e.g., .env), but servers only connect and register tools when the user actually needs them mid-conversation.
Ideal flow:
- User configures MCP servers + auth as usual
- On chat start: no MCP servers connect, zero context used
- User says "check my email" → Claude detects Gmail MCP is needed → server connects on demand → tools become available
- Only that server's tools consume context
Possible implementation approaches
- A "lazy" flag per MCP server in settings (e.g.,
"lazy": true) - A lightweight router/proxy MCP server that starts others on demand
- Extending the existing deferred tools mechanism to defer the connection itself, not just the schema
Context
Users who integrate many MCP servers for different workflows (productivity, design, content generation) hit context limits quickly. The workaround today is manually enabling/disabling servers between sessions, which defeats the purpose of having an integrated toolchain.
This would make Claude Code significantly more scalable for power users with broad MCP setups.
This issue has 6 comments on GitHub. Read the full discussion on GitHub ↗