MCP servers persist in /mcp command despite removal via `claude mcp remove`
Issue Summary
After removing all MCP servers using claude mcp remove command, the /mcp slash command in Claude Code still shows MCP servers as available. This creates confusion as the CLI reports no configured servers while the interactive UI shows them.
Symptoms
- Successfully removed all MCP servers using:
``bash``
for server in posthog apify brave-search github retellai-mcp-server atlassian desktop-commander puppeteer hubspot smtp-email-server stripe n8n-workflows mcp-server-firecrawl; do
claude mcp remove "$server"
done
claude mcp listcorrectly reports: "No MCP servers configured. Useclaude mcp addto add a server."
- However,
/mcpcommand in Claude Code UI still lists all previously configured MCP servers
Root Cause Analysis
Investigation reveals that MCP server configurations are stored at multiple scopes within ~/.claude.json:
- Global scope (
mcpServersat root level) - Successfully cleared byclaude mcp remove - Project-specific scope (
projects.<path>.mcpServers) - NOT cleared byclaude mcp remove
The /mcp command appears to aggregate MCP servers from both global and project-specific configurations, while claude mcp remove only removes from the global scope.
Evidence
File: ~/.claude.json
Structure reveals project-specific MCP configurations persist after global removal:
{
"mcpServers": {}, // Successfully cleared by 'claude mcp remove'
"projects": {
"/Users/jet/Repositories/Templates/saas-template/SaaS-Boilerplate": {
"mcpServers": {
"posthog": { /* full config */ },
"apify": { /* full config */ },
// ... all 13 servers still configured here
}
},
"/Users/jet/prompts": {
"mcpServers": {
// ... duplicate set of all servers
}
}
}
}
Query results show 2 projects with persistent MCP configurations:
/Users/jet/Repositories/Templates/saas-template/SaaS-Boilerplate: 13 servers/Users/jet/prompts: 13 servers
Related Configuration Files
~/.claude.json- Main Claude Code configuration (341KB file with project-specific settings)~/.claude/mcp_config.json- Legacy/unused MCP configuration (successfully cleared)~/Library/Application Support/Claude/claude_desktop_config.json- Claude Desktop config (separate, working correctly)
Proposed Solutions
Option 1: Fix claude mcp remove command
Enhance the command to remove servers from all scopes:
- Global scope
- All project-specific scopes
- Add
--scopeflag:claude mcp remove <server> --scope all|global|project
Option 2: Add new command for project cleanup
claude mcp remove-all --include-projectsclaude mcp resetto clear all MCP configurations
Option 3: Fix /mcp command behavior
Make /mcp respect the same scope as claude mcp list for consistency
Workaround
Manual cleanup using jq:
# Remove all project-specific MCP servers
jq '.projects |= map_values(.mcpServers = {})' ~/.claude.json > ~/.claude.json.tmp && mv ~/.claude.json.tmp ~/.claude.json
Environment
- Claude Code version: (obtained via
/mcpcommand) - Platform: macOS Darwin 24.6.0
- Installation method: global npm
Impact
This inconsistency causes confusion when managing MCP servers, especially when trying to:
- Disable all MCP servers for security/performance reasons
- Separate Claude Code and Claude Desktop configurations
- Troubleshoot MCP-related issues
This issue has 7 comments on GitHub. Read the full discussion on GitHub ↗