# Add an email inbox to Codex over MCP

> Add the Trotta Mail MCP server to Codex, in the CLI or the IDE extension, by sign-in or API key. The tools Codex gets and the mail it never sees.

Source: https://trotta.email/integrations/codex

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 November 20, 2026

## 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](https://trotta.email/docs/mcp) 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

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:

```bash
codex mcp add trotta --url https://api.trotta.email/mcp
```

Step 2: sign in:

```bash
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:

```bash
codex mcp add trotta --url https://api.trotta.email/mcp --bearer-token-env-var TROTTA_MAIL_API_KEY
```

`~/.codex/config.toml`:

```bash
[mcp_servers.trotta]
url = "https://api.trotta.email/mcp"
bearer_token_env_var = "TROTTA_MAIL_API_KEY"
```

These steps follow the [Codex docs](https://learn.chatgpt.com/docs/extend/mcp), checked on 2026-11-20. For the assistant on the web, see [ChatGPT](https://trotta.email/integrations/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](https://trotta.email/threats/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

- [Codex docs: Model Context Protocol](https://learn.chatgpt.com/docs/extend/mcp)
- [Codex docs: command reference (codex mcp add)](https://learn.chatgpt.com/docs/developer-commands)
- [Trotta Mail guide for agents (llms.txt)](https://api.trotta.email/llms.txt)

## Related

- [Connect ChatGPT and Claude](https://trotta.email/docs/connect) Docs
- [MCP](https://trotta.email/docs/mcp) Docs
- [An email MCP server for any MCP client](https://trotta.email/integrations/mcp) Integrations
- [MCP email server](https://trotta.email/learn/mcp-email-server) Guides
- [Give Claude Code an email inbox over MCP](https://trotta.email/integrations/claude-code) Integrations
- [Prompt injection by email](https://trotta.email/threats/prompt-injection-by-email) Threat library

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

[Get an inbox](https://trotta.email/signup) [Read the docs](https://trotta.email/docs)
