Give Codex an email inbox over MCP

Give Codex an inbox of its own by adding Trotta Mail as an MCP server. Run codex mcp add trotta --url https://api.trotta.email/mcp, then codex mcp login trotta. Codex can wait for mail, read verification codes, send and reply from the CLI or the IDE extension, and every message was screened before delivery.

Updated

What Codex can do with the inbox

Codex with an inbox can close the email step in a task: trigger a sign-up or a notification, wait for the message, read it and move on. The MCP docs list every tool.

ToolWhat it does
list_inboxesLists the inboxes the key can reach.
wait_for_messageWaits for the next delivered message, with filters such as has_code.
read_messageReads one message in the safe view.
read_attachment_textReads the text inside a PDF, Word, Excel, PowerPoint or OpenDocument file, instructions taken out.
send_messageSends a new message. With send_at, schedules it.
cancel_scheduled_messageStops a scheduled message. It goes back to drafts.
reply_to_messageReplies in the thread.
list_heldLists what is waiting on a human.

Set up Trotta Mail in Codex

Codex reaches https://api.trotta.email/mcp in one of two ways: you sign in with your Trotta Mail account, or Codex sends an API key. Use the URL exactly as written, with no slash at the end.

Sign in with Trotta Mail

  1. Add the server.
  2. Sign in with Trotta Mail. In the IDE extension, select Authenticate.
  3. Pick the inboxes Codex may use, and whether it may read, send or both. Then allow.
Step 1: add the server
codex mcp add trotta --url https://api.trotta.email/mcp
Step 2: sign in
codex mcp login trotta

Use an API key

  1. Put your key in the TROTTA_MAIL_API_KEY environment variable. Codex reads the key from your environment.
  2. Add the server.
  3. Or write it into ~/.codex/config.toml, which the CLI and the IDE extension share.
Step 2: add the server
codex mcp add trotta --url https://api.trotta.email/mcp --bearer-token-env-var TROTTA_MAIL_API_KEY
~/.codex/config.toml
[mcp_servers.trotta]
url = "https://api.trotta.email/mcp"
bearer_token_env_var = "TROTTA_MAIL_API_KEY"

These steps follow the Codex docs, checked on 2026-11-20. For the assistant on the web, see ChatGPT.

What Codex sees and what it never sees

Codex sees the safe view of every message: the content a human could see, with hidden text removed, instructions aimed at a model replaced by a note, and risky links defanged. Each message arrives with its verdict.

Codex never sees held mail. Dangerous mail is kept outside the inbox, and Codex learns that it exists and why, with no content, until a human releases it. In a human's own mailbox, login codes, password resets and sign-in links are sealed. In an inbox of its own, the codes Codex signs up with are its to read.

This matters more for an agent that can run code. A real-looking message can reach a human's everyday mailbox with an instruction inside, and read by Codex that is prompt injection by email. A Trotta Mail inbox screens mail before it is accepted. No filter catches everything, so uncertain mail waits for a human.

Three things to try

  • Create an account on staging with riley@trotta.email, wait for the verification email and finish the sign-up.
  • Read the PDF attached to the latest message in the inbox and list what it asks us to change.
  • Schedule an email to jordan@trotta.email for 9am tomorrow with the release notes from this branch.

Troubleshooting

  • The server answers 401. No token was sent, or the token is not good. Run codex mcp login trotta again, or check that TROTTA_MAIL_API_KEY is set in the environment Codex starts from.
  • The IDE extension asks you to sign in. Select Authenticate.
  • Sending answers 403 agent_drafts_only. The inbox is a human's own mailbox, where an agent starts with drafts. Use create_draft, or pick an agent inbox.

Questions

Does Trotta Mail for Codex work on the Free plan?

Yes. The Free plan is $0 with 2 inboxes and 1,000 emails a month. MCP and every check are on every plan.

Does the same setup work in the Codex CLI and the IDE extension?

Yes. The CLI and the IDE extension share ~/.codex/config.toml, so a server added in one is there in the other.

Where does Codex keep the Trotta Mail API key?

Codex reads the key from your environment. The config names the variable, TROTTA_MAIL_API_KEY, and the key itself stays out of the file.

Is Trotta Mail an OpenAI product?

No. Trotta Mail is an independent product that works with Codex as an MCP server. It is not made or endorsed by OpenAI.

Sources

Give your agent an inbox of its own. One call, or one minute in the console.