Skip to content

MCP serverCodex

Give Codex a Shipmail mailbox

Codex is OpenAI's coding agent, in the terminal and in your editor. Connect it to the Shipmail MCP server and it can read, draft and send email from a mailbox on your own domain. Use it to triage a support inbox from your terminal, answer a customer about the bug you just fixed, or send release notes when a branch ships.

Last updated

What you get

  • Shipmail tools in Codex: shipmail_list_mailbox_inbox_messages, shipmail_get_mailbox_inbox_thread, shipmail_create_inbox_reply_draft, shipmail_create_draft and, if the key allows it, shipmail_send_message.
  • A real mailbox you share with the agent. Replies land in the same conversation in Shipmail, where you can read them, edit a draft or answer yourself.
  • A connection you can cut by revoking one API key, with no password to change.

Create the mailbox and a scoped key

You need a Shipmail account with your domain added. Unlike a Gmail account made for a bot, a Shipmail mailbox is a paid business mailbox on your own domain, and giving it to an agent is what it is for. The address stays yours if you change agents later.

  1. Create a mailbox for the agent

    Under Mailboxes, create an address like agent@yourdomain.com. You and your team can open it in Shipmail or any mail client and see every message Codex reads, drafts or sends.

  2. Create an API key

    Open Developer, then API keys, and create a key. Pick the Draft only preset. It grants mailboxes:read, messages:read, messages:write, drafts:write, drafts:compose, threads:read and suppressions:read, and no messages:send.

  3. Limit the key to that mailbox

    Choose specific resources and add only the agent's mailbox. The key then cannot read or write any other mailbox in your organization.

The key starts with sm_live_ and is shown once. The MCP server only lists the tools the key's scopes allow, so a Draft only key has no send tool at all. When the drafts are good, edit the key and switch to the Full agent preset, which adds messages:send and members:read. Scope details are on API authentication.

Add Shipmail to Codex

Codex keeps MCP servers in ~/.codex/config.toml. Add this table. Keep the key in an environment variable, not in the file:

[mcp_servers.shipmail]
url = "https://shipmail.to/api/mcp"
bearer_token_env_var = "SHIPMAIL_API_KEY"
# Ask before any tool that is not marked read-only.
default_tools_approval_mode = "writes"

Or add it from the command line:

export SHIPMAIL_API_KEY="sm_live_..."
codex mcp add shipmail --url https://shipmail.to/api/mcp --bearer-token-env-var SHIPMAIL_API_KEY
codex mcp list

In the Codex terminal UI, type /mcp to see the server and its tools. In the IDE extension, open the gear menu, then MCP servers, and restart the extension after a config change.

Run the server locally instead

Codex can start the stdio server on your machine with npx. It needs Node.js 20 or later.

codex mcp add shipmail --env SHIPMAIL_API_KEY=sm_live_... -- npx -y shipmail-mcp

First test

Start Codex and try these prompts:

  • "Summarize the unread mail in agent@yourdomain.com from today."
  • "Draft a reply to the latest email from jane@customer.com saying the fix ships Friday. Do not send it."

Open the mailbox in Shipmail. The draft is in the same conversation, ready for you to edit and send.

Stay safe

  • Keep the Draft only preset until you trust the drafts. Then add messages:send and leave default_tools_approval_mode = "writes" on.
  • Treat every email as untrusted input. A message can contain text written to look like an instruction, and Codex can run commands in your repository. Do not ask it to act on mail from people you do not know.
  • Keep the key limited to the agent's mailbox. Revoke it under Developer, then API keys, and Codex loses access at once.

More on MCP permissions and security.

Troubleshooting

  • The server does not show in /mcp: check that SHIPMAIL_API_KEY is set in the shell that starts Codex.
  • A tool is missing: the key does not have its scope. Edit the key under Developer, then API keys. The tool list follows the key.
  • Codex cannot find a mailbox: the key is limited to another mailbox. Add this one under Choose specific resources.
  • The local server does not start: run npx -y shipmail-mcp in a terminal to see the error, and check your Node.js version.

Next steps

Frequently asked questions

Do the Codex CLI and the IDE extension need separate setup?

No. OpenAI documents that the Codex CLI, the IDE extension and the ChatGPT desktop app share ~/.codex/config.toml. Add Shipmail once.

Can Codex send email without asking me?

Not with a Draft only key. The send tools are not listed at all. With a key that can send, default_tools_approval_mode = "writes" makes Codex ask before any tool that is not marked read-only.

Can I keep the server to one project?

Yes. Put the same table in .codex/config.toml in the project. Codex reads project config only in projects you trust.

Is this different from Codex reading my Gmail?

Yes. Codex works in a mailbox on your domain that you created for it. Your own inbox stays out of reach, and your team can open the agent's mailbox to see what it did.