[BUG] MCP Agent tool reports an empty available-agent list in mcp serve mode
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report
- [x] I am using the latest version of Claude Code available to me
What's Wrong?
When Claude Code is run as an MCP server via claude mcp serve, the MCP Agent tool cannot resolve subagents that are visible to the normal Claude CLI.
On the same machine:
claude agents
shows general-purpose under user agents, but an MCP Agent call fails with:
Agent type 'general-purpose' not found. Available agents:
The key problem is that the available-agent list appears to be empty in MCP server mode, even though the normal CLI can see the agent.
What Should Happen?
If claude agents can resolve general-purpose, then the MCP Agent tool should be able to launch that same subagent while Claude Code is running in mcp serve mode.
Error Messages/Logs
Agent type 'general-purpose' not found. Available agents:
Claude MCP debug log excerpt:
[DEBUG] [init] configureGlobalAgents starting
[DEBUG] [init] configureGlobalAgents complete
I also tested passing an explicit inline agent definition via --agents into the claude mcp serve process. The MCP Agent call still failed with the same error.
Steps to Reproduce
- Create a user subagent at
~/.claude/agents/general-purpose.md. - Confirm the normal CLI sees it:
``shell``
claude agents
- Start Claude Code as an MCP server:
``shell``
claude mcp serve
- From any MCP client, call the MCP
Agenttool with a minimal request such as:
``json``
{
"description": "Claude ping",
"prompt": "Reply with exactly: ok"
}
- Observe the tool failure:
``shell``
Agent type 'general-purpose' not found. Available agents:
Additional note:
- The same failure occurs even if
claude mcp serveis started with an explicit--agents '{"general-purpose": {...}}'definition.
Claude Model
Not sure / Multiple models
Is this a regression?
I don't know
Claude Code Version
2.1.89 (Claude Code)
Platform
Anthropic API
Operating System
macOS
Terminal/Shell
Other
Additional Information
- I reproduced this through an MCP client using a fresh session each time.
- The issue appears to be specific to MCP server mode rather than normal CLI subagent discovery.
- The reproduction does not require tmux or any terminal-specific integration.
Showing cached comments. Read the full discussion on GitHub ↗
16 Comments
Confirming this in a Docker/Linux setup.
Environment:
docker exec ... claude mcp serveWhat we see:
claude agentsmcp servemode, the MCPAgenttool behaves as if the available-agent registry is emptyRepro:
docker exec -i -w /code/<project> <container> /usr/local/bin/claude mcp servetools/callonAgentwithsubagent_type: "general-purpose"Agent type 'general-purpose' not found. Available agents:Additional data point:
claude mcp servewith an explicit inline--agentsdefinitionAgentcall still failed the same way, e.g.:Agent type 'probe-agent' not found. Available agents:This suggests the problem is not just discovery of user/global agents from config/home, but that the available-agent list is not being populated at all in
mcp servemode.Happy to provide the exact JSON-RPC requests/responses if useful.
I'm surprised this is broken.. It seems to have been broken for a while. Any news from Anthropic team here?
I have the same issue.
Still reproduces on Claude Code 2.1.119 (macOS, Darwin 25.4.0). A few extra data points from probing
claude mcp servedirectly via MCP:claude mcp serveis launched from$HOMEor from a project directory that has its own.claude/agents/.~/.claude/agents/*.mdfiles. I havepr-review-toolkit@claude-plugins-officialinstalled at user scope (visible to the main CLI's Agent tool) and none of its agents show up undermcp serveeither. So the scope of the bug is broader than just user-file agents.tools/listagainstclaude mcp servereturns theAgenttool with its description already containing an emptyAvailable agent types and the tools they have access to:section (nothing after the colon). So the server literally advertises zero agents — clients aren't just failing to resolve a name, the registry is empty at startup.--verbose/--debugflags onclaude mcp serveproduce no additional info about agent loading beyond theconfigureGlobalAgents starting/completepair the original reporter showed.No workaround found via config. The only way to spawn subagents from inside an MCP-served Claude right now is to shell out to
claude -p "..."via the exposedBashtool, which does load agents normally — but that bypasses theAgenttool entirely and loses streaming/subagent_type/etc.Any update on this?
Same question, any workarounds for this issue guys? Guys come on, we need to figure something out
Same problem.
Same problem.
Same problem.
Some problem (Claude Code v2.1.133).
We are approaching two months with no formal acknowledgment of this issue. Is anybody (or anything) out there looking at this? It severely limits MCP mode.
Good question. Indeed, this issue is still present in v2.1.146 without any formal acknowledgment.
this issue is still present in
2.1.150still present in 2.1.181.
Fairly shocking TBH that this gets 0 attention for months!
Still reproduces on Claude Code 2.1.220 on macOS (Darwin arm64).
Normal CLI agent discovery works:
The same installation through
claude mcp servehas an empty registry:The same result occurs with a named user agent (
coder).I also tested these server startup variants:
--agentsdefinition--agent coder--setting-sources user,project,localCLAUDE_AGENT_SDK_DISABLE_BUILTIN_AGENTS=0Every MCP
Agentcall still reports an empty available-agent list. The MCP processes have the correctHOME, user, working directory, and readable~/.claude/agents/*.mdfiles.Other Claude CLI agent discovery works, so this remains isolated to the
mcp serveAgent registry initialization path. No model invocation occurs before the failure.Reproduced again today (Claude Code MCP registered as a server for Codex,
claude mcp serve), but with a different symptom than the empty-registry error above: theAgenttool call failed instantly (~22ms) withuser cancelled MCP tool call, not an empty agent list.tool_timeout_secon the caller side (Codex) was already raised to 600s and made no difference, since nothing waits out a timeout here — the call is rejected before any real work starts.Setup:
codex exec(non-interactive) invoking aclaudeMCP server entry pointing atclaude mcp serve, asking it to call theAgenttool for ageneral-purposesubagent.Might be a second failure mode in the same broken registry-init path, or a related permission-gate issue specific to non-interactive/headless MCP clients (no human present to approve a tool call) — flagging in case it's a useful second data point for whoever ends up debugging this.