You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[BUG] Subagents spawned via Task tool cannot execute MCP tools despite appearing in tool registry #16491
When a subagent session is spawned via the Task tool, MCP tools from configured MCP servers appear in the subagent's tool registry but cannot be executed due to missing session permissions. The subagent can see the tools (e.g., tymemud-builder_read_room, context7_resolve-library-id) in its function list, but when attempting to call them, the permission system blocks execution.
Subagent spawned via Task tool reports MCP tools are "not appearing in available function list" or gets permission denied
Subagent can see MCP tools in the registry but lacks permission to execute them
Permission check fails at execution time in packages/opencode/src/session/prompt.ts
Root Cause Analysis
In packages/opencode/src/tool/task.ts (lines 66-102), when creating a subagent session, only explicit permissions are granted for native tools (todowrite, todoread, task). MCP tools are not included in the session's permission array:
When MCP tools are added to the tool registry in packages/opencode/src/session/prompt.ts (lines 830-921), they are wrapped with a permission check via ctx.ask(). The permission ruleset is merged from input.agent.permission and input.session.permission (line 778), but since subagent sessions don't have MCP tool permissions explicitly granted, the check fails.
Relevant Code Locations
I have a number of MCP servers for things like grepai, and query tools for querying/updating non-SQL data stores. This issue makes it nearly impossible for any subagents to do useful work in my environment because they cannot access any of my MCP tools needed to do their work.
Plugins
oh-my-opencode
OpenCode version
1.2.20
Steps to reproduce
Steps to Reproduce
Configure an MCP server in opencode.json
Start OpenCode and verify MCP shows as "connected" via opencode mcp list
Use parent agent to successfully call an MCP tool
Spawn a subagent via Task tool with a prompt that requires MCP tool usage
Observe that subagent reports MCP tools are not available or gets permission denied when attempting to execute
This issue might be a duplicate of existing issues. Please check:
Task should inherit current agent permissions/tools for MCP #3808: "Task should inherit current agent permissions/tools for MCP" — describes the same core problem where subagents spawned via the Task tool do not properly inherit MCP tool permissions from the parent session.
I've also noticed that subtasks sometimes fail to invoke MCP under specific circumstances. Currently, it's difficult to consistently reproduce this issue.
I want to know if this bug has been resolved in the latest version. I have also been troubled by this bug and after ruling it out for two hours, I began to suspect that the subagent was unable to call MCP. After finding this post, I confirmed that this is the case. Also, I found that the sub agent cannot call the plug, right? If there is any progress on this, please let me know. Thank you all. If the sub agent can call MCP, it will be very convenient for development
Reacted by Marina Tamez, lenucksi, Ryan Peterson, Md. Abu Taher and lgr745
Activity
github-actions commentedon Mar 7, 2026
This issue might be a duplicate of existing issues. Please check:
fix: resolve 4 bugs — payload bloat, MCP subagents, tool names, token…
btbxbob commentedon Mar 16, 2026
today i met this problem with jenkins mcp. i think the sub-agents doesn't get any mcp at all.
thanhnndev commentedon Mar 19, 2026
Same here. Spawn sub-agent to double check code with
context7. But can'tHyp3rSon1X commentedon Mar 29, 2026
This is still a problem and it seems the Pull Request that tried to solve this issue got closed.
I had to wrap my mcp into an opencode plugin to register it as a native tool to circumvent this problem... but that really shouldn't be needed...
luoshuijs commentedon Apr 9, 2026
I've also noticed that subtasks sometimes fail to invoke MCP under specific circumstances. Currently, it's difficult to consistently reproduce this issue.
ZiyiTsang commentedon Apr 14, 2026
Same here. I call the subagent to use MCP, but clearly observed failing to use (it seems the subagent does not see it at all)
EL4CTEO commentedon Apr 24, 2026
reading comments
fix: inherit MCP tool allow permissions in subagent sessions
fix: inherit MCP tool allow permissions in subagent sessions
duan2026 commentedon Jun 11, 2026
I want to know if this bug has been resolved in the latest version. I have also been troubled by this bug and after ruling it out for two hours, I began to suspect that the subagent was unable to call MCP. After finding this post, I confirmed that this is the case. Also, I found that the sub agent cannot call the plug, right? If there is any progress on this, please let me know. Thank you all. If the sub agent can call MCP, it will be very convenient for development
fix(opencode): inherit MCP tool allow permissions in subagent sessions
entrptaher commentedon Jul 14, 2026
I think in v2 it's possible to fix this.
Three changes decouple MCP tools from the
executemechanic:packages/core/src/mcp/guidance.ts- ` Use tools from this server through \`execute\` under \`tools[${JSON.stringify(McpTool.group(server.server))}]\`.`,packages/core/src/tool/mcp.tspackages/tui/src/context/data.tsxIf you make these changes,
codemode: false) rather than code-mode tools, so they don't requireexecutepermission.executewas denied.executeusage hint is removed from guidance, since the model no longer routes throughexecuteto use MCP tools.refresh()to default the location whenrefis undefined, which was silently breaking MCP list/catalog calls.And then in your config file,
The code hardcodes some restrictions which are responsible for this issue.
However, this is also probably a critical security issue as you can see the closed PRs connected to this issue.
fix(mcp): prevent null parameters in MCP tool calls for OpenAI-compat…
github-actions commentedon Sep 13, 2026
To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.
jeremyakers commentedon Sep 13, 2026
Every freaking issue or PR I open in OpenCode gets closed with this same BS. So obnoxious. Nothing that actually effects real people ever gets fixed.