On this page
Add a remote MCP server to Codex
codex mcp add writes the server into config.toml; codex mcp login runs its OAuth sign-in separately.--url registers a streamable HTTP server. Adding it doesn’t sign you in: Codex can connect without credentials, so run codex mcp login as its own step, and it opens the service’s sign-in in your browser. For Mailr, that’s Sign in with Mailr, and the connection gets its own access, never your API keys. Inside the Codex terminal UI, /mcp shows what’s connected.
# Add a remote (streamable HTTP) server, then sign in to it.
codex mcp add mailr --url https://mailr.dev/mcp
codex mcp login mailr # add --no-browser on a machine without one
# See what's configured, inspect one, sign out, remove.
codex mcp list
codex mcp get mailr
codex mcp logout mailr
codex mcp remove mailrCodex MCP in config.toml
config.toml, so a server added in one shows up in the others. ChatGPT on the web doesn’t read it; there, servers are added as plugins.Every server is a [mcp_servers.<name>] table. A remote one needs only its url; the rest is optional:
# ~/.codex/config.toml (or .codex/config.toml in a trusted project)
[mcp_servers.mailr]
url = "https://mailr.dev/mcp"
# Ask before any tool that isn't marked read-only: sending mail, checking addresses.
default_tools_approval_mode = "writes"
# Optional: only expose the tools you want, and give slow calls more time.
enabled_tools = ["get_prices", "list_templates", "prepare_mail", "send_prepared", "get_mail", "list_mail"]
tool_timeout_sec = 120Put it in ~/.codex/config.toml for yourself, or in .codex/config.toml to keep it with one project; Codex reads project config only in projects you’ve marked as trusted.
Approvals: which MCP tools Codex runs without asking
default_tools_approval_mode = "writes"prompts for every tool the server doesn’t mark as read-only. For a server that can spend money, it’s the sensible default.tools.<tool>.approval_modeoverrides it for one tool.enabled_toolsanddisabled_toolsdecide which tools Codex sees at all.
Mailr marks its read-only tools, such as prices, templates, drafts and mail status, as read-only, and marks send_prepared and verify_addresses as tools that act. With writes, Codex checks prices and prepares drafts on its own and asks before it sends anything or checks addresses at a cost.
Example: a direct mail API in a Codex session
- “What would 1,000 6x9 postcards cost?”
get_pricesanswers from your plan. - “Prepare the thank-you card for these new customers.”
prepare_mailchecks the request and returns the total and a proof link; nothing is sent. - “Send it as a test.” Free, never printed, every proof in the dashboard.
- “Send it live.”
send_preparedasks first, and Mailr sends only the exact draft and total you approved, from your balance.
To have Codex build mail into your app instead, so your own code sends a postcard when something happens, use the skill and AGENTS.md section on the Codex integration page, with a prompt from the Codex mail templates. The same server works in Claude Code, in Cursor, in VS Code with GitHub Copilot, in Gemini CLI and the Gemini app and as one of the Claude connectors; how it’s built is in building a remote MCP server.
Codex MCP questions
How do I add an MCP server to Codex?
For a remote server, run codex mcp add <name> --url <url>, then codex mcp login <name> if it needs a sign-in. Or add a [mcp_servers.<name>] entry with its url to ~/.codex/config.toml.
Where does Codex keep MCP servers?
In config.toml: ~/.codex/config.toml for you, or .codex/config.toml in a project you've marked as trusted.
Do the Codex IDE extension and the ChatGPT desktop app share MCP servers?
Yes. The Codex CLI, the IDE extension and the ChatGPT desktop app read the same config.toml. ChatGPT on the web doesn't; there, MCP servers are added as plugins.
How do I stop Codex running a tool without asking?
Set default_tools_approval_mode for the server. writes prompts for every tool that isn't marked read-only, and tools.<tool>.approval_mode overrides it for a single tool.
Is Codex MCP the same as the Mailr skill for Codex?
No. The MCP server lets Codex price, proof and send mail during a session. The skill and AGENTS.md section teach Codex to write code in your app that calls the API on its own.