[BUG] Inline `mcpServers` in plugin.json ignored - field dropped during manifest parsing
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?
MCP servers defined in a plugin's plugin.json using the mcpServers field are completely ignored by Claude Code. The loader code exists to handle inline mcpServers configuration, but the field is being stripped/dropped during manifest parsing, so it never reaches the MCP loading function.
Skills, commands, and agents from the same plugin.json load correctly - only mcpServers is affected.
What Should Happen?
According to the documentation (manifest-reference.md lines 298-330), plugins should be able to define MCP servers inline in plugin.json:
{
"name": "my-plugin",
"mcpServers": {
"my-server": {
"command": "${CLAUDE_PLUGIN_ROOT}/server.sh"
}
}
}
This should register and connect the MCP server, just like a separate .mcp.json file does.
Error Messages/Logs
No errors are shown. The MCP server simply doesn't appear in `/mcp` output.
Debug investigation shows:
- Function F65 (MCP loader) has correct logic for inline mcpServers
- But plugin.manifest.mcpServers is always undefined
- The field is dropped somewhere between JSON parsing and manifest object creation
Steps to Reproduce
- Create a test plugin with inline mcpServers:
mkdir -p ~/.claude/plugins/marketplaces/test-mkt/test-plugin/.claude-plugin
cat > ~/.claude/plugins/marketplaces/test-mkt/test-plugin/.claude-plugin/plugin.json << 'EOF'
{
"name": "mcp-test",
"version": "1.0.0",
"mcpServers": {
"test-server": {
"command": "echo",
"args": ["test"]
}
}
}
EOF
- Add marketplace to settings:
Edit ~/.claude/settings.json and add:
"pluginMarketplaces": { "test-mkt": { "type": "local", "path": "~/.claude/plugins/marketplaces/test-mkt" } }
- Enable plugin: /plugin install mcp-test@test-mkt
- Restart Claude Code
- Run /mcp
Expected: test-server appears in list
Actual: test-server is NOT listed
- WORKAROUND - Add .mcp.json file:
cat > ~/.claude/plugins/marketplaces/test-mkt/test-plugin/.mcp.json << 'EOF'
{
"test-server": {
"command": "echo",
"args": ["test"]
}
}
EOF
- Restart Claude Code, run /mcp
Result: test-server NOW appears (proving the MCP server config is valid)
Claude Model
Not sure / Multiple models
Is this a regression?
I don't know
Last Working Version
_No response_
Claude Code Version
2.0.76
Platform
Anthropic API
Operating System
macOS
Terminal/Shell
Terminal.app (macOS)
Additional Information
Root Cause Analysis (from source code investigation)
After analyzing the bundled cli.js (v2.0.76), the bug was located:
### The Problem
Function F65 correctly handles all mcpServers formats (string path, array, inline object), but plugin.manifest.mcpServers is always undefined because the field is dropped during manifest parsing.
### Key Code (decompiled from cli.js)
```javascript
// F65 - This logic is CORRECT but never executes because mcpServers is undefined
async function F65(plugin, errors = []) {
let servers = {};
let mcpJson = loadMcpJsonFile(plugin.path, ".mcp.json"); // Works
if (mcpJson) servers = { ...servers, ...mcpJson };
if (plugin.manifest.mcpServers) { // <-- ALWAYS FALSE (mcpServers is undefined)
// ... correct handling code that never runs
}
return servers;
}
Fix Required
In the manifest parsing code, ensure mcpServers is preserved on the plugin.manifest object. The Zod schema includes mcpServers, but it's being filtered out when creating the manifest object.
Related Issues
- #13543: .mcp.json files aren't being copied to plugin cache
- #4938: Multiple mcpServers sections override each other
- #5037: .mcp.json files from .claude/ directory not loading
Documentation Reference
plugins/plugin-dev/skills/plugin-structure/references/manifest-reference.md (lines 298-330) documents inline mcpServers as a supported feature.
This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗