[Feature Request] Selective MCP Access Control for SubAgents

Status Closed — not planned
Maintainer reply None cached
Activity 9 comments · opened Aug 26, 2025 · closed Feb 9, 2026

Bug Description
I want to define MCPs that are accessible only to specific sub-agents, and not to the main agent, so the main agent’s context stays clean.
Use case: Some MCPs are meant to be used exclusively by one or more sub-agents, and should not appear in the main agent’s context.
Possible solution: Extend the main agent’s config to include an allowlist of MCPs, similar to how sub-agent configs define their MCPs.

Environment Info

  • Platform: darwin
  • Terminal: vscode
  • Version: 1.0.92
  • Feedback ID: e60a8c85-a93a-41b3-aeee-1859d6ff85bf

Errors

[]

View original on GitHub ↗

9 Comments

github-actions[bot] · 1 year ago

Found 3 possible duplicate issues:

  1. https://github.com/anthropics/claude-code/issues/4380
  2. https://github.com/anthropics/claude-code/issues/4476
  3. https://github.com/anthropics/claude-code/issues/6186

This issue will be automatically closed as a duplicate in 3 days.

  • If your issue is a duplicate, please close it and 👍 the existing issue instead
  • To prevent auto-closure, add a comment or 👎 this comment

🤖 Generated with Claude Code

coygeek · 1 year ago

+1, this is a great feature request. I've been thinking about a similar problem where I have a bunch of specialized MCPs (like Sentry, Jira, etc.) that I only want my debugger-agent or pr-reviewer-agent to use, but they clutter up the main agent's tool list.

As a partial workaround, it looks like you can control which tools a sub-agent has access to. The documentation on sub-agents has a section on this.

From the Subagents documentation (en/docs/claude-code/sub-agents):

Each subagent is defined in a Markdown file with this structure: ``markdown --- name: your-sub-agent-name description: Description of when this subagent should be invoked tools: tool1, tool2, tool3 # Optional - inherits all tools if omitted --- Your subagent's system prompt goes here. ``

The key is that tools field. If you omit it, the sub-agent inherits everything. But if you define it, you're essentially creating a specific allowlist for that agent.

So you could create a sub-agent that only has access to your Sentry MCP tools, for example:

.claude/agents/sentry-debugger.md

---
name: sentry-debugger
description: A specialist for investigating Sentry issues.
tools: Read, Grep, mcp__sentry__get_issue, mcp__sentry__list_issues
---

You are an expert debugger. Use the Sentry tools to investigate the issue ID provided.

This is great for locking down the sub-agents, but like you said, it doesn't solve the problem of the main agent's context staying clean. All the MCPs you have configured are still loaded and available to the main agent.

So, I think your original feature request is still totally valid. Being able to specify an allowlist or denylist of MCPs/tools for the main agent would be the other half of the solution. It would give us complete control over the context for both the main agent and its sub-agents.

github-actions[bot] · 8 months ago

This issue has been inactive for 30 days. If the issue is still occurring, please comment to let us know. Otherwise, this issue will be automatically closed in 30 days for housekeeping purposes.

eXamadeus · 8 months ago

This _is_ a duplicate, but it's because the main issues keep getting auto closed. Yall, figure out a way to ensure an issue doesn't get closed and your duplicate rate will drop to nearly 0.

I can't tell you how many versions of this exact issue I've seen open because the github-actions bot is overzealous in closing out old issues (because they don't get a "bump" comment in time).

EDIT: I love that my comment telling the bot it was a duplicate made the bot keep the issue open. Oh the irony!

adam-badar · 8 months ago

Bumping this

mayorandrew · 7 months ago

That would really be a game changer. I have close to 20 MCPs for various systems that we use, and the context fills in very quickly, so I have to manually turn them on and off depending on what I'm using.

Also the main agent sometimes misses to read the docs on how to use the specific MCP in our specific use-case correctly, often leading to bunch of failed calls in a row, polluting the context even more.

Being able to isolate MCPs to specific sub-agents would greatly improve the context management flexibility and ensure that the sub-agent has just the right context to use specific MCPs efficiently.

Examples of sub-agents related to specific MCPs that I'd like to isolate include:

  • Query and Edit Notion (notion mcp)
  • Query GraphQL API (graphql mcp)
  • Query Data Lake (data-lake specific mcp)
  • Query Operational Database (postgres mcp)
  • Query Logs and Metrics (datadog mcp)
  • Develop and Write Code (context7 mcp and others)

As you can see there is a huge potential for isolating huge chunks of context (e.g. GraphQL schema, Notion structure, Database schemas) to just specific sub-agents and keep the main agent focused on achieving the high-level goal.

Really looking forward to this feature!

github-actions[bot] · 6 months ago

This issue has been automatically closed due to 60 days of inactivity. If you're still experiencing this issue, please open a new issue with updated information.

marcindulak · 6 months ago

This issue was closed incorrectly despite recent human comments. This behavior of the bot is reported at https://github.com/anthropics/claude-code/issues/16497. Please upvote that issue, so maybe it gets noticed.

github-actions[bot] · 6 months ago

This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.