[RFC Cross-link] autoConnect: false — Deferred MCP Server Registration, /mcp sync, and Schema Eviction for Claude Code
Preflight Checklist
- [x] I have searched existing requests and this feature hasn't been requested yet
- [x] This is a single feature request (not multiple features)
Problem Statement
MCP server lifecycle in Claude Code currently has one mode: eager connect at session init. All configured servers run initialize → tools/list before the first user prompt regardless of whether they are ever needed.
Three compounding bugs drive this:
/mcp disabledoes not evict schemas — tools are hidden from the selector but their schemas remain serialized in the active context window. Token cost is paid regardless. (ref: #11370)/mcp addpermanently mutatesmcp-config.json— no session-scoped lazy injection exists without global config mutation. (ref: #6638).mcp.jsondisk changes are invisible to an active session — no reload, sync, or watch mechanism exists. (ref: #6638, #14879, #18497)
Measured impact: A 10-server unoptimized setup consumes ~75,000 tokens at session start before any user prompt, directly causing 400 Bad Request errors at the Sonnet 4.6 serialization ceiling.
Proposed Solution
Full RFC with state machine and config schema is at: github/copilot-cli#1938
Three concrete changes requested for Claude Code parity:
1. autoConnect: false in .mcp.json / mcp-config.json
{
"mcpServers": {
"playwright": {
"command": "npx",
"args": ["@playwright/mcp@latest"],
"autoConnect": false
}
}
}
Server is registered at session init but process is not spawned and no handshake runs until /mcp enable playwright is called. Zero schema tokens consumed until needed.
2. /mcp sync command
Re-parses .mcp.json from disk mid-session. Registers new entries as dormant (autoConnect: false default for sync-added servers). Deregisters removed entries cleanly. No session restart required.
3. /mcp disable MUST evict schemas
Currently disable is a registry toggle only — schemas remain in the context window. On disable, tool schemas must be evicted at the next turn boundary, not just hidden from the tool selector.
---
_Submitted via Claude Sonnet 4.6 agent — March 9, 2026_
Alternative Solutions
Current workaround: Launch session with --disable-mcp-server flags for all non-essential servers, then use /mcp enable SERVER mid-session to trigger the initialize handshake on demand. This exploits the fact that /mcp enable runs a full cold-start handshake for dormant servers.
Limitation: requires CLI restart to pick up .mcp.json changes. /mcp add writes globally to mcp-config.json rather than session-scoped lazy injection. FastMCP 3.1 CodeMode provides a server-side mitigation but does not fix the client-side config static-parse problem.
Priority
Critical - Blocking my work
Feature Category
CLI commands and flags
Use Case Example
Developer starts a Claude Code session for a full-stack project with 8 MCP servers configured (github, linear, playwright, context7, filesystem, postgres, slack, jira). Without autoConnect: false, all 8 servers handshake eagerly at init, consuming ~75,000 tokens before the first prompt. With autoConnect: false on 6 of them, session starts in <2,000 tokens. Mid-session, developer types /mcp enable playwright to start browser testing — handshake fires on demand, only playwright schemas enter context. Playwright work complete: /mcp disable playwright evicts schemas from next turn, freeing ~15,000 tokens for the next phase.
Additional Context
Cross-references:
- Full RFC + state machine diagram: github/copilot-cli#1938
- Upstream issues consolidated: #6638, #11364, #11370, #14879, #16826, #18497
- Protocol-layer RFC (ClientCapabilities): modelcontextprotocol/specification (pending)
- FastMCP 3.1 server-side mitigation: https://gofastmcp.com/changelog
Related: MCP Tool Search (Claude Code v2.1.9) solves schema injection via defer loading: true but does not solve static config parse or schema eviction on disable.
---
_Submitted via Claude Sonnet 4.6 agent — March 9, 2026_
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗