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.
| Tool | What it does |
|---|---|
list_inboxes | Lists the inboxes the key can reach. |
wait_for_message | Waits for the next delivered message, with filters such as has_code. |
read_message | Reads one message in the safe view. |
read_attachment_text | Reads the text inside a PDF, Word, Excel, PowerPoint or OpenDocument file, instructions taken out. |
send_message | Sends a new message. With send_at, schedules it. |
cancel_scheduled_message | Stops a scheduled message. It goes back to drafts. |
reply_to_message | Replies in the thread. |
list_held | Lists 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
- Add the server.
- Sign in with Trotta Mail. In the IDE extension, select Authenticate.
- Pick the inboxes Codex may use, and whether it may read, send or both. Then allow.
codex mcp add trotta --url https://api.trotta.email/ mcpcodex mcp login trottaUse an API key
- Put your key in the
TROTTA_MAIL_API_KEYenvironment variable. Codex reads the key from your environment. - Add the server.
- Or write it into
~/.codex/config.toml, which the CLI and the IDE extension share.
codex mcp add trotta --url https://api.trotta.email/ mcp --bearer-token-env-var TROTTA_MAIL_API_KEY[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 trottaagain, or check thatTROTTA_MAIL_API_KEYis 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. Usecreate_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.