Repository navigation
fix(app): keep a team member's MCP tools within its definition's exclusions - #2939
Merged
Merged
Conversation
…usions A team member running a named definition got every MCP tool of the servers its definition names, including those its disallowedTools excludes, and could call them. A member's authority is its parent's, so nothing else removed them. The subagent path already filtered them. The member path now leaves excluded tools out of the catalog, and reports only the tools it registered to the read-only check. Co-Authored-By: Claude Opus 5.5 <[email protected]>
defMCPTools is the one place the subagent and team-member paths resolve a definition's MCP tools, but each caller applied disallowedTools itself, and the member path had drifted. It now leaves out excluded tools before returning them, so both paths share the rule; the callers' own filters are removed. A direct test covers a referenced and an inline server. Co-Authored-By: Claude Opus 5.5 <[email protected]>
ChrisJBurns
approved these changes
Nov 21, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A team member running a named agent definition got every MCP tool of the servers its definition names, including tools its
disallowedToolsexcludes, and could call them. This keeps those tools out, for team members and subagents alike, by applying the exclusion in the one function both use.The bug
defMCPTools(internal/app/agentdefs.go) is the one place the subagent and team-member paths resolve a definition's MCP tools. But each caller applieddisallowedToolsitself, and the team-member path (internal/app/build.go) never did.deriveDelegatedAuthorityinengine/agent/teamsupervisor.go), not narrowed by its definition. So a member could call an excluded tool its parent allowed. Subagents had a second check in their authority; members had none.mcpServers.user-docs/features/security-and-execution/permissions-and-posture.mdalready says a definition'sdisallowedToolsnarrows the specialist, so this restores documented behavior.The fix
defMCPToolsleaves out excluded tools before returning them, so both paths share the rule and can't drift again. The callers' own filters are removed.MCPToolNameslists only the tools the member's catalog holds. Its only consumer is the read-only-member check, which reads catalog tools, so before this an unregistered name changed nothing. It's extra safety, not a fix for a bug anyone can reach.API compatibility
No wire change. A member loses MCP tools its own definition excludes. No conforming client relies on calling a tool its definition excludes.
Testing
Tests:
TestDefMCPToolsLeavesOutDisallowedToolschecksdefMCPToolsdirectly. Excluded tools from a referenced server and from an inline one are both left out, and both are kept without the exclusion.TestMemberDefMCPToolHonorsDisallowedToolsdrives a real team supervisor and member factory against an MCP server with two tools. The excluded tool never reaches the server, while the other does.mainbefore the fix.defMCPToolsfails both tests.Real use, local. I ran
mecak8swith a fake MCP server that logs each call. A named definition references that server and excludes itsechotool. A team member running it callsping, thenecho.mainping, thenecho(the bug)pingWith the fix, the member gets "tool is currently unavailable" for
echo. A named subagent running the same definition also reaches onlyping.Gates:
task lintpasses.The offline demo shows a tool call, a permission ask and approval, and the result.
task test:racepasses apart from three packages this PR doesn't touch:environment/microvmandinternal/adapter/microvmmanagerpass when rerun alone.cmd/mecatui/ui's connect-mouse goldens fail on this PR's base too.task check:prpasses apart from two steps:sdk:e2edidn't run becausebunisn't installed locally;docs:server-cli:checkreports a line-wrap difference that comes from the local checkout path (no flags changed).The steps after
sdk:e2epass when run on their own.Panel review (spec, standards, tests, security, duplication, reuse) found no blockers. The architecture reviewer sat out because nothing structural changed.
defMCPToolsinstead of inside it. That's the second commit.buildMemberSelectorEngine;CallMcpWithQuery;Found, not in this PR
buildMemberSelectorEngineskips adopting the definition on purpose. So it gets every server-wide MCP tool, including ones itsdisallowedToolsnames, as a no-FS subagent does. Spec and security both flagged it as advisory. Its authority is still its parent's, so it gains nothing its parent lacked.🤖 Generated with Claude Code