麦当劳
CLI工具,用于在编码代理之间共享MCP配置。
同步 模型上下文协议 服务器 定义跨越 VSCode, GitHub Copilot命令行界面, 克劳德代码, OpenAI 代码专家, 谷歌Gemini CLI,以及 OpenCode.
快速启动
随着 uv (推荐)
# Run directly with PEP 723 inline metadata
uv run mcpshare.py init # create default config
uv run mcpshare.py pull # pull servers from targets into master
uv run mcpshare.py sync # distribute master to all targets
uv run mcpshare.py status # show current state随着 uv tool install
# Install as a global CLI tool
uv tool install git+https://github.com/eggboy/mcpshare.git
# Then run from anywhere
mcpshare init
mcpshare pull
mcpshare sync
mcpshare status
# Upgrade to the latest version
uv tool upgrade mcpshare配置
配置文件位于 ~/.config/mcpshare/config.yaml:
source: /path/to/master # directory for the canonical mcp.json
mode: merge # merge | overwrite
targets:
claude:
path: ~/.claude
vscode:
path: ~/Library/Application Support/Code/User # macOS; see docs for other OS
copilot:
path: ~/.copilot
codex:
path: ~/.codex
gemini:
path: ~/.gemini
opencode:
path: ~/.config/opencode模式
| 模式 | 行为 |
|---|---|
merge | 首先从每个目标收集服务器,合并到主服务器,然后分发 |
overwrite | 使用主数据作为唯一的真实来源,覆盖所有目标 |
运作原理
mcpshare init–创建配置文件和主目录。mcpshare pull–从每个配置的MCP服务器条目中提取
目标并将其合并到主服务器中 mcp.json (仅收集,不收集 写回目标)。
mcpshare sync–分发主文件mcp.json所有已配置
目标,转换为每个工具的原生格式。
mcpshare status–显示主服务器以及每个目标是否
配置文件已存在。
典型工作流程: mcpshare pull → mcpshare sync.
禁用服务器
您可以禁用单个MCP服务器,而无需将其从主服务器中删除:
mcpshare disable # mark a server as disabled
mcpshare enable # re-enable a disabled server
mcpshare status # disabled servers show [disabled]开 mcpshare sync,每个目标对禁用服务器的处理方式不同:
| 目标 | 行为 |
|---|---|
| Copilot CLI | 写入 "disabled": true --Copilot本机跳过服务器 |
| 克劳德代码 | 写 "disabled": true --克劳德忽略了未知字段;使用 --disallowedTools 或 --strict-mcp-config 外部跳过 |
| VSCode | 剥离 disabled 字段(VSCode在其自己的UI中管理启用/禁用状态) |
| Codex | 写作 enabled = false --Codex列出了服务器,但不加载其工具 |
| 双子座,OpenCode | 剥离 disabled 现场 |
支持格式
| 工具 | 文件 | 顶级键 | 注释 |
|---|---|---|---|
| 克劳德代码 | mcp_servers.json | mcpServers | |
| VSCode | mcp.json | servers | 添加 "type": "stdio" |
| Copilot命令行界面 | mcp-config.json | mcpServers | 添加 "type": "stdio" |
| 食品法典委员会 | config.toml | [mcp_servers.*] | TOML格式 |
| Gemini CLI | settings.json | mcpServers | 保留非MCP设置 |
| OpenCode | opencode.json | mcp | 用途 command 阵列, environment |
发展
pip install -e .
pip install pytest
python -m pytest tests/ -v