Skip to content

fix(opencode): grant MCP tool permissions in subagent sessions#30085

Closed
ZK-Andy wants to merge 3 commits into
anomalyco:devfrom
ZK-Andy:fix/subagent-mcp-permissions
Closed

fix(opencode): grant MCP tool permissions in subagent sessions#30085
ZK-Andy wants to merge 3 commits into
anomalyco:devfrom
ZK-Andy:fix/subagent-mcp-permissions

Conversation

@ZK-Andy
Copy link
Copy Markdown

@ZK-Andy ZK-Andy commented May 31, 2026

Issue for this PR

Closes #16491

Type of change

  • Bug fix

What does this PR do?

Subagents spawned via the Task tool can now execute MCP tools. Previously, MCP tools appeared in the subagent tool registry but permission checks failed because they were not granted in the session permission array.

This fix retrieves available MCP tools from the MCP service and:

  1. Adds them to the session permission array with allow action
  2. Includes them in the tools object passed to SessionPrompt.prompt() (default disabled)

How did you verify your code works?

  • TypeScript typecheck passes (\ sgo --noEmit)
  • The test suite layer includes \MCP.defaultLayer\ to satisfy service requirements
  • Without MCP configured, \mcp.tools()\ returns empty object, making the new code a no-op

Screenshots / recordings

N/A

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

@github-actions github-actions Bot added needs:compliance This means the issue will auto-close after 2 hours. and removed needs:compliance This means the issue will auto-close after 2 hours. labels May 31, 2026
@github-actions
Copy link
Copy Markdown
Contributor

Thanks for updating your PR! It now meets our contributing guidelines. 👍

@ZK-Andy ZK-Andy force-pushed the fix/subagent-mcp-permissions branch from dddafbe to 8d3b00c Compare June 1, 2026 15:23
@ZK-Andy
Copy link
Copy Markdown
Author

ZK-Andy commented Jun 1, 2026

@simonklee @kitlangton @thdxr @rekram1-node I realize everyone is busy, but this fix is important for workflows that rely on MCP tools in multi-step agent tasks. Without it, subagents can't access those tools at all. Any review would be much appreciated. Thanks!

@ZK-Andy ZK-Andy closed this Jun 2, 2026
@ZK-Andy ZK-Andy deleted the fix/subagent-mcp-permissions branch June 2, 2026 01:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] Subagents spawned via Task tool cannot execute MCP tools despite appearing in tool registry

1 participant