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

Open 💬 14 comments Opened Apr 1, 2026 by yuhix-dev

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 ↗

This issue has 14 comments on GitHub. Read the full discussion on GitHub ↗