MCP Galaxy / Good to Know / Configuring MCP Servers
★ Quick-start 4 Clients Reference JSON / TOML

Configuring MCP Servers

A practical guide to setting up Model Context Protocol (MCP) servers in the four most common AI coding tools, Claude Desktop, Claude Code, Gemini CLI, and Codex , and understanding how each one decides what's available where.

Clients
Desktop · Code · Gemini · Codex
Formats
JSON · TOML
Scope
Quick-start
01, Basics

What MCP Is

MCP (Model Context Protocol) is an open standard that lets AI assistants talk to external tools, data sources, and services through a single, consistent interface. Instead of each AI tool inventing its own way to read your files, query your database, or post to Slack, they all speak MCP.

The vocabulary you'll see throughout this guide:

  • MCP server, a small program that exposes capabilities (like "read GitHub issues" or "query Postgres") to an AI tool. The AI tool is the client; the server provides the tools.
  • Transport, how the client and server talk to each other. The two common ones are stdio (the server runs as a local process on your machine; messages flow over stdin/stdout, best for local tools and CLIs) and HTTP (the server runs somewhere reachable over the network, often a hosted service, best for cloud services and team-shared servers). You may still see SSE in older docs; it's being phased out in favor of HTTP, use HTTP for new setups.
  • Scope, which projects, users, or machines a given MCP server is available to. This is where each tool diverges.

If you've never set up an MCP server before, you don't need to read every section below. Jump to the tool you're actually using and start there.

02, Tools Covered

The Four Most Common, One Paragraph Each

These four are the most common MCP-capable AI tools today, and the ones this guide walks through step by step. Other MCP clients exist, Cursor, Zed, custom in-house apps, and more, and the protocol is open, so the list grows. Most of them read MCP server config from a JSON or TOML file in a similar shape to what you'll see below, so the scoping rules and gotchas in this guide carry over even when the surrounding details differ.

A
Claude Desktop
Anthropic's desktop chat app for macOS and Windows. It's the "GUI" Claude, you chat with it in a window, and MCP servers extend what it can do on your machine.
B
Claude Code
Anthropic's command-line coding assistant. Runs in your terminal, reads your codebase, and uses MCP servers to reach things outside the repo (databases, ticket trackers, browsers).
C
Gemini CLI
Google's open-source command-line agent for the Gemini models. Like Claude Code, it lives in the terminal and uses MCP for external tools.
D
Codex
OpenAI's coding agent. Ships as both a CLI and an IDE extension; the two share a single configuration file.
03, Configuration

Adding a Server in Each Tool

Claude Desktop

Reads MCP servers from a single JSON file. Three ways to edit it: the in-app menu, the file directly, or via the Extensions marketplace.

Option 1, in-app shortcut (easiest). Open Claude Desktop, go to Settings → Developer → Edit Config. This opens the config file in your default editor and creates it if it doesn't exist. Add your server, save, and fully quit and reopen Claude Desktop (not just close the window).

Option 2, edit the file directly. The config lives at:

OSPath
macOS~/Library/Application Support/Claude/claude_desktop_config.json
Windows%APPDATA%\Claude\claude_desktop_config.json
Linux~/.config/Claude/claude_desktop_config.json

A minimal example that gives Claude Desktop access to your Desktop and Downloads folders:

claude_desktop_config.json
{
  "mcpServers": {
    "filesystem": {
      "command": "npx",
      "args": [
        "-y",
        "@modelcontextprotocol/server-filesystem",
        "/Users/you/Desktop",
        "/Users/you/Downloads"
      ]
    }
  }
}

Restart the app. If everything worked, the new tools appear in the chat input area.

Option 3, Desktop Extensions. Claude Desktop also supports packaged MCP servers distributed as .mcpb files. They install with a double-click from the in-app Extensions marketplace, no JSON editing required. Good for non-technical users; the JSON method is better when you need custom servers or full control.

Tip for beginners. JSON is picky. A missing comma will make the whole file invalid and Claude Desktop will silently load nothing. If your servers don't show up, paste the file into a JSON validator before debugging anything else.
Claude Code

CLI-driven, so you'll mostly use the claude mcp command family rather than editing files by hand.

Add a local (stdio) server
$ claude mcp add my-database -- \
    npx -y @modelcontextprotocol/server-postgres postgresql://localhost/mydb
Add a remote (HTTP) server
$ claude mcp add --transport http craft https://mcp.craft.do/my/mcp
Pass environment variables
$ claude mcp add my-server \
    -e API_KEY=sk-abc123 \
    -e DATABASE_URL=postgres://localhost/db \
    -- node /path/to/server.js
Add from a raw JSON blob (useful when copy-pasting from docs)
$ claude mcp add-json weather-api '{"type":"http","url":"https://api.weather.com/mcp","headers":{"Authorization":"Bearer token"}}'
Manage your servers
$ claude mcp list              # show all configured servers
$ claude mcp get my-server     # show details for one
$ claude mcp remove my-server  # delete it

Inside an active Claude Code session, type /mcp to see status and handle OAuth logins for servers that need them.

Flag ordering. All Claude Code flags (--transport, --scope, --env, --header) must come before the server name. The -- separates Claude's flags from the command that gets passed to the MCP server itself.
Gemini CLI

Same pattern as Claude Code, with a different command name and a different file.

Add a server
$ gemini mcp add my-server -- /path/to/server arg1 arg2

Useful flags:

  • -s, --scope, user or project (see scoping section below).
  • -H, --header, HTTP headers, e.g. -H "Authorization: Bearer abc123".
  • --timeout, connection timeout in milliseconds.
  • --trust, skip tool-call confirmation prompts (use carefully).
  • --include-tools / --exclude-tools, allow/deny specific tools from a server.
  • --description, a short description for your own reference.

Or edit the JSON directly. Gemini CLI reads from ~/.gemini/settings.json (user) or .gemini/settings.json (project). The block looks like this:

~/.gemini/settings.json
{
  "mcpServers": {
    "git": {
      "command": "uvx",
      "args": ["mcp-server-git"]
    },
    "github": {
      "httpUrl": "https://api.githubcopilot.com/mcp/",
      "headers": {
        "Authorization": "Bearer YOUR_GITHUB_TOKEN"
      },
      "timeout": 5000
    }
  }
}

Environment variables in the env block are expanded automatically, you can reference ${VAR} and Gemini CLI will substitute from your shell environment. Inside a session, /mcp lists everything that connected successfully.

Codex

Uses TOML, not JSON, and the CLI and IDE extension share a single config file. This is convenient, configure once, use everywhere, but a syntax error breaks both.

Add a server via the CLI
$ codex mcp add context7 -- npx -y @upstash/context7-mcp
Add one with environment variables
$ codex mcp add my-server --env API_KEY=xyz -- /path/to/server

Or edit ~/.codex/config.toml directly:

~/.codex/config.toml
[mcp_servers.tooluniverse]
command = "uvx"
args = ["--refresh", "tooluniverse"]

[mcp_servers.tooluniverse.env]
PYTHONIOENCODING = "utf-8"

Open the config from the IDE extension: click the gear icon → Codex Settings → Open config.toml.

Manage your servers
$ codex mcp list      # show all servers
$ codex mcp get NAME  # show one
$ codex mcp remove NAME
$ codex mcp login NAME   # OAuth login for HTTP servers that need it
$ codex mcp logout NAME

Inside a TUI session, /mcp shows the active servers.

Beginner gotcha. Codex won't create the config file for you. If ~/.codex/config.toml doesn't exist, you need to create it yourself (or let codex mcp add create it on first use). Many people hit "my server isn't loading" simply because they put their TOML under the wrong section header, make sure it's [mcp_servers.NAME], not [mcp.servers.NAME] or any other variation.
04, Scoping

Where Each Tool Makes a Server Available

"Scope" answers a simple question: when I add a server, who and where is it available to? The four tools answer this very differently.

Claude Desktop, one scope, period

There's only one scope: the user, on this machine. Every server in claude_desktop_config.json is global to that user's Claude Desktop install. No per-project setup, no team-shared file. If you want a colleague to have the same server, you send them the config and they paste it into theirs.

Claude Code, three scopes, with a precedence order
ScopeWhat it meansWhere it livesShared?
local (default)Available only to you, only in this project.~/.claude.json (keyed by project path)No
projectAvailable to anyone who clones the repo..mcp.json at the project rootYes, commit to git
userAvailable to you across all your projects.~/.claude.jsonNo (per machine)

Set the scope when adding:

Set scope explicitly
$ claude mcp add --scope project shared-db -- npx -y my-db-server
$ claude mcp add --scope user my-personal-tool -- node /path/to/tool.js

Precedence when names collide: local > project > user. So a local-scope server with the same name as a project one will win for you, without affecting your teammates.

Project scope is gated by trust. When you clone a repo with a .mcp.json file, Claude Code won't silently start running other people's servers, it shows them as ⏸ Pending approval until you accept the workspace trust dialog. This is the right default; review what's in .mcp.json before approving.

Practical rule of thumb: personal tools you use everywhere → user. Project-specific servers your team should all have → project (and commit .mcp.json). Experiments and personal credentials for one repo → local (the default).
Gemini CLI, two scopes

Simpler: just user and project (sometimes called "workspace").

ScopeFile
User~/.gemini/settings.json
Project.gemini/settings.json in the project root

Set the scope when adding:

Set scope explicitly
$ gemini mcp add --scope user my-tool -- /path/to/tool
$ gemini mcp add --scope project team-tool -- /path/to/team-tool

When the same server name appears in both, project overrides user for that workspace.

Codex, layered config with profiles and overrides

The richest model. There are two places MCP servers can live, plus a layering system that affects all config (not just MCP):

LayerFileNotes
User~/.codex/config.tomlYour personal defaults.
Project.codex/config.tomlOnly loaded if the project is trusted.
Profile~/.codex/profile-name.config.tomlNamed presets, selected with --profile.
CLI overrides--config key=value flagsOne-shot, highest precedence.

Resolution order (highest precedence wins): CLI overrides → project config (closest to current directory wins if there are multiple) → profile → user config.

Two important Codex-specific caveats: (1) Trust matters. If you haven't marked a project as trusted, Codex skips its .codex/config.toml entirely, a security feature that prevents a malicious repo from silently injecting MCP servers. (2) Some keys are user-only. Codex deliberately ignores certain keys (provider settings, telemetry, notifications) when they appear in a project-local .codex/config.toml, and prints a warning on startup. MCP servers themselves work fine in project config; this restriction is mainly about who controls the model and where data goes.
05, Side-by-side

All Four Tools Compared

Feature Claude Desktop Claude Code Gemini CLI Codex
Config format JSON JSON JSON TOML
Main config file claude_desktop_config.json (OS app-support dir) ~/.claude.json & .mcp.json ~/.gemini/settings.json & .gemini/settings.json ~/.codex/config.toml & .codex/config.toml
CLI for managing servers No (GUI only) claude mcp … gemini mcp … codex mcp …
Number of scopes 1 3 (local, project, user) 2 (user, project) 2 base + profiles + CLI overrides
Team-shared, in-repo config No Yes, .mcp.json Yes, .gemini/settings.json Yes, .codex/config.toml (trust required)
Trust gate on project config N/A Yes (approval dialog) No Yes (project must be trusted)
Precedence on name collision N/A local > project > user project overrides user CLI > project > profile > user
stdio transport Yes Yes Yes Yes
HTTP transport Yes Yes Yes Yes
In-session status command Hammer icon in input /mcp /mcp /mcp
06, Decision Guide

Which Scope Should I Use?

I want this server in every project on my laptop

Claude Code: --scope user. Gemini CLI: --scope user. Codex: user config (~/.codex/config.toml). Claude Desktop: it's already the only scope, so just add it.

I want my whole team to have this server when they clone the repo

Claude Code: --scope project, commit .mcp.json. Gemini CLI: --scope project, commit .gemini/settings.json. Codex: commit .codex/config.toml. Never commit API keys, use environment variable references (${API_KEY}) and document which variables team members need to set.

I'm experimenting and don't want it polluting other projects

Claude Code: default local scope. Gemini CLI / Codex: project scope (and .gitignore the file if you don't want to commit it).

I want different sets of servers for different kinds of work

Codex profiles are purpose-built for this. The other tools achieve the same effect with project-scoped configs in separate directories.

07, Gotchas

Things That Catch Everyone At Least Once

  • JSON syntax errors silently disable everything. A single missing comma in claude_desktop_config.json or a Gemini CLI settings.json means zero servers load and the tool won't always tell you why. Validate first.
  • Paths must be absolute. Don't write Desktop, write /Users/you/Desktop (or C:\Users\you\Desktop on Windows). Relative paths rarely resolve the way you expect.
  • Restart the app, don't just close the window. Claude Desktop in particular needs a full quit-and-relaunch to reload config changes.
  • SSE is deprecated. If a guide tells you to use --transport sse, prefer --transport http for new setups unless the server only supports SSE.
  • Each MCP server is a separate subprocess. Three to five servers is fine. Twenty is a problem, they slow startup, eat memory, and inflate the model's tool list (which actually hurts accuracy, because the model has to consider every tool on every turn). Install what you actually use.
  • Secrets don't belong in committed files. When using project scope, reference secrets via environment variables (${API_KEY} or ${API_KEY:-default}), put real values in a .env file, and add that file to .gitignore.
  • local and user scopes don't sync across machines. Only project scope (which lives in a file you can commit) gives you that. If you set up a beautiful tool collection on your laptop, your desktop won't see it unless you copy the config over or move things into project scope.
08, Further Reading

Official Docs

The official documentation for each tool is the most authoritative source if anything in this guide ever drifts out of date: