Feature Request: Programmatic API for enabling/disabling MCPs without restart
Problem
Currently, users can enable/disable MCP servers in two ways:
- Via
/mcpinteractive menu - Works without restart (hot-reload) ✅ - 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.jsonstructure:
``json``
{
"projects": {
"/path/to/project": {
"disabledMcpServers": ["context7", "slack"]
}
}
}
/mcpmenu successfully modifies this structure AND triggers hot-reload- Skills can modify
.claude.jsonbut changes only apply after restart
What's missing:
- No programmatic API to trigger the internal reload function that
/mcpuses - 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
- Automation: Users can create sophisticated workflows
- Context-aware: MCPs auto-enable/disable based on project
- Performance: Programmatically disable unused MCPs
- Developer experience: More powerful customization
Additional Context
- Current behavior: Modifying
.claude.jsonrequires restart - Desired behavior: Programmatic changes apply immediately (like
/mcpmenu) - 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.jsonper project)
---
Would love to see this feature! It would significantly enhance Claude Code's automation and customization capabilities.
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗