One mcp.json for Claude Code, Cursor, Codex and Gemini
The Model Context Protocol standardises how an agent talks to a server. It does not standardise where each tool expects that server to be declared, or under which key. Adding one server by hand today means editing four files in three shapes, and one of them is TOML.
The same server, five files
Declare it once:
{ "mcpServers": { "github": { "type": "stdio", "command": "npx", "args": ["-y", "@modelcontextprotocol/server-github"] } }}Then agentsmesh generate writes each tool’s native form:
| Tool | File | Shape |
|---|---|---|
| Claude Code | .mcp.json | JSON, mcpServers |
| Cursor | .cursor/mcp.json | JSON, mcpServers |
| GitHub Copilot | .vscode/mcp.json | JSON, servers |
| Gemini CLI | .gemini/settings.json | JSON, mcpServers, alongside unrelated settings |
| Codex CLI | .codex/config.toml | TOML, [mcp_servers.github] |
Two details in that table are the whole problem. Copilot uses servers where everyone else
uses mcpServers, so a copy-paste between the two silently defines nothing. And Codex reads
TOML, so there is no copy-paste at all:
[mcp_servers.github]command = "npx"args = ["-y", "@modelcontextprotocol/server-github"]Adding a server
Edit the canonical file and regenerate:
agentsmesh generateOr let an agent do it through the MCP server, which exposes
add_mcp_server and update_mcp_server so the config can be changed in conversation without
hand-editing five files.
Importing servers you already have
If your tools already carry MCP servers, pull them in rather than retyping:
agentsmesh init --yes # imports every detected toolagentsmesh import --from cursor # or one at a timeServers accumulate across sequential imports and merge by name, so importing Claude Code and then Cursor gives you the union rather than whichever ran last.
Keeping them honest
Because the five files are generated, they can drift the moment somebody edits one directly.
agentsmesh check fails the build when that happens:
agentsmesh checkSee the drift guide for the CI wiring, and the supported-tools matrix for which tools support MCP natively — 27 of the 33 AgentsMesh generates for, with the rest partial or absent.
Related
- MCP servers in canonical config — the file format in full
- AgentsMesh MCP server — let an agent edit the config itself