MCP切换工具

一款用于轻松启用或禁用编码代理的MCP(模型上下文协议)的CLI工具,无需本地配置文件。

  • by bnjdpn
  • Go
  • 本地部署
  • 更新于
在 GitHub 查看 bnjdpn/mcp-toggler

使用说明

mcp切换器

CLI GO可轻松启用/禁用编码代理的MCP(模型上下文协议), 没有本地配置文件。

快速启动

先决条件:Go 1.21+

go mod tidy
go build -o bin/mcp-toggler ./cmd/mcp-toggler
./bin/mcp-toggler

您还可以执行 ./mcp-toggler,如果存在,则启动本地二进制文件, 否则使用 go run ./cmd/mcp-toggler.

使用Makefile:

make tidy
make build
make run

安装全局

go install ./cmd/mcp-toggler@latest
mcp-toggler

用法

./bin/mcp-toggler
./bin/mcp-toggler detect
./bin/mcp-toggler mcps claude_code
./bin/mcp-toggler mcps --config ~/.codex/config.toml
./bin/mcp-toggler toggle claude_code mcp_global --on
./bin/mcp-toggler toggle --config ~/.codex/config.toml mcp_global --on
./bin/mcp-toggler interactive

配置

该工具通过已知配置路径自动检测代理和/或 路径上存在的二进制文件。MCP从块中提取 mcp 文件 JSON、TOML或YAML(自动格式检测)。

您可以使用以下方法针对特定文件: --config 如果代理未列出。

代理人文件

有关在何处启用MCP以及如何编辑其配置文件的有用参考:

  • 克劳德代码:https://docs.anthropic.com/en/docs/claude-code
  • OpenAI Codex CLI:https://github.com/openai/codex
  • Gemini CLI:https://github.com/google-gemini/gemini-cli

备注

默认路径是示例。在应用之前,请根据您的本地配置进行调整。