MCP servers persist in /mcp command despite removal via `claude mcp remove`

Resolved 💬 7 comments Opened Sep 20, 2025 by crestonepeaks Closed Feb 5, 2026

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

  1. 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
``

  1. claude mcp list correctly reports: "No MCP servers configured. Use claude mcp add to add a server."
  1. However, /mcp command 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:

  1. Global scope (mcpServers at root level) - Successfully cleared by claude mcp remove
  2. Project-specific scope (projects.<path>.mcpServers) - NOT cleared by claude 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 --scope flag: claude mcp remove <server> --scope all|global|project

Option 2: Add new command for project cleanup

  • claude mcp remove-all --include-projects
  • claude mcp reset to 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 /mcp command)
  • 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

View original on GitHub ↗

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