MCP tools registered twice when plugin has .mcp.json in both cache and marketplace directories
Bug Description
When a plugin provides an MCP server via .mcp.json, its tools are registered twice in the deferred tools list — once from the installed plugin cache and once from the marketplace source directory. This results in duplicate tool sets with different naming prefixes.
Reproduction
- Install any MCP-providing plugin from a marketplace (e.g.,
context7,serena,playwright) - Observe the deferred tools list in a new session
- Each MCP server's tools appear twice:
mcp__plugin_context7_context7__resolve-library-id(from cache)mcp__context7__resolve-library-id(from marketplace source)
Root Cause
Each MCP-providing plugin has two identical .mcp.json files on disk:
| Location | Example Path | Tool Prefix |
|----------|-------------|-------------|
| Installed cache | ~/.claude/plugins/cache/claude-plugins-official/context7/<version>/.mcp.json | mcp__plugin_context7_context7__* |
| Marketplace source | ~/.claude/plugins/marketplaces/claude-plugins-official/external_plugins/context7/.mcp.json | mcp__context7__* |
The files are byte-for-byte identical. Claude Code appears to scan both directories for .mcp.json files, causing each MCP server to be loaded twice.
Affected Plugins
All marketplace plugins that include .mcp.json:
context7(2 tools × 2 = 4 deferred tool entries)serena(~30 tools × 2 = ~60 deferred tool entries)playwright(~25 tools × 2 = ~50 deferred tool entries)github(has.mcp.jsonin both locations)greptile(has.mcp.jsonin both locations)
In total, ~80 duplicate deferred tools are registered.
Impact
- Tool search pollution: ToolSearch returns duplicates, making it harder to find the right tool
- Potential resource waste: Two MCP server processes may be spawned per plugin
- User confusion: Unclear which prefix to use (
mcp__plugin_X_X__*vsmcp__X__*)
Expected Behavior
Only the installed (cache) copy of .mcp.json should be loaded for active MCP server registration. The marketplace source directory should be treated as a template/source, not scanned for active servers.
Environment
- Claude Code with plugins enabled
- macOS (Darwin 25.2.0)
- Marketplace:
claude-plugins-official
Workaround
None that persists. The marketplace .mcp.json files are git-managed and return on marketplace updates. Deleting cache copies breaks plugin installation.
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗