Free toolGenerate .mcp.json configs for Claude Code, Cursor & Codex →

Based on each vendor’s official docs, checked

How to add an MCP server: Claude Code, Codex, Cursor, Copilot and Antigravity

Every major coding agent speaks the Model Context Protocol, but each one adds servers differently: some have a CLI command, some a JSON or TOML file, some a marketplace button. The current MCP specification is revision 2026-07-28, and it is stateless, with no initialize handshake and no session header. This page maps the first step in each agent and the full setup in detail, taken from the official docs and checked November 23, 2026.

  1. 1. Claude Code

    Use claude mcp add. Remote servers take --transport http and a URL; project servers are shared in .mcp.json and user servers live in ~/.claude.json. Each add writes to local scope unless you pass --scope project or --scope user. Sign in to OAuth servers from /mcp. To keep a token off the command line, use claude mcp add-json with a dash to read server JSON from stdin. Details: Claude Code setup in detail below.

    claude mcp add --transport http notion https://mcp.notion.com/mcp
  2. 2. OpenAI Codex

    Use codex mcp add, with the server command after a double dash, or --url for a remote server. Codex stores servers in ~/.codex/config.toml (or .codex/config.toml in a trusted project), shared by the CLI, IDE extension and desktop app. Run codex mcp login for OAuth. Details: Codex setup in detail below.

    codex mcp add context7 -- npx -y @upstash/context7-mcp
  3. 3. Cursor

    Click Add to Cursor on a Cursor Marketplace entry, use the Customize page, or edit .cursor/mcp.json (project) or ~/.cursor/mcp.json (global) under an mcpServers key. A stdio server entry needs a type field. In Cursor 3.30, released November 12, 2026, the agent finds MCP tools by words in their descriptions, and interactive MCP Apps can call tools on their own server without an approval prompt. Details: Cursor setup in detail below.

  4. 4. GitHub Copilot

    In VS Code, use the guided add flow or an mcp.json file such as .vscode/mcp.json. In Copilot CLI, run /mcp add or copilot mcp add; servers go to ~/.copilot/mcp-config.json, or .mcp.json or .github/mcp.json in a repository. Copilot CLI does not read .vscode/mcp.json. GitHub also offers Copilot connectors, GitHub-verified MCP servers in public preview: connect once in one surface and reuse it across Copilot surfaces. Details: Copilot setup in detail below.

  5. 5. Google Antigravity

    In the Antigravity app, go to Customizations, Installed, MCP Servers, then Add MCP Server, or type /mcp in the CLI. Custom servers go in mcp_config.json (global, or .agents/mcp_config.json per workspace), with serverUrl for remote servers. Tools load lazily by default; set eager to true for a tool to register its full schema upfront. Details: Antigravity setup in detail below.

Claude Code setup in detail

Claude Code reads servers from two places: project servers in .mcp.json at the project root, shared with the team, and user servers in ~/.claude.json for your own machine. Remote servers take --transport http and a URL; local servers take a command. A JSON entry with a url but no type is a configuration error, because Claude Code reads it as a stdio server, so add "type": "http". Sign in to OAuth servers from /mcp, which also lists every connected server and its status. Run claude mcp logout <name> before claude mcp remove <name> to revoke tokens at the authorization server.

claude mcp add --transport http notion https://mcp.notion.com/mcp

To check a server works, open /mcp inside a session and look for a connected status. If a server fails to start, the same panel shows the error. Keep secrets in environment variables, not in a committed .mcp.json file.

In Claude Code 2.1.327, released November 17, 2026, claude mcp add-json <name> - reads server JSON from stdin, so a token does not appear on the command line or in shell history. It cannot be used inside a Claude Code session.

Codex setup in detail

Codex keeps servers in config.toml, shared by the CLI, the IDE extension and the desktop app, so you set a server up once. Put the server command after a double dash for a local server, or pass --url for a remote one. Pass environment variables with --env.

codex mcp add context7 -- npx -y @upstash/context7-mcp
codex mcp add example --url https://mcp.example.com

For servers that use OAuth, run codex mcp login <server-name>. Codex supports CIMD and dynamic client registration, and adds --oauth-client-id when a provider needs a pre-registered client. Check the connection with codex mcp list, or type /mcp in the Codex TUI. Manage servers with codex mcp get <name>, codex mcp remove <name> and codex mcp logout <name>. You can also edit the file directly: each server is a [mcp_servers.<name>] table in ~/.codex/config.toml, or .codex/config.toml in a trusted project.

[mcp_servers.context7]
command = "npx"
args = ["-y", "@upstash/context7-mcp"]

Use bearer_token_env_var or env_http_headers instead of hard-coding secrets. enabled_tools and disabled_tools limit which tools a server exposes, and startup_timeout_sec (default 10) and tool_timeout_sec (default 60) help with slow servers. OpenAI notes that every MCP server adds context and uses more of your limit, so disable servers you are not using. Set a per-tool output limit with tools.<tool>.output_token_limit.

Cursor setup in detail

Cursor supports stdio, SSE and Streamable HTTP servers. The fastest path is the Marketplace: open Customize, browse the Cursor Marketplace and click Add to Cursor. Remote servers then ask you to authenticate with OAuth. For any other server, edit .cursor/mcp.json in your project, or ~/.cursor/mcp.json for every project, under an mcpServers key.

{
  "mcpServers": {
    "server-name": {
      "type": "stdio",
      "command": "npx",
      "args": ["-y", "mcp-server"],
      "env": { "API_KEY": "${env:API_KEY}" }
    }
  }
}

A remote server uses a url instead of a command. Add headers for token auth, or an auth block for providers that need a fixed OAuth client. Toggle the server in Customize to enable it; Agent uses MCP tools when relevant and asks for approval before running them by default. Use ${env:NAME}, ${workspaceFolder} and ${userHome} interpolation instead of hard-coding paths and secrets. envFile works for stdio servers only. If a server misbehaves, open the Output panel (Cmd+Shift+U) and choose MCP Logs to see connection, auth and crash errors.

In Cursor 3.30, released November 12, 2026, the agent finds MCP tools by words in their descriptions, and interactive MCP Apps can call tools on their own server without an approval prompt. Team admins can distribute shared MCP servers under Dashboard, Plugins and MCPs, and team MCP servers are available to Cloud Agents. Cloud Agents support HTTP and stdio servers, not SSE or mcp-remote.

GitHub Copilot setup in detail

In VS Code, open the Command Palette (Ctrl+Shift+P, or Cmd+Shift+P on macOS) and run MCP: Add Server. Choose HTTP if the publisher gives you a server URL, or Command (stdio) if it gives you a launch command. Pick an ID that is not already used, then choose where to store it: Global and then Copilot Global writes $COPILOT_HOME/mcp-config.json (or ~/.copilot/mcp-config.json), while a workspace destination shares the config with the project. You can also install from the MCP gallery by typing @mcp in the Extensions view search box.

The detail that trips people up: VS Code’s own mcp.json uses a top-level servers key, while the portable Copilot files use mcpServers. If you paste a Cursor or Claude Desktop snippet that starts with mcpServers into .vscode/mcp.json, rename the key to servers and add a type to each server.

{
  "servers": {
    "playwright": {
      "type": "stdio",
      "command": "npx",
      "args": ["-y", "@playwright/mcp@latest"]
    }
  }
}

A remote server uses "type": "http" and a url, plus headers for token auth. VS Code also accepts sse for older servers, and an oauth object when a provider needs a pre-registered OAuth client. In Copilot CLI, run /mcp add or copilot mcp add; servers go to ~/.copilot/mcp-config.json, or .mcp.json or .github/mcp.json in a repository. Copilot CLI does not read .vscode/mcp.json. Keep API keys out of the file with input variables: declare inputs and reference them as ${input:id}, and VS Code prompts for the value the first time the server starts. Review the trust and sign-in prompts, then open Chat in agent mode and check that the server’s tools are listed in the tools picker. MCP: List Servers shows each server with start, stop, restart and Show Output actions.

GitHub added eight Copilot connectors on November 18, 2026, for Box, Buildkite, Calendly, ClickUp, Mixpanel, Supabase, Webflow and Wix, bringing the total to 34. A service connected once in Copilot can be reused across Copilot surfaces without separate setup in each one. Find servers with /mcp search and the GitHub MCP Registry, and manage them with /mcp list, /mcp show, /mcp edit, /mcp delete, /mcp disable and /mcp enable.

Google Antigravity setup in detail

Antigravity reads MCP servers from an mcp_config.json file with a top-level mcpServers object, and every surface (the Antigravity app, the IDE and the CLI) can manage them. Install from the built-in MCP Store: in the IDE, click the menu at the top of the agent side panel and select MCP Servers, hover over a supported server, click Install and follow the prompts. In the app, go to Settings > Customizations > Installed MCP Servers and choose Add MCP. In the CLI, type /mcp to open the MCP Manager, which shows each server’s status and connection logs and can reload the configuration.

Global servers live in ~/.gemini/config/mcp_config.json. Project servers live in .agents/mcp_config.json in your workspace. A stdio server needs command (plus args and env); a remote server needs serverUrl. Remote servers use Streamable HTTP; the httpUrl field from Gemini CLI and legacy HTTP+SSE are not supported.

{
  "mcpServers": {
    "sqlite-explorer": {
      "command": "node",
      "args": ["/usr/local/bin/sqlite-mcp-server.js"],
      "env": { "SQLITE_DB_PATH": "/var/data/app.db" }
    },
    "my-remote-server": {
      "serverUrl": "https://api.example.com/mcp/",
      "headers": { "Authorization": "Bearer YOUR_API_TOKEN" }
    }
  }
}

For OAuth servers, Antigravity supports automatic OAuth with PKCE, CIMD and DCR. You can also open Agent settings, go to the Customizations tab and click Authenticate next to the server, finish sign-in in the browser, copy the authorization code, paste it back and click Submit. Tokens are stored in ~/.gemini/antigravity/mcp_oauth_tokens.json and refreshed automatically. Unconfigured MCP tools run in Ask mode, so Antigravity asks before each call. Add mcp() rules to your permissions to approve a single tool, a whole server or every MCP tool: mcp(server/tool), mcp(server/*) or mcp(*). Use "disabled": true to switch a server off without deleting it, and disabledTools to hide risky tools such as write or delete operations. Tools load lazily by default, with schemas cached on disk and read on demand; set "eager": true for a tool to register its full schema upfront, and timeoutSeconds sets the per-tool call timeout, 180 seconds by default. If a server fails to connect, open /mcp in the CLI (or MCP Servers in the IDE) to check its status and connection log, then reload.

Config formats at a glance

Claude Code, Cursor and Antigravity use JSON with an mcpServers key, but the file names differ. VS Code uses a servers key in mcp.json. Codex uses TOML tables in config.toml. A server block copied from one agent usually needs renaming or reformatting before another agent will read it.

Our MCP config generator writes the right file for each agent from one server definition.

The MCP specification in November 2026

The current MCP specification is revision 2026-07-28, and it is stateless, with no initialize handshake and no session header. Servers must implement server/discover to advertise their versions and capabilities. HTTP+SSE, Roots, Sampling, Logging and Dynamic Client Registration are deprecated in this revision; Dynamic Client Registration is deprecated in favor of Client ID Metadata Documents. MCP moved to a six-month release cycle on November 11, 2026, with the next revision targeted for March 30, 2027.

Before you add a server

Each connected server adds its tool descriptions to the agent’s context, and OpenAI’s Codex docs advise disabling servers you don’t need. Only install servers you trust, and prefer OAuth or environment variables over pasting tokens into a committed file.

Tips

Next steps

How to migrate from Gemini CLI to Antigravity CLI

→

Portable agent skills: one SKILL.md for every coding agent

→

Safe “always allow” rules for Claude Code and Codex CLI

→

GitHub Copilot CLI yolo mode: --allow-all and safer tool rules

→

Codex sandbox modes and approval policies explained

→

How to install Claude Code on macOS, Linux and Windows

→

How to install the OpenAI Codex CLI

→

Claude Code auto mode: what runs, what gets blocked, how to turn it off

→

Agent Skills moves to the Agentic AI Foundation: what changes

→

MCP security: the risks in MCP servers and how to lock them down

→

Claude Code in VS Code: install, shortcuts and CLI differences

→

What is AGENTS.md? The open instruction file for coding agents

→

Claude Code on Windows: native, WSL and common errors

→

Codex skills: create, install and use SKILL.md skills in Codex

→

GitHub Copilot CLI: install, sign in and start using it

→

Cursor Agent SDK: build, test and deploy agents as code

→

GPT-6.1 Terra in Codex and the API: setup, pricing and limits

→

MCP OAuth: connect a remote MCP server in Claude Code, Codex and Cursor

→

Codex config.toml: location, precedence and the settings to change

→

Codex on Windows: native sandbox setup, WSL and fixes

→

Antigravity CLI (agy): install, sign in, modes and commands

→

Google Antigravity on Windows: install, WSL, sandbox and fixes

→

GitHub Copilot coding agent (now cloud agent): how to use it

→

GitHub Copilot agent mode: how to use it in your IDE

→

Claude Code tips from Anthropic’s best practices

→

Claude Code with OpenRouter: setup, models and troubleshooting

→

Supabase RLS for AI-built apps: grants, policies and tests

→

Antigravity skills: create, store and run SKILL.md skills

→

Claude Code in JetBrains IDEs: install, connect and fix issues

→

GitHub Copilot skills: create, install and use agent skills

→

Claude Code subagents: create, configure and run them

→

Check which plugins, hooks and MCP servers your agent loads

→

Cursor rules examples: .mdc files for each rule type

→

Fix spawn npx ENOENT when starting an MCP server

→

CLAUDE.md examples: instructions your team can actually use

→

MCP connection closed: find why a server will not connect

→

Claude Fable 5.2: model choice, CursorBench and Pro week

→

MCP token usage: output limits and context cost

→

Cursor Auto mode and Cursor Router: Cost, Balance and Intelligence

→

Cursor Cloud Agents (formerly Background Agents): setup, access and limits

→

Gemini 4 Carbon in coding tools: API pricing, Cursor and CursorBench

→

MCP Apps: add interactive UI to an MCP server for Claude and Cursor

→

Frequently asked questions

No. Each agent reads its own file: .mcp.json for Claude Code, config.toml for Codex, .cursor/mcp.json for Cursor, mcp.json or ~/.copilot/mcp-config.json for Copilot, and mcp_config.json for Antigravity.

Sources