[BUG] MCP Agent tool reports an empty available-agent list in mcp serve mode

Status Open
Reported on v2.1.89
Maintainer reply None cached
Activity 17 comments · opened Apr 1, 2026

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

  1. Create a user subagent at ~/.claude/agents/general-purpose.md.
  2. Confirm the normal CLI sees it:

``shell
claude agents
``

  1. Start Claude Code as an MCP server:

``shell
claude mcp serve
``

  1. From any MCP client, call the MCP Agent tool with a minimal request such as:

``json
{
"description": "Claude ping",
"prompt": "Reply with exactly: ok"
}
``

  1. Observe the tool failure:

``shell
Agent type 'general-purpose' not found. Available agents:
``

Additional note:

  • The same failure occurs even if claude mcp serve is 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.

View original on GitHub ↗

16 Comments

javi-dev · 4 months ago

Confirming this in a Docker/Linux setup.

Environment:

  • Claude Code: 2.1.90
  • OS/runtime: Linux in Docker
  • MCP launch path is via docker exec ... claude mcp serve

What we see:

  • Inside the same container, normal CLI can see agents via claude agents
  • But when Claude Code is started in mcp serve mode, the MCP Agent tool behaves as if the available-agent registry is empty

Repro:

  1. Start MCP with:

docker exec -i -w /code/<project> <container> /usr/local/bin/claude mcp serve

  1. Initialize MCP normally
  2. Call tools/call on Agent with subagent_type: "general-purpose"
  3. Result:

Agent type 'general-purpose' not found. Available agents:

Additional data point:

  • I also tested starting claude mcp serve with an explicit inline --agents definition
  • The MCP Agent call 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 serve mode.

Happy to provide the exact JSON-RPC requests/responses if useful.

zwalden · 4 months ago

I'm surprised this is broken.. It seems to have been broken for a while. Any news from Anthropic team here?

pdwhoward · 4 months ago

I have the same issue.

aapzu · 4 months ago

Still reproduces on Claude Code 2.1.119 (macOS, Darwin 25.4.0). A few extra data points from probing claude mcp serve directly via MCP:

  • Cwd doesn't matter. Reproduces identically whether claude mcp serve is launched from $HOME or from a project directory that has its own .claude/agents/.
  • Plugin-contributed agents are also missing, not just user ~/.claude/agents/*.md files. I have pr-review-toolkit@claude-plugins-official installed at user scope (visible to the main CLI's Agent tool) and none of its agents show up under mcp serve either. So the scope of the bug is broader than just user-file agents.
  • The bug is at tool-registration time, not resolve time. A raw MCP tools/list against claude mcp serve returns the Agent tool with its description already containing an empty Available 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 / --debug flags on claude mcp serve produce no additional info about agent loading beyond the configureGlobalAgents starting / complete pair 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 exposed Bash tool, which does load agents normally — but that bypasses the Agent tool entirely and loses streaming/subagent_type/etc.

phenixrizen · 4 months ago

Any update on this?

DarkzAtom · 4 months ago

Same question, any workarounds for this issue guys? Guys come on, we need to figure something out

hyhsjd2 · 4 months ago

Same problem.

ray-amjad · 3 months ago

Same problem.

bryant-eastham · 3 months ago

Same problem.

Tarzno · 3 months ago

Some problem (Claude Code v2.1.133).

bryant-eastham · 3 months ago

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.

Tarzno · 3 months ago
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.

destan · 3 months ago

this issue is still present in 2.1.150

piotr-klimczak-ice · 2 months ago

still present in 2.1.181.
Fairly shocking TBH that this gets 0 attention for months!

zzlatev-yotpo · 1 month ago

Still reproduces on Claude Code 2.1.220 on macOS (Darwin arm64).

Normal CLI agent discovery works:

$ claude --agent does-not-exist --model sonnet -p "probe"

--agent 'does-not-exist' not found. Available agents:
claude, codebase-explorer, coder, databricks-analyst, Explore,
general-purpose, jira-scout, observability-analyst, Plan, pr-reviewer,
researcher, slack-scout, statusline-setup, test-runner

The same installation through claude mcp serve has an empty registry:

Agent type 'general-purpose' not found. Available agents:

The same result occurs with a named user agent (coder).

I also tested these server startup variants:

  • Explicit --agents definition
  • --agent coder
  • --setting-sources user,project,local
  • CLAUDE_AGENT_SDK_DISABLE_BUILTIN_AGENTS=0
  • Combined setting sources, main agent, and built-in-agent flag

Every MCP Agent call still reports an empty available-agent list. The MCP processes have the correct HOME, user, working directory, and readable ~/.claude/agents/*.md files.

Other Claude CLI agent discovery works, so this remains isolated to the mcp serve Agent registry initialization path. No model invocation occurs before the failure.

AlTarV · 24 days ago

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: the Agent tool call failed instantly (~22ms) with user cancelled MCP tool call, not an empty agent list. tool_timeout_sec on 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 a claude MCP server entry pointing at claude mcp serve, asking it to call the Agent tool for a general-purpose subagent.

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.

Showing cached comments. Read the full discussion on GitHub ↗