claude-code icon indicating copy to clipboard operation
claude-code copied to clipboard

[Feature Request] Enable quick-toggle for MCP servers

Open kylesnowschwartz opened this issue 6 months ago • 1 comments

As a user of Claude Code who is often experimenting with my usage of the tool, I would like a way to quickly 'toggle' MCP servers on and off, so that I don't have to go through the claude mcp add and claude mcp remove everytime I want to make an adjustment to what's available to my user settings.

kylesnowschwartz avatar Jun 08 '25 00:06 kylesnowschwartz

perhaps with a per-tool toggles as well? I often only need a tool or two from an server, filtering out the rest would be nice

anuramat avatar Jun 09 '25 18:06 anuramat

It would be good to be able to assign mcp servers to subagents only and not need to pollute the main mode with all these tools that may only be required for special agents.

Benjoyo avatar Aug 04 '25 09:08 Benjoyo

I can see enabledMcpjsonServers and disabledMcpjsonServers config in ~/.claude.json. Perhaps use that for now?

joobisb avatar Aug 06 '25 06:08 joobisb

I can see enabledMcpjsonServers and disabledMcpjsonServers config in ~/.claude.json. Perhaps use that for now?

I think that is only per project setting. I don't see it in the global section.

gur111 avatar Aug 06 '25 14:08 gur111

any update on this?

adradr avatar Aug 25 '25 13:08 adradr

I just discovered that certain MCP servers consume large amounts of context in sessions where I don't plan to use them, it would be great if those could be left in a disabled state and then enabled "on-demand" when I actually need them.

mattshep avatar Aug 25 '25 14:08 mattshep

Also discovered MCP tools eat 30% of my context window. I use e.g. MCPs for bitbucket, Jira etc which I can have 90% of time disabled and enable onlyl when I specifically need. Would be awesome to not take the hassle of editing .json file or doing other workaround stuff but had option e.g. inside /mcp command to enable/disable the MCP.

ibru avatar Aug 26 '25 15:08 ibru

I made myself a small CLI tool with Claude here for this feature https://www.npmjs.com/package/claude-ext

jacobycwang avatar Aug 28 '25 04:08 jacobycwang

For the record, I've been using https://github.com/ravitemer/mcphub.nvim which has been a really pleasant way to toggle on and off MCPs and individual tools. Neovim specific, obviously, ideally this feature is native to Claude Code.

kylesnowschwartz avatar Aug 29 '25 04:08 kylesnowschwartz

I made myself a small CLI tool with Claude here for this feature https://www.npmjs.com/package/claude-ext

Good on you for using ✗ and ✓. I'm so tired of LLMs churning out emojis!

ariccio avatar Aug 30 '25 05:08 ariccio

It would be very useful to have MCP toggles that are independent from the general-purpose agent and other subagents. For example, I'd like to use the Supabase and Sentry MCPs with specific agents, without having them take up context or resources for my general agent. This way, the context window of my main agent remains clean, while I can selectively enable MCPs only where they're needed.

zoeytabmedia avatar Aug 31 '25 17:08 zoeytabmedia

Agree with @zoeytabmedia!

Current situation makes using a bunch of mcp servers not worth it. Eg. the Azure devops mcp server is huge context wise.

brmdbr avatar Sep 03 '25 14:09 brmdbr

You're absolutely right! lol

Although there's no command to do so, I just tested using disabledMcpjsonServers in my settings.local.json, and it worked perfectly. It works without regard to enableAllProjectMcpServers

nitromike502 avatar Sep 03 '25 14:09 nitromike502

This is a very important feature for me. I have a number of MCPs which accelerate my work, but I have to avoid using them because combined they consume too much context. I agree with @zoeytabmedia - per-agent MCPs make a lot of sense in this case.

chrischildresssg avatar Sep 03 '25 19:09 chrischildresssg

I made myself a small CLI tool with Claude here for this feature https://www.npmjs.com/package/claude-ext

Well done! Thanks for this! Will use until Claude gets their crap together and adds this simple feature built in... 🤦

advenimus avatar Sep 05 '25 20:09 advenimus

Community Solution: claude-ext with Project Server Support

I've implemented a solution for this MCP server management need via a community tool enhancement.

What I Built

Enhanced claude-ext (https://github.com/jacobycwang/claude-ext) to support both global and project-specific MCP servers:

Pull Request: https://github.com/jacobycwang/claude-ext/pull/2

Features Added

Unified MCP Server View: See all servers (global + project) in one interface ✅ Project Server Detection: Automatically finds .mcp.json files in current directory
Full Toggle Control: Enable/disable both global and project servers ✅ Smart Management:

  • Global servers: Toggle between active/disabled states
  • Project servers: Toggle between inactive/active-globally (copies to global config)
  • Project .mcp.json files are never modified (read-only source)

Usage

# Install enhanced version
npm install -g https://github.com/gvago/claude-ext.git

# Use in any project directory
claude-ext mcp

Example Output:

MCP Server Manager
Select which MCP servers should be active in Claude:

❯◉ ✓ archon (active)
 ◉ ✓ playwright (active) 
 ◉ ✓ shadcn-ui (active)
 ◯ 📁 supabase (project)    ← Now toggleable!

Benefits

  1. Complete MCP Visibility: See all servers across global and project configs
  2. Proper Boundaries: Project servers stay in .mcp.json, global config manages activation
  3. User Control: Toggle any MCP server on/off regardless of source
  4. Non-Destructive: Never modifies project-specific configurations

This addresses the core need for MCP server management while respecting Claude Code's architecture. Users get full control over which servers are active without breaking project-specific setups.

Technical Implementation

  • Detection: Reads .mcp.json from current working directory
  • Management: Copies project servers to global config when activated
  • UI: Visual distinction with folder icons for project servers
  • Safety: Project configurations remain untouched

Would love feedback from the Claude Code team on this approach! It bridges the gap between Claude Code's MCP architecture and user management needs.

gvago avatar Sep 10 '25 06:09 gvago

I have a slightly different approach than https://github.com/anthropics/claude-code/issues/1774#issuecomment-3273455792. Rather than global toggle, I use a per-session MCP server selection approach:

https://github.com/gsong/ccmcp

gsong avatar Sep 23 '25 16:09 gsong

Hope this is added soon! I feel MCPs aren't worth using otherwise since I only need them occasionally, so don't want them bloating my context window

djaddis avatar Oct 03 '25 15:10 djaddis

I just discovered the /doctor command and saw:

 Context Usage Warnings
 └ ⚠ Large MCP tools context (~101,475 tokens > 25,000)
   └ MCP servers:
     └ github: 104 tools (~71,781 tokens)
     └ serena: 18 tools (~14,319 tokens)
     └ playwright: 21 tools (~13,666 tokens)
     └ context7: 2 tools (~1,709 tokens)

I only installed the github MCP to give myself an easy way to post claude plans to github issues, but it's using 71K tokens!? In addition to giving a way to toggle MCPs on/off (and their individual tools), it would be great if there was a warning for MCPs that by themselves trigger the context usage warning (> 25,000).

ptmkenny avatar Oct 06 '25 01:10 ptmkenny

You're absolutely right! lol

Although there's no command to do so, I just tested using disabledMcpjsonServers in my settings.local.json, and it worked perfectly. It works without regard to enableAllProjectMcpServers

I tried using disabledMcpjsonServers and disabledMcpServers at the root setting level, and it didn't work.

On the other hand, when I use disabledMcpServers inside of a projects: { "some_folder" : { "disabledMcpServers": [...] .... it does work.

Is it supposed to work at a root level? Because that would be much nice

cartond avatar Oct 06 '25 18:10 cartond

It'd also be nice to be able to allow tools for subagents, but restrict for the main agent. Large context tools (like github) could then allowed only for a specific subagent, so it doesn't consume so much of the main agent's context.

I just discovered the /doctor command and saw:

 Context Usage Warnings
 └ ⚠ Large MCP tools context (~101,475 tokens > 25,000)
   └ MCP servers:
     └ github: 104 tools (~71,781 tokens)
     └ serena: 18 tools (~14,319 tokens)
     └ playwright: 21 tools (~13,666 tokens)
     └ context7: 2 tools (~1,709 tokens)

I only installed the github MCP to give myself an easy way to post claude plans to github issues, but it's using 71K tokens!? In addition to giving a way to toggle MCPs on/off (and their individual tools), it would be great if there was a warning for MCPs that by themselves trigger the context usage warning (> 25,000).

nitromike502 avatar Oct 07 '25 12:10 nitromike502

This issue should be closed, as it has been resolved with the release of Claude Code 2.0.10:

2.0.10

  • Rewrote terminal renderer for buttery smooth UI
  • Enable/disable MCP servers by @mentioning, or in /mcp
  • Added tab completion for shell commands in bash mode
  • PreToolUse hooks can now modify tool inputs
  • Press Ctrl-G to edit your prompt in your system's configured text editor
  • Fixes for bash permission checks with environment variables in the command

lukemmtt avatar Oct 10 '25 18:10 lukemmtt

This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.

github-actions[bot] avatar Oct 20 '25 14:10 github-actions[bot]