Feature Request: Programmatic API for enabling/disabling MCPs without restart

Resolved 💬 3 comments Opened Jan 29, 2026 by programadorEmerson Closed Feb 2, 2026

Problem

Currently, users can enable/disable MCP servers in two ways:

  1. Via /mcp interactive menu - Works without restart (hot-reload) ✅
  2. Via editing .claude.json - Requires Claude Code restart ❌

While the interactive menu is great for manual control, there's no programmatic way to toggle MCPs on/off without restarting, which limits automation capabilities.

Use Case

Users want to create custom skills/commands that can dynamically enable/disable MCPs based on context. For example:

  • Project-specific MCP profiles: Enable only relevant MCPs for a project type
  • Performance optimization: Disable heavy MCPs during specific tasks
  • Batch operations: Toggle multiple MCPs programmatically
  • Automated workflows: Enable/disable MCPs as part of a script or hook

Example desired workflow:

# Custom skill that prepares environment for frontend work
/setup-frontend
→ Disables: mysql, postgres, docker MCPs
→ Enables: playwright, browser, figma MCPs
→ No restart needed

Current Investigation

I've investigated the codebase structure and found:

What works:

  • .claude.json structure:

``json
{
"projects": {
"/path/to/project": {
"disabledMcpServers": ["context7", "slack"]
}
}
}
``

  • /mcp menu successfully modifies this structure AND triggers hot-reload
  • Skills can modify .claude.json but changes only apply after restart

What's missing:

  • No programmatic API to trigger the internal reload function that /mcp uses
  • Skills have no access to the runtime that manages MCP processes

Proposed Solution

Add one of the following:

Option 1: Expose MCP control via Bash tool commands

claude mcp enable context7
claude mcp disable slack
claude mcp reload  # Force reload config

Option 2: Add dedicated MCP control tool

Similar to existing tools (Read, Write, Bash), add:

  • MCPEnable(server_name)
  • MCPDisable(server_name)
  • MCPReload()

Option 3: Add skill-accessible IPC endpoint

Allow skills to send commands to Claude Code runtime:

# Skills could use this internally
echo '{"action":"mcp.disable","server":"context7"}' > ~/.claude/.runtime/commands.fifo

Benefits

  1. Automation: Users can create sophisticated workflows
  2. Context-aware: MCPs auto-enable/disable based on project
  3. Performance: Programmatically disable unused MCPs
  4. Developer experience: More powerful customization

Additional Context

  • Current behavior: Modifying .claude.json requires restart
  • Desired behavior: Programmatic changes apply immediately (like /mcp menu)
  • This would unlock powerful automation capabilities while maintaining the same UX as the interactive menu

Related

This would pair well with existing features:

  • Hooks (.claude/settings.json)
  • Custom commands (.claude/commands/)
  • Project-specific configs (.claude.json per project)

---

Would love to see this feature! It would significantly enhance Claude Code's automation and customization capabilities.

View original on GitHub ↗

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