Direct mail API for developers and growth teams. Read the docs →

Codex MCP: add a remote server, sign in, and set approvals, with a direct mail API as the example

Codex MCP servers give OpenAI’s coding agent tools beyond your repo, such as a direct mail API that prints and mails postcards. A remote server is codex mcp add <name> --url <url>, then codex mcp login <name> to sign in; both write to config.toml, which the Codex CLI, the IDE extension and the ChatGPT desktop app all read. Below: adding a server, the config entry, approvals for tools that act, and what Mailr’s server does inside Codex.

On this page
  1. Add a remote MCP server to Codex
  2. Codex MCP in config.toml
  3. Approvals: which MCP tools Codex runs without asking
  4. Example: a direct mail API in a Codex session
  5. Codex MCP questions

Add a remote MCP server to Codex

terminal$ codex mcp add mailr --url https://mailr.dev/mcp$ codex mcp login mailr# signs you in with Mailr in the browser$ codex mcp list~/.codex/config.toml[mcp_servers.mailr]url = "https://mailr.dev/mcp"default_tools_approval_mode = "writes"
Add, then log in. 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 mailr

Codex MCP in config.toml

~/.codex/config.tomlCodex CLIIDE extensionChatGPT desktop app
Set it up once. The Codex CLI, the IDE extension and the ChatGPT desktop app read the same 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 = 120

Put 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_mode overrides it for one tool.
  • enabled_tools and disabled_tools decide 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_prices answers from your plan.
  • “Prepare the thank-you card for these new customers.” prepare_mail checks 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_prepared asks 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.

START SENDING

Put your first postcard in the mail

Create a key, send a test to yourself, and check the proof before anything prints.

Start sending
  • Postcards, flats and folded mailers
  • A proof before anything prints
  • Free test mode: nothing prints, nothing charges
  • A status for every piece

Free price sheet

Get the price sheet by email

Every postcard, letter, mailer and print product on every plan, with postage included.

We’ll email you the price sheet. By continuing you agree to the Terms and Privacy Policy.

Download the template kit?

mailr-kit.zip · about 310 KB · 59 text files

Only HTML, JSON and Markdown files. No programs, scripts or macros, nothing that installs or runs.