Guide

Add an MCP server to any AI coding agent: Claude Code, Cursor, Codex, Gemini CLI, VS Code and 8 more (2026)

Where does each AI coding agent keep its MCP server config, and what command adds a server?

Most agents read a JSON file with an mcpServers object: .cursor/mcp.json in Cursor, .mcp.json in Claude Code, .kiro/settings/mcp.json in Kiro, .factory/mcp.json in Factory Droid and .junie/mcp/mcp.json in Junie. The exceptions are VS Code (a servers key in .vscode/mcp.json), Codex ([mcp_servers.NAME] tables in ~/.codex/config.toml), OpenCode (an mcp key in opencode.json), Zed (context_servers in settings) and goose (extensions in config.yaml). Claude Code, Codex, Gemini CLI, Amp and Factory Droid also have an mcp add command.

Also in: 简体中文 · 日本語 · 한국어 · Español · Português (Brasil)

Coding agent settings change often

Get one email a week when a setting, flag or permission rule changes, checked against the vendor docs.

Quick answer: where the config goes in each agent

  • Claude Code: claude mcp add --transport http NAME URL for a remote server, or claude mcp add NAME -- COMMAND for a local one. Local scope is the default; --scope project writes a shared .mcp.json and --scope user makes the server available in all your projects.
  • Cursor: mcpServers in .cursor/mcp.json for one project, or ~/.cursor/mcp.json for every project.
  • OpenAI Codex: codex mcp add NAME -- COMMAND, or a [mcp_servers.NAME] table in ~/.codex/config.toml.
  • Gemini CLI: gemini mcp add NAME COMMAND, which writes to the project's .gemini/settings.json by default. Add -s user for ~/.gemini/settings.json.
  • VS Code (GitHub Copilot): a top-level servers object in .vscode/mcp.json, or the user profile file opened with MCP: Open User Configuration.
  • Copilot cloud agent on GitHub: repository Settings, then Copilot, then MCP servers. Paste JSON with an mcpServers object.
  • OpenCode: the top-level mcp key in opencode.json.
  • Cline: mcpServers in cline_mcp_settings.json. The CLI keeps it at ~/.cline/data/settings/cline_mcp_settings.json.
  • Amp: amp mcp add NAME -- COMMAND or amp mcp add NAME URL, or amp.mcpServers in ~/.config/amp/settings.json or .amp/settings.json.
  • Kiro: mcpServers in .kiro/settings/mcp.json (workspace) or ~/.kiro/settings/mcp.json (user).
  • Factory Droid: droid mcp add NAME URL_OR_COMMAND --type stdio|http|sse, saved to ~/.factory/mcp.json. Teams share servers in .factory/mcp.json.
  • Junie: mcpServers in .junie/mcp/mcp.json (project) or ~/.junie/mcp/mcp.json (user).
  • Zed: context_servers in your Zed settings file.
  • goose: extensions under the extensions key of ~/.config/goose/config.yaml, or goose configure, then Add Extension.

Local and remote entries look almost the same everywhere

A local server is a command that the agent starts on your machine and talks to over stdio. A remote server is a URL. In most JSON configs a local entry has command, args and env, and a remote entry has url and optional headers. Cursor, Kiro and Junie all accept this shape under mcpServers.

.cursor/mcp.json, .kiro/settings/mcp.json or .junie/mcp/mcp.json

{
  "mcpServers": {
    "context7": {
      "command": "npx",
      "args": ["-y", "@upstash/context7-mcp"]
    },
    "remote-server": {
      "url": "https://example.com/mcp",
      "headers": { "Authorization": "Bearer YOUR_TOKEN" }
    }
  }
}

Codex: ~/.codex/config.toml

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

[mcp_servers.figma]
url = "https://mcp.figma.com/mcp"

VS Code: .vscode/mcp.json

{
  "servers": {
    "github": {
      "type": "http",
      "url": "https://api.githubcopilot.com/mcp"
    }
  }
}

OpenCode: opencode.json

{
  "mcp": {
    "context7": {
      "type": "local",
      "command": ["npx", "-y", "@upstash/context7-mcp"]
    },
    "remote-server": {
      "type": "remote",
      "url": "https://example.com/mcp"
    }
  }
}

Gotchas when you copy a config from one agent to another

  • VS Code uses servers, not mcpServers, in .vscode/mcp.json. A file copied from Cursor needs that key renamed.
  • OpenCode wants type local or remote, and its command is a single array that includes the arguments.
  • Gemini CLI uses url for SSE servers and httpUrl for streamable HTTP servers.
  • Cline treats a remote entry with no type as legacy SSE. Set type to streamableHttp for the recommended transport.
  • Copilot cloud agent needs a tools array on every server (use ["*"] for all tools), and only secrets and variables whose names start with COPILOT_MCP_ reach the config.
  • Zed puts servers under context_servers, and a remote server with no Authorization header starts the standard MCP OAuth flow.
  • Codex is TOML, not JSON: one [mcp_servers.NAME] table per server.

Project config, approvals and auto-approve

  • Claude Code prompts for approval in interactive sessions before it uses project-scoped servers from .mcp.json.
  • Amp requires amp mcp approve NAME before a server in .amp/settings.json runs. Servers in your global settings do not need approval.
  • Kiro merges the workspace and user files, and workspace settings win. autoApprove lists tools that run without a prompt, and "*" approves all of them.
  • Gemini CLI: trust: true on a server bypasses all tool call confirmations for it. Use it only for servers you control.
  • Cline: the autoApprove array lists tools Cline can call without asking. Keep it to safe tools.
  • Factory Droid: servers added with droid mcp add go to your user config. Project servers in .factory/mcp.json cannot be removed with droid mcp remove, so edit the file.

Check that the server loaded

  • Claude Code: /mcp, which is also where you sign in to OAuth servers.
  • Codex: /mcp in the TUI shows active servers. codex mcp login NAME signs in to OAuth servers.
  • Gemini CLI: /mcp shows each server's connection status.
  • Factory Droid: /mcp opens the interactive manager.
  • Junie CLI: /mcp lists servers with their scope and status.
  • Amp: amp mcp doctor.

Full MCP setup guide for each agent

Get coding agent settings changes by email

When a setting, flag or permission rule in this guide changes, it goes in the weekly AgentAtlas update, checked against the vendor docs. One email a week.

Sources

Other guides

How to allow Cursor to run all commands: Run Everything, allowlist and sandboxHow to allow Claude Code to run all commands: permission modes, allow rules and skip permissionsClaude Code permissions: allow, ask and deny rules, rule syntax and allowed toolsCodex CLI: approval and sandbox modesGemini CLI: YOLO mode, auto_edit and allowing specific shell commandsCursor Privacy Mode: telemetry, training and data retentionClaude Code telemetry and data retention: what is sent and how to turn it offGemini CLI: turn off usage statistics and telemetryCLAUDE.md: where it goes, how it loads, and how it works with AGENTS.mdClaude Code hooks: format on save, block risky edits, get notifiedClaude Code subagents: create one, limit its tools, and call itAdd MCP servers to Cursor with mcp.json: Keep files out of Cursor with .cursorignore: Configure Codex with config.toml: Configure Gemini CLI with settings.json: Add MCP servers to Claude Code (claude mcp add, .mcp.json, scopes): Claude Code custom slash commands and skills (SKILL.md): GitHub Copilot custom instructions: Adding MCP servers to GitHub Copilot: Claude Code settings.json: file locations, precedence, and key settingsClaude Code plugins and marketplaces: install, create, and shareGemini CLI extensions and custom commands: Configuring OpenCode with opencode.json: Cline Rules: workspace, global, and conditional rulesKiro steering files: .kiro/steering, inclusion modes, and AGENTS.mdZed agent: instruction files, MCP servers, tool permissions, and ACP agentsCursor CLI: install, headless mode, permissions and CIAider: CONVENTIONS.md, .aider.conf.yml and API keysJunie guidelines, MCP and the Action Allowlist: Amp AGENTS.md, settings.json and MCP: Configure Goose extensions, hints, recipes and permissions: Customize OpenHands with skills, AGENTS.md, setup.sh and MCP: Configure Factory Droid CLI: AGENTS.md, settings.json, autonomy, custom droids and MCPConfigure Qwen Code: settings.json, providers, QWEN.md, MCP and approval modesCursor hooks: hooks.json, beforeShellExecution, afterFileEdit and exit codesCursor sandbox: sandbox.json, network allowlist and run modesCursor settings: settings.json, Cursor Settings and the ~/.cursor config filesCursor browser agent: @browser, browser automation and approval modesCursor subagents: .cursor/agents, frontmatter, built-in Explore and BrowserCursor telemetry and OpenTelemetry export (Privacy Mode, OTLP, Analytics API): Cursor rules setup: project, user and Team Rules, .mdc frontmatter, globs and AGENTS.mdClaude Code headless mode: claude -p, --output-format json, --bare and CI flagsClaude Code statusline: custom status bar in settings.json with context %, cost and git branchClaude Code /model: switch models, aliasesClaude Code /cost and /usage: check token spend, usage limits and reduce costsClaude Code VS Code extension: install, shortcuts, settings and /ideCodex AGENTS.md: global, project and override instruction files explainedCodex MCP servers: codex mcp add and [mcp_servers] in config.tomlCodex sandbox modes: read-only, workspace-write, danger-full-access and network accesscodex exec: run Codex non-interactively in scripts and CI with JSON outputCodex skills: create SKILL.md, skill folder locations and $skill invocationGEMINI.md in Gemini CLI: context file locations, imports and /memoryGemini CLI MCP servers: gemini mcp add and mcpServers in settings.jsonGemini CLI custom slash commands: TOML files, {{args}}, !{shell} and @{file}Gemini CLI headless mode: gemini -p, JSON output and exit codes for scripts and CIGemini CLI sandbox: enable Docker, Podman, macOS Seatbelt or gVisorcopilot-setup-steps.yml: set up the GitHub Copilot cloudGitHub Copilot CLI permissions: --allow-tool, --deny-tool, --allow-all-tools and trusted directoriesGitHub Copilot custom agents: .github/agents/*.agent.md profiles, tools and frontmatterGitHub Copilot code review settings: automatic PR reviews, rulesets, effort level and approvalsOpenCode MCP Server Setup: Local and Remote Servers in opencode.jsonOpenCode Permissions: Allow, Ask or Deny Bash, Edit and WebfetchOpenCode Custom Agents and Subagents: Markdown Files, Modes and @ MentionsCline MCP Setup: cline_mcp_settings.json for Local and Remote ServersCline Auto Approve and YOLO Mode: Run Commands and Edits Without PromptsCline Skills: SKILL.md Location, Format and Slash Command UseAmp MCP Setup: amp mcp add, amp.mcpServers and Workspace ApprovalAmp AGENTS.md: File Locations, @ Mentions and Glob-Scoped GuidanceAmp Skills: SKILL.md Folders, amp skill add and Search OrderKiro MCP Setup: .kiro/settings/mcp.json, autoApprove and OAuthKiro Hooks: .kiro/hooks JSON, PreToolUse, PostFileSave and StopKiro Permissions: permissions.yaml Allow, Ask and Deny RulesFactory Droid MCP Setup: droid mcp add, mcp.json Locations and /mcpFactory Droid Hooks: hooks.json, PreToolUse Matchers and Exit CodesFactory Droid Custom Droids (Subagents): .factory/droids Markdown FilesJunie MCP Setup: .junie/mcp/mcp.json for CLI and /mcp CommandJunie Brave Mode and Action Allowlist: Auto-Approve Commands in Junie CLIJunie Custom Slash Commands: .junie/commands Markdown Files and Argumentsgoose .goosehints and AGENTS.md: Global and Project Instructionsgoose Permission Modes: GOOSE_MODE auto, approve, smart_approve and chatgoose Recipes: recipe.yaml Format, Parameters and goose run --recipeZed Agent Tool Permissions: Auto-Approve Terminal Commands with tool_permissionsUse Claude, Codex and Gemini CLI in Zed: External Agents and agent_serversZed with Ollama, LM Studio and llama.cpp: Local Model Setup and Context LengthMCP 2026-07-28 Migration Guide: Stateless Protocol, No Sessions, server/discover, MRTR, and SDK v2 UpgradeSubagents and Custom Agents Compared: Claude Code vs Codex vs Cursor vs Gemini CLI vs GitHub CopilotAllow all commands in any AI coding agent: Cursor, Claude Code, Codex, Gemini CLI, Copilot CLI and 7 moreSettings file locations for every AI coding agent: Claude Code, Cursor, Codex, Gemini CLI, OpenCode, Qwen Code, Amp and Factory DroidRules and instruction files in every AI coding agent: .cursor/rules, CLAUDE.md, AGENTS.md, GEMINI.md, Copilot instructions and moreGemini CLI hooks: settings.json, BeforeTool, AfterTool, exit codes and /hooksGitHub Copilot hooks: .github/hooks/*.json for Copilot CLI and the cloud agentHooks in every AI coding agent: Claude Code, Cursor, Gemini CLI, GitHub Copilot, Kiro and Factory DroidAgent Skills (SKILL.md) in every AI coding agent: Claude Code, Codex, Cline, Amp and OpenHandsHow to deploy a remote MCP server (Streamable HTTP): Cloudflare Workers, Vercel, Railway and moreHeadless mode in every AI coding agent: claude -p, codex exec, gemini -p, Cursor agent -p and copilot -p for scripts and CIClaude Code sandbox: /sandbox, sandbox.enabled, allowedDomains, excludedCommands and strict modeSandbox modes in every AI coding agent: Claude Code, Cursor, Codex and Gemini CLI compared

Reviewed Oct 18, 2026. Settings change often; the linked vendor docs are the source of truth.