Feature request: Lazy/on-demand MCP server connections
Problem
When multiple MCP servers are configured, all of them connect at session startup regardless of whether they'll be used in that session. This causes significant memory/RAM consumption and slower startup times, especially for users who have several MCP servers configured across different services.
Tool search already defers tool definitions (schema loading) until needed, which helps with context window usage — but the underlying server processes still launch and hold open connections at startup, consuming system resources.
Proposed Solution
Add a per-server configuration option (e.g., "autoConnect": false or "lazyConnect": true) that defers the actual server process launch and connection until one of its tools is first invoked.
Example:
{
"mcpServers": {
"essential-server": {
"command": "...",
"autoConnect": true
},
"occasionally-used-server": {
"command": "...",
"autoConnect": false
}
}
}
Servers with autoConnect: false would:
- NOT spawn a process or establish a connection at session start
- Only connect when the user explicitly asks to use one of their tools (or when tool search resolves to one of their tools)
- Still appear in
/mcpstatus (shown as "not connected" or "on-demand")
Use Case
Users who work across multiple projects and cloud services often configure many MCP servers (monitoring, databases, version control, project management, cloud storage, etc.). In any given session, only a subset of these are actually needed. Spawning all server processes upfront wastes memory and can cause performance issues on resource-constrained machines.
Alternatives Considered
- Manually editing settings per session — works but tedious and error-prone
- Using project-scoped settings — helps somewhat but doesn't solve it when multiple servers are needed in the same project
- Tool search — already implemented but only defers schema definitions, not the actual connections
Additional Context
This would complement the existing tool search feature nicely — tool search optimizes context window usage, while lazy connections would optimize system resource usage.