[BUG] MCP server deduplication ignores env vars and names - suppresses functionally different servers from plugins
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?
Since v2.1.70, plugin-provided MCP server deduplication matches only onvcommand + args, ignoring env vars entirely. This causes functionally different servers to be suppressed as "duplicates" when they share the same underlying package but target different systems, credentials, or access modes.
In a plugin marketplace with multiple plugins, only the first-loaded server survives — all others are silently suppressed. This is a blocker for any marketplace where multiple plugins legitimately use the same MCP package
(e.g. storybook, @zereight/mcp-gitlab etc.) with different configurations. It's common for us to use e.g. multiple storybook servers, multiple gitlab instance etc at the same time. Currently, its not possible.
What Should Happen?
MCP server deduplication should consider env vars as part of server identity. Two servers with identical command/args but different env configurations are NOT duplicates — they serve different purposes (different target URLs, different credentials, different access modes).
Error Messages/Logs
Steps to Reproduce
- Create a single plugin with an
.mcp.jsondefining two Storybook MCP servers using the same package but pointing at different Storybook instances:
``json``
{
"mcpServers": {
"ui5-storybook": {
"command": "npx",
"args": ["-y", "storybook-mcp@latest"],
"env": {
"STORYBOOK_URL": "https://ui5.github.io/webcomponents-react/v2/index.json"
}
},
"project-storybook": {
"command": "npx",
"args": ["-y", "storybook-mcp@latest"],
"env": {
"STORYBOOK_URL": "http://localhost:6006/index.json"
}
}
}
}
Simillary, you can create 2 plugins, each using storybook mcp with different storybook server sources.
- Start Claude Code
Expected: Both ui5-storybook and project-storybook load — they target completely different Storybook instances (external component library vs local project storybook). This is a common pattern for frontend plugins that need to reference both a design system and a project-specific storybook.
Actual: Only ui5-storybook loads. project-storybook is suppressed as a "duplicate" because the command+args are identical, even though the STORYBOOK_URL env var points to a completely different server.
Claude Model
Not sure / Multiple models
Is this a regression?
Yes, this worked in a previous version
Last Working Version
2.1.69
Claude Code Version
2.1.71
Platform
Anthropic API
Operating System
macOS
Terminal/Shell
Terminal.app (macOS)
Additional Information
Real-World Impact
In our internal plugin marketplace (6 plugins, 4 teams), this suppresses ~12 MCP server instances across 3 packages. We are using different jira servers, different gitlabs, different storybooks at the same time.
This is not an edge case. It is very common and expected to have multiple instances of the same MCP package within a single plugin - e.g. a frontend plugin connecting to 2-3 Storybook instances (component library, project
storybook, design system), or a project plugin connecting to multiple GitLab instances (production gitlab, tools gitlab, legacy gitlab), or multiple plugins from one marketplace that uses multiple instances of one mcp with different configuration. The current deduplication makes this pattern impossible, even though the servers are completely independent with different target URLs and credentials.
Suggested Fix
Include env in the deduplication key. A server should only be considered a duplicate if command + args + env all match. Alternatively, provide an opt-out mechanism (e.g. "deduplicate": false in the plugin/marketplace config).
This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗