with one click
setup-mcp
// Sync MCP server configuration across AI coding tools (Claude, Cursor, OpenCode, Copilot) from a single canonical .agents/mcp.json. Only invoke when the user asks to set up MCP, sync MCP servers, or add/remove MCP servers.
// Sync MCP server configuration across AI coding tools (Claude, Cursor, OpenCode, Copilot) from a single canonical .agents/mcp.json. Only invoke when the user asks to set up MCP, sync MCP servers, or add/remove MCP servers.
[HINT] Download the complete skill directory including SKILL.md and all related files
| name | setup-mcp |
| description | Sync MCP server configuration across AI coding tools (Claude, Cursor, OpenCode, Copilot) from a single canonical .agents/mcp.json. Only invoke when the user asks to set up MCP, sync MCP servers, or add/remove MCP servers. |
This skill manages MCP (Model Context Protocol) server configuration across multiple AI coding tools from a single canonical source. It ensures all tools share the same MCP servers without manual per-tool configuration.
| Tool | Project Config | Global Config | Top Key | Notes |
|---|---|---|---|---|
| Claude Code | .mcp.json | ~/.claude.json | mcpServers | Global embeds in larger config |
| Cursor | .cursor/mcp.json | ~/.cursor/mcp.json | mcpServers | |
| Open Code | opencode.json | ~/.config/opencode/opencode.json | mcp | local/remote types, environment key |
| GitHub Copilot | .vscode/mcp.json | (not supported) | servers | Global path is platform-specific |
The canonical config lives at:
.agents/mcp.json (in the repo root)~/.agents/mcp.jsonFormat matches Claude Code's .mcp.json schema:
{
"mcpServers": {
"server-name": {
"type": "stdio",
"command": "npx",
"args": ["-y", "some-mcp-package"],
"env": { "API_KEY": "value" },
"disabled": false
},
"remote-server": {
"type": "http",
"url": "https://mcp.example.com",
"headers": { "Authorization": "Bearer token" }
}
}
}
stdio (local process) or http/sse (remote)stdio servershttp/sse serverstrue to exclude from sync without removing the entry.agents/mcp.json or ~/.agents/mcp.json)mcpServers"disabled": true)The sync script is located at the skill directory. Run it with:
# Project scope (auto-detected if .agents/mcp.json exists in cwd)
python3 /path/to/setup-mcp/sync.py
# Explicit project scope with custom root
python3 /path/to/setup-mcp/sync.py --scope project --project-root /path/to/repo
# Global scope
python3 /path/to/setup-mcp/sync.py --scope global
# Non-interactive (skip gum selection, sync to all detected tools)
python3 /path/to/setup-mcp/sync.py --non-interactive
# Specific tools only
python3 /path/to/setup-mcp/sync.py --tools claude,cursor
When run interactively (default), the script uses gum to let the user select which tools to sync to. All detected tools are pre-selected.
| Flag | Description |
|---|---|
--scope project|global | Target scope (default: auto-detect) |
--project-root <path> | Project root directory (default: cwd) |
--tools <list> | Comma-separated tool IDs: claude, cursor, opencode, copilot |
--non-interactive | Skip interactive selection, sync to all detected tools |
When the user asks to add, remove, or sync MCP servers:
.agents/mcp.json (or ~/.agents/mcp.json)--non-interactive when running programmaticallyExample: user asks "add the filesystem MCP server to all my tools"
# 1. Create/edit canonical config
mkdir -p .agents
cat > .agents/mcp.json << 'EOF'
{
"mcpServers": {
"filesystem": {
"type": "stdio",
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-filesystem", "/path/to/dir"]
}
}
}
EOF
# 2. Run sync
python3 /path/to/setup-mcp/sync.py --scope project --non-interactive
The sync script preserves servers that were added directly to a tool's config (not via the canonical file). It tracks which servers it manages using a manifest file (.agents/.mcp-sync-manifest.json).
.cursor/mcp.json etc. are preservedThe script automatically handles format differences:
stdio becomes local, http/sse becomes remote, command+args merge into a single array, env becomes environmentmcpServers becomes servers, env is stripped (not supported)disabled field)