Skip to content

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:

.agentsmesh/mcp.json
{
"mcpServers": {
"github": {
"type": "stdio",
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-github"]
}
}
}

Then agentsmesh generate writes each tool’s native form:

ToolFileShape
Claude Code.mcp.jsonJSON, mcpServers
Cursor.cursor/mcp.jsonJSON, mcpServers
GitHub Copilot.vscode/mcp.jsonJSON, servers
Gemini CLI.gemini/settings.jsonJSON, mcpServers, alongside unrelated settings
Codex CLI.codex/config.tomlTOML, [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:

.codex/config.toml
[mcp_servers.github]
command = "npx"
args = ["-y", "@modelcontextprotocol/server-github"]

Adding a server

Edit the canonical file and regenerate:

Terminal window
agentsmesh generate

Or 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:

Terminal window
agentsmesh init --yes # imports every detected tool
agentsmesh import --from cursor # or one at a time

Servers 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:

Terminal window
agentsmesh check

See 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.