[FEATURE] Dynamic MCP Server Loading During Sessions

Resolved 💬 3 comments Opened Dec 20, 2025 by mosfor Closed Dec 24, 2025

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

Right now Claude Code loads all MCP servers when you start a session. This causes two major issues:

Context window gets eaten up immediately - I have 15+ MCP servers configured, and they're taking up over 50% of my context before I even start working. Most sessions I only need 1-2 of them.
Can't add MCP servers mid-session - If Claude realizes it needs a tool during work, there's no way to load a new MCP server without restarting the entire session.

Proposed Solution

Let Claude Code recognize and connect to MCP servers DURING a session, not just at startup.
Example workflow:

Start session with minimal context
I'm working on a database task
Agent realizes "I need postgres tools"
Agent runs a script or command to start the postgres MCP server
Claude Code detects and connects to it
Now postgres tools are available
When done, shut it down and free the context

Add these capabilities:

Runtime API to register new MCP servers (not just startup config)
Hot-reload when new servers connect
Agent-accessible commands like start_mcp_server(path) and stop_mcp_server(name)
Automatic context cleanup when servers disconnect

Alternative Solutions

Current Workarounds

lazy-mcp helps but doesn't fully solve it
Project-level .mcp.json files require restart to switch
Skills can filter tools but can't control which servers run

Priority

Critical - Blocking my work

Feature Category

CLI commands and flags

Use Case Example

_No response_

Additional Context

I tried using docker mcp toolkit to manage this, but it uses too much RAM. I tried lazy-mcp which helps but still requires all servers to be registered upfront.
What I really need is the ability to:

Keep MCP server configs in task/project folders
Load them only when actually needed
Let the agent itself decide when to start/stop servers based on what the task requires

View original on GitHub ↗

This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗