[BUG] Background subagents cannot access MCP tools
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code
What's Wrong?
When spawning subagents with run_in_background: true, the subagents do not have access to MCP tools. They report that MCP tools are unavailable, even though these tools work correctly in the main context.
When spawning the same subagents with run_in_background: false (synchronous mode), MCP tools work correctly.
What Should Happen?
Subagents running in background mode should have the same access to MCP tools as subagents running in synchronous mode and the main context.
Error Messages/Logs
With run_in_background: true (FAILS):
I don't have access to the Jira MCP tools in this environment.
The MCP (Model Context Protocol) tools need to be configured and
available in your Claude Code setup for me to use them.
The tools I have access to are:
- Bash (for terminal commands)
- File operations (Read, Write, Edit, Glob, Grep)
- Web fetching
...
The MCP tools that would allow me to interact with Jira are not
currently loaded or available in this session.
With run_in_background: false (WORKS):
Subagents successfully call MCP tools and return expected data.
Steps to Reproduce
- Configure any MCP server (e.g., Jira MCP, custom HTTP MCP server, etc.)
- Verify MCP tools work in main context
- Spawn multiple subagents with
run_in_background: true:
``xml``
<invoke name="Task">
<parameter name="subagent_type">general-purpose</parameter>
<parameter name="description">Get user info</parameter>
<parameter name="prompt">Use mcp__jira__atlassianUserInfo to get user details...</parameter>
<parameter name="run_in_background">true</parameter>
</invoke>
<invoke name="Task">
<parameter name="subagent_type">general-purpose</parameter>
<parameter name="description">Get projects</parameter>
<parameter name="prompt">Use mcp__jira__getVisibleJiraProjects to list projects...</parameter>
<parameter name="run_in_background">true</parameter>
</invoke>
- Wait for agents to complete using AgentOutputTool
- Result: All agents report MCP tools unavailable
- Spawn same subagents with
run_in_background: false:
``xml``
<invoke name="Task">
<parameter name="subagent_type">general-purpose</parameter>
<parameter name="description">Get user info</parameter>
<parameter name="prompt">Use mcp__jira__atlassianUserInfo to get user details...</parameter>
<parameter name="run_in_background">false</parameter>
</invoke>
- Result: Agent has MCP access and returns data
Claude Model
Opus
Is this a regression?
I don't know
Last Working Version
_No response_
Claude Code Version
2.0.60
Platform
Anthropic API
Operating System
macOS
Terminal/Shell
iTerm2
Additional Information
_No response_
21 Comments
Found 3 possible duplicate issues:
This issue will be automatically closed as a duplicate in 3 days.
🤖 Generated with Claude Code
I think it might be more pathologically weird, or I have a different bug, or a different manifestation. If I tell Claude Code (
2.0.64 (Claude Code)), to "spawn a backgrounded agent to do X" (where X involves an MCP) it performs magnificently.Tell it to spawn two agents with the same instructions at the same time, and it falls on its face (this isn't https://github.com/anthropics/claude-code/issues/7296 , as I'm not using a stdio MCP server).
I'm not sure whether the problem is backgrounding or parallelism of the agents or what.
This is a shame, because right now my workflow is roughly "poll for new bugs, every fifteen minutes spawn a skills-based agent per bug to do first-level analysis and report out to me." I can do every part of this sans the batching, which is okay, but really limiting. My development flow is pretty hosed by it, as that really needs the parallelism.
@DavidPoliakoff,
this problem occurred exclusively in version 2.0.60, and the subagent running in the background did indeed lose access to MCP it simply could not see them. However, this has been working perfectly since version 2.0.61, so I think this issue can be closed.
@BloodyFrag : the version I experienced this under was 2.0.64. Should I open a new bug? Once I'm in at work, I can also try to just re-validate after pulling whatever version is out this morning
Huh, I think I figured this out. I'm guessing that it's the case that if you
claude --continueafter an update you might still get some bugs from the old version. I'm not sure how that's happening. But this morning, if Iclaude --continuefrom my old session, I'm still hosed. But if I run a fresh session, we're all good. Think it's safe to keep this closed, but just a rec for anybody who sees this to spawn a completely fresh session@DavidPoliakoff,
I think it's something else. My parallel agents worked on version 2.0.60, but they couldn't use MCP tools.
But I checked again, and MCP tools stopped working again in parallel sub-agents running in the background, which is annoying. Version 2.0.65
Yep, you're right. My previous, I launched two parallel agents, but they weren't backgrounded. Now launching backgrounded ones...
Yep, and it's backgrounding, not parallelism. One backgrounded agent fails similarly
Just a confirmation this bug happens in 2.0.61(what I am currently running) as well so its been happening for a little while.
Confirmed, I have the same problem, so the same prompt, I've tried them both and Claude reported:
| Mode | MCP Access | Behavior |
|-------------------------|------------|--------------------------------------------------------|
| run_in_background=false | ✅ Works | Subagent has direct MCP tool access |
| run_in_background=true | ❌ Fails | Subagent tries to use Bash to call claude mcp commands |
happening to me on 2.0.72
+1
@ovidiul how do you invoke
run_in_background=false? It doesn't seem to be working for me, i instructed the command to spawn an agent usingrun_in_background=falsebut agent still can't write to file.@jemshit I am asking Claude in the prompt to d that, not sure if something changed in between Claude Code updates
same here. 2.0.76
Recreated this on 2.0.61. Not resolved.
Still present on 2.1.14
Still present on v2.1.19
Closing for now — inactive for too long. Please open a new issue if this is still relevant.
dear anthropic, please reopen this, subagents using MCP is a fundamental part of this software.... 😢
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.