[FEATURE] Scope MCP servers to subagents only (main session vs subagent MCP split)

Resolved 💬 2 comments Opened Apr 3, 2026 by linnienaryshkin Closed May 12, 2026

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: true in settings.json — also propagates to subagents
  • Currently, there is no working workaround

Priority

Low - Nice to have

Feature Category

MCP server integration

Use Case Example

  1. I have a qa-agent that uses Playwright for browser testing
  2. I launch Claude Code for a regular coding session — no browser testing needed
  3. With this feature, I'd set "scope": "subagents" on the playwright server
  4. The main session loads without Playwright tool schemas, saving ~15 tool definitions' worth of tokens
  5. When the qa-agent spawns, 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.

View original on GitHub ↗

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