Skip to content

How to add an MCP server to Codex

Level 3: Connect AI to your tools. About 6 min. Checked on 19 November 2026.
Stage 3 of 4: Connect AI to your tools

In this lesson you'll add local and remote MCP servers to Codex once and use them in the CLI, the IDE extension and the ChatGPT desktop app.

You use Codex in the terminal in the morning and in your editor in the afternoon. The nice surprise: as of 19 November 2026, OpenAI's docs say the ChatGPT desktop app, the Codex CLI and the IDE extension share one MCP configuration. Add an MCP server once and it's there in all three.

Pick a servera publisher you trustAdd ita URL or a commandSign in or restartso tools loadTry, approveone small task
Adding a server, step by step. Pick a server you trust, add it to your app (a URL or a command), sign in or restart, then try a small task and approve the first tool call.

Add a server from the terminal

A local server, with everything after -- being the command that starts it:

codex mcp add context7 -- npx -y @upstash/context7-mcp

Keys go in with --env VAR=VALUE, once per key. A remote server that speaks Streamable HTTP:

codex mcp add example --url https://mcp.example.com

If the server uses OAuth, sign in with codex mcp login <server-name>. On a machine without a browser, add --no-browser, open the printed URL elsewhere and paste the full redirect URL back into the terminal.

Or edit config.toml

Codex keeps servers in ~/.codex/config.toml, one [mcp_servers.<name>] table each. A project can have its own .codex/config.toml, but only for projects you've marked as trusted.

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

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

Note bearer_token_env_var: the token itself stays in an environment variable, not in the file.

In the IDE extension

Open the gear menu, select MCP servers, then Add server. Enter a name, choose STDIO or Streamable HTTP, give the command or URL, save, and select Restart extension.

Check that it worked

Run codex mcp list in a shell, or type /mcp in the Codex interface (or in the ChatGPT desktop app's composer) to see your servers.

Servers developers use

MCP servers for developer tools from the directory, most popular first.

More for developer tools
  1. Official MCP server connecting AI assistants to GitHub repos, issues and workflows

    • Remote
    • Open source
    • 34.6K GitHub stars
    • Developer tools
  2. Python framework for building MCP servers, clients and interactive apps

    Not checked yet
    • Open source
    • 28.7K GitHub stars
    • Developer tools
  3. Local MCP server that builds a code knowledge graph for AI coding agents

    Runs locally
    • Open source
    • 48.8K GitHub stars
    • Knowledge and memory
  4. Local search engine for AI agents with cited answers over your code and docs

    Runs locally
    • Open source
    • 19.2K GitHub stars
    • Knowledge and memory
  5. CLI and MCP server that lets coding agents reverse engineer apps and binaries

    Runs locally
    • Open source
    • 468K GitHub stars
    • Developer tools

In short

  • codex mcp add <name> -- <command> for local servers; --url for remote ones.
  • One config in ~/.codex/config.toml, shared by the CLI, the IDE extension and the ChatGPT desktop app.
  • Keep tokens in environment variables with bearer_token_env_var.

What to try next

Share this lesson

Lesson 10 of 13 in this path

Words used in this lesson

Sources

Official documentation, checked on 19 November 2026. Products change: if a step differs, the source has the current version.

Get the next lesson

New Academy lessons are announced in the weekly AI-Powered email.