[BUG] "mcpServers" yaml frontmatter in Subagent.md don't work when launching with `--agent` cli command

Resolved 💬 3 comments Opened Feb 25, 2026 by Etern213 Closed Mar 25, 2026

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?

"mcpServers" yaml frontmatter in Subagent.md don't work when launching with --agent cli command

What Should Happen?

"mcpServers" yaml frontmatter in Subagent.md should work properly when launching with --agent cli command

Error Messages/Logs

Steps to Reproduce

  1. Remove a mcp server from project config(.mcp.json)
  2. Add this mcp server to subagent.md frontmatter like below
---
name: my-new-subagent
description: ***
tools: ***
model: inherit
color: yellow
mcpServers:
  - my-mcp-server:
       type: "stdio"
       command: "python"
       args: []
---
  1. Lanch new session with cli args --agent my-new-subagent, and ask claude to do something with mcp tools.
  2. It appears that claude doesn't get tools in mcp properly

Claude Model

None

Is this a regression?

I don't know

Last Working Version

_No response_

Claude Code Version

2.1.55

Platform

Anthropic API

Operating System

Windows

Terminal/Shell

VS Code integrated terminal

Additional Information

_No response_

View original on GitHub ↗

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