Skip to content

Add 'claude mcp disable/enable' for persistent server toggling #30595

Description

@BlockSecCA

Problem

There's no way to persistently disable an MCP server without removing it entirely. The current options are:

  • /mcp disconnect — works mid-session but resets on next session start
  • claude mcp remove / add — persistent but destructive; loses config (env vars, args, transport settings)
  • disabledMcpServers in .claude.json — exists internally but has no CLI surface and is overridden by cloud-synced integrations

For users with several MCP servers that are useful across many repos (registered at user scope), there's no way to keep them installed but dormant until needed.

Proposed Solution

claude mcp disable <name>    # persists across sessions
claude mcp enable <name>     # re-enables without re-adding

This would write to the existing disabledMcpServers array in .claude.json — the mechanism already exists, it just lacks a CLI interface.

Ideally, the agent should also be able to invoke this programmatically (not just the interactive /mcp menu), so it can manage context budget autonomously.

Why This Matters

  • MCP tool definitions consume context tokens even when idle
  • ENABLE_TOOL_SEARCH helps with context cost but doesn't eliminate the server startup/connection overhead
  • Users who work across many repos can't scope servers to projects without duplicating config everywhere
  • Cloud-synced integrations (e.g., claude.ai Google Calendar) re-enable themselves even after being disabled in .claude.json

Current Workaround

ENABLE_TOOL_SEARCH=auto:5 defers tool schema loading, which mitigates the context cost but doesn't address the underlying control gap.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions