How to add MCP servers to the OpenAI Codex CLI — the [mcp_servers] tables in ~/.codex/config.toml, the codex mcp add command, and how to confirm tools loaded.
Run "codex mcp add <name> -- <command> [args...]", or add an [mcp_servers.<name>] table to ~/.codex/config.toml. Codex uses TOML, not JSON, so each server is its own table.
2
Set command, args, and env
Each server table takes a "command" string and an "args" array. Put secrets in a nested [mcp_servers.<name>.env] table rather than in the args.
3
Verify inside a session
Start Codex and run the /mcp command to list configured servers and their tools. If a server is missing, check the TOML syntax — a malformed table silently drops the entry.
One key, 100+ models — chat with any LLM and generate video, images, speech. Free trial at 370.ai.
0 0
Frequently Asked Questions
Run codex mcp add <name> -- <command> [args...], or add an [mcp_servers.<name>] table with command and args to ~/.codex/config.toml. Use /mcp inside Codex to confirm it loaded.