Dev ToolsΒ·
intermediate
Β·8 min readΒ·Jul 10, 2026

OpenAI Codex MCP Documentation & Reference Guide (2026)

Official command reference, config.toml schema, and troubleshooting for OpenAI Codex CLI Model Context Protocol (MCP) integrations.

OpenAI CodexCodex MCPMCPReferenceconfig.tomlCLI
Interactive Tool
1-Click Export

Generate & Validate Multi-Client MCP Config

One-click export with environment variables & path locators for Claude Desktop, Cursor, Windsurf, and OpenAI Codex CLI.

Open in Generator

Codex MCP Reference Docs

This document serves as the complete reference for integrating the Model Context Protocol (MCP) with the OpenAI Codex CLI. It covers configuration schemas, command-line usage, and common troubleshooting steps.

Configuration Schema (config.toml)

The Codex CLI uses a TOML file for configuration. The MCP settings are nested under the mcpServers table.

Server Definition

Each server is defined as a sub-table of mcpServers (e.g., [mcpServers.my_server]).

KeyTypeRequiredDescription
commandStringYesThe executable command to run (e.g., npx, python, uvx).
argsArray of StringsNoA list of arguments to pass to the command.
envTableNoA table of key-value pairs representing environment variables to pass to the server process.

Example Schema

toml
[mcpServers.example]
command = "node"
args = ["/path/to/server.js", "--verbose"]

  [mcpServers.example.env]
  API_KEY = "your_secret_key"
  PORT = "8080"

Command Line Interface

The Codex CLI provides several commands for managing and interacting with your MCP servers.

codex mcp list

Lists all configured MCP servers and their current connection status.

Example Output:

code
SERVER NAME       STATUS       TOOLS AVAILABLE
filesystem        Connected    5
github            Failed       0
sqlite            Connected    2

codex mcp restart <server_name>

Restarts a specific MCP server. This is useful if a server crashes or if you have updated its configuration.

Example:

bash
codex mcp restart filesystem

codex mcp logs <server_name>

Tails the standard error (stderr) output of a specific MCP server, which is essential for debugging server-side issues.

Example:

bash
codex mcp logs github

Troubleshooting

Connection Refused / Server Failed to Start

Symptoms: codex mcp list shows a Failed status for a server.

Solutions:

  1. β–ΈCheck the executable: Ensure the command (e.g., npx, uvx) is installed and available in your system's PATH.
  2. β–ΈReview the logs: Run codex mcp logs <server_name> to see why the process crashed. Common reasons include missing dependencies or incorrect arguments.
  3. β–ΈVerify Node/Python versions: Some servers require specific versions of Node.js (e.g., v18+) or Python (e.g., 3.10+).

Missing Environment Variables

Symptoms: The server connects, but tool executions fail with authentication errors.

Solutions:

  1. β–ΈEnsure your API keys are correctly defined in the [mcpServers.<name>.env] section.
  2. β–ΈRemember that TOML tables must be defined in order. The env sub-table must appear after the main server properties.

Tools Not Appearing

Symptoms: The server connects, but Codex says it doesn't have access to the expected tools.

Solutions:

  1. β–ΈVerify that the server implementation correctly handles the tools/list JSON-RPC method.
  2. β–ΈTry restarting the server using codex mcp restart <name> to force the Codex CLI to re-fetch the tool list.
Ready to Deploy?

Build your full agent toolstack in the Visual Generator

Combine OpenAI Codex MCP Documentation & Reference Guide (2026) with databases, search APIs, and memory graphs in a single configuration file.

Customize in Generator

Related Guides