[FEATURE] Scope MCP servers to subagents only (main session vs subagent MCP split)
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
When using specialized subagents (e.g., qa-agent with Playwright, api-agent with database tools), the main Claude Code session is forced to load all MCP servers defined in .mcp.json — even ones it never uses. MCP tool schemas are tokenized into the context window, so servers like playwright-mcp (~15 tool definitions) consume tokens in every session unnecessarily.
The current workflow requires me to either load all MCP servers everywhere or remove them entirely and lose them for subagents, too. There is no way to say "this server is only for subagents."
Proposed Solution
Add a scope field to MCP server entries in .mcp.json:
{
"mcpServers": {
"playwright": {
"type": "stdio",
"command": "npx",
"args": ["-y", "playwright-mcp"],
"scope": "subagents"
},
"github": {
"type": "stdio",
"command": "node",
"args": ["..."],
"scope": "all"
}
}
}
Possible scope values:
"all"(default) — available in main session and subagents (current behavior)"subagents"— only injected when spawning subagent sessions"main"— only available in the top-level session
Alternative Solutions
- Manually removing the server from
.mcp.json— loses it for subagents too disabled: trueinsettings.json— also propagates to subagents- Currently, there is no working workaround
Priority
Low - Nice to have
Feature Category
MCP server integration
Use Case Example
- I have a
qa-agentthat uses Playwright for browser testing - I launch Claude Code for a regular coding session — no browser testing needed
- With this feature, I'd set
"scope": "subagents"on theplaywrightserver - The main session loads without Playwright tool schemas, saving ~15 tool definitions' worth of tokens
- When the
qa-agentspawns, it still gets Playwright automatically
Additional Context
Subagents currently inherit the same .mcp.json as the parent session with no way to differentiate. This feature would allow monorepo setups with multiple specialized agents to each get only the tools they need, reducing context bloat across the board.
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗