# Email in Claude Code, Codex and Cursor: connect an inbox over MCP

> How to give Claude Code, Codex or Cursor access to an email inbox over MCP: exact commands, sign-in, a first test and what to do when tools do not show up.

Updated: 2026-10-20 · Fact-checked: 2026-10-20 · Canonical: https://commandmail.app/en/guides/email-claude-code-codex-cursor · Deutsch: https://commandmail.app/de/anleitungen/e-mail-in-claude-code-codex-cursor.md

You connect an inbox to Claude Code, Codex or Cursor by adding a remote MCP server and signing in once. In Claude Code that is `claude mcp add --transport http`, in Codex `codex mcp add --url` followed by `codex mcp login`, and in Cursor an entry in `mcp.json`.[^1][^2][^3] The agent then reads, searches, drafts and, if you allow it, sends mail from the terminal or editor where you already work.

Command Mail is our product, and we use it as the example server. The commands work the same way for any email MCP server that offers Streamable HTTP and OAuth. Vendor documentation was retrieved on 2026-10-20; menus and flags change between versions.

## What you need before you start

You need three things: a current version of the coding agent, an email service with an MCP server, and an account there that you can sign in to in the browser. Command Mail's server runs at `https://commandmail.app/mcp` and uses OAuth 2.1 with PKCE and dynamic client registration, so you do not create API keys or OAuth clients yourself.[^5]

Decide beforehand what the agent may do. On Command Mail's sign-in screen you switch each permission on or off: `mail:read` for reading, searching and organizing within each mailbox's autonomy level, which includes archive, spam and rules; `mail:draft` for drafts; `mail:send-approved` for sending a draft a person approved; `mail:send` for sending and replying without individual approval and, together with `mail:read`, forwarding and moving mail to the trash; and `mailboxes` for connecting addresses. Sending without approval starts switched off.[^5] Switching a retention period on or shortening it needs `mail:send` and level `auto` for the account default and for every mailbox that is not read-only; switching it off or extending it works without.

The free plan covers one mailbox, with further mailboxes paused but still receiving, and the last 90 days. It reads, searches, sorts and drafts, and it does not send, not even approved drafts. Sending needs Pro, which also brings up to ten mailboxes and full history and costs €19 per month for the first 100 paying Pro accounts, for as long as that subscription runs, and €29 per month after that; there are also yearly prices of €190 or €290, a 7-day Pro trial for €1 and a Team plan at €39 per person per month (prices on 2026-10-20).[^5]

## Connect email to Claude Code

Claude Code adds remote servers with one command and asks for sign-in inside the session.[^1]

1. Add the server: `claude mcp add --transport http commandmail https://commandmail.app/mcp`. Without further flags, the entry lands in local scope, meaning your user and the current project. Add `--scope user` to make it available in every project.
2. Start `claude` and type `/mcp`. Select `commandmail` and sign in; the browser opens Command Mail's consent screen.
3. Choose the permissions and confirm. Back in the terminal, `/mcp` shows the server with its tool count.
4. Check from the shell: `claude mcp list` shows `✔ Connected`, `! Needs authentication` or `✘ Failed to connect` for each server.

If your team should get the same server, `--scope project` writes it to `.mcp.json` in the repository. Each person then approves the server once when running `claude` in that folder, and each person signs in with their own account. A cloned repository cannot approve its own servers.[^1]

Claude Code loads MCP tools through tool search by default, with exceptions such as older models or an `ANTHROPIC_BASE_URL` that points to a host other than Anthropic. Claude finds the mail tools when a task needs them, so a large tool list does not crowd every request.[^1]

## Connect email to Codex

Codex keeps MCP servers in `config.toml`, and the Codex CLI, the IDE extension and the ChatGPT desktop app share that file.[^2]

1. Add the server: `codex mcp add commandmail --url https://commandmail.app/mcp`.
2. Sign in: `codex mcp login commandmail`. On a machine without a browser, `--no-browser` prints the authorization URL and waits for you to paste back the callback URL from the browser where you signed in.
3. Choose the permissions on the consent screen and confirm.
4. Check: `codex mcp list` shows the configured servers; inside the `codex` TUI, `/mcp` shows the active ones.

The resulting entry in `~/.codex/config.toml` is short:

```toml
[mcp_servers.commandmail]
url = "https://commandmail.app/mcp"
```

For a single repository, put the same table in `.codex/config.toml` in the project; Codex reads it only in trusted projects. Two optional keys are useful for mail: `enabled_tools` limits which tools Codex may call, and `tool_timeout_sec` (default 60 seconds) helps with slow searches across a large inbox.[^2]

Codex prefers the scopes a server advertises when it starts the OAuth login. Command Mail advertises all of its permissions, so the decision happens on Command Mail's consent screen, where you switch off what the agent should not have.[^2][^5]

## Connect email to Cursor

Cursor reads MCP servers from `mcp.json`: `~/.cursor/mcp.json` applies to every project, `.cursor/mcp.json` to one project. If the same server name appears in both files, the project file wins.[^3][^4]

1. Open or create `~/.cursor/mcp.json` and add:

```json
{
  "mcpServers": {
    "commandmail": {
      "url": "https://commandmail.app/mcp"
    }
  }
}
```

2. Save the file and restart Cursor.
3. Cursor shows the server under **Customize** → **MCPs**. Follow the sign-in prompt and choose the permissions on the consent screen.
4. In an Agent chat, the tools list at the top of the chat panel shows the mail tools. Click a tool name to switch it on or off. Switching off `send_message` alone does not stop sending, because `reply` and `forward_message` send too; leave `mail:send` off on the consent screen instead.

Cursor uses dynamic client registration when the server supports it. The static `CLIENT_ID` fields in Cursor's documentation are only for providers without it, so you do not need them for Command Mail.[^3]

Cursor's documentation describes approval for MCP tools by default. In version 3.6 and later, the default **Auto-review** mode under **Cursor Settings** → **Agents** → **Approvals & Execution** lets allowlisted MCP tools run immediately and sends the rest through a safety classifier.[^4] Check that setting before you give a Cursor agent a sending permission.

## When the agent cannot use OAuth: the command line

Some setups cannot open a browser, for example a remote container or a CI job. Command Mail also has a command-line tool: `curl -fsSL https://commandmail.app/install.sh | sh`, then `commandmail login`.[^5] The coding agent can call the CLI directly, and `commandmail mcp` starts a local MCP server for agents that only speak stdio.

## Test the connection with a first task

The first call in every session should be `capabilities`. It returns the account owner, the granted permissions, each mailbox with its autonomy level, the allowed operations and the limits.[^5] Ask the agent: "Call capabilities on commandmail and tell me what you are allowed to do." If the answer matches what you chose on the consent screen, the connection works.

A good second task is read-only: "Search my inbox for invoices from the last 30 days and list sender, date and amount." That tests reading and search without changing anything. Only then try a draft, and approve it yourself before anything is sent.

Command Mail marks message content as untrusted data and flags suspected prompt injection. That matters more in a coding agent than in a chat app, because the same session may also run shell commands. Treat instructions inside an email as text to read, never as a task.[^5]

## Troubleshooting: missing tools and sending

Most problems fall into one of five patterns.

**Claude Code shows "Needs authentication".** The server is configured but nobody has signed in yet, or the token has expired. Open `/mcp`, select the server and sign in again. `/mcp reconnect all` retries every server that failed or needs authentication; in the interactive terminal that needs Claude Code v2.1.284 or later.[^1]

**Codex lists the server but calls fail.** Codex can connect to a server without credentials if no sign-in was completed.[^2] Run `codex mcp login commandmail` and start a new session.

**Cursor shows no tools after editing the file.** Cursor reads `mcp.json` at startup, so restart it. Check that the JSON is valid and that the key is `url`, not `command`.[^4]

**A project server in Claude Code stays at "Pending approval".** Servers from a repository's `.mcp.json` need your approval. Run `claude` in the folder and accept the workspace trust dialog and the server.[^1]

**The agent says it cannot send.** With Command Mail, check the plan first and the permission second. All sending needs Pro. With `mail:send-approved`, the agent sends only a draft revision that you approved in Command Mail, and not from a mailbox on level `read`. The direct tools `send_message` and `reply` exist only with `mail:send`; they also need a mailbox that can send, autonomy level `auto` and remaining room in the daily limit, and the agent does not write on its own to automated senders, mailing lists or no-reply addresses.[^5]

To grant different permissions, sign in again: in Claude Code, choose **Clear authentication** for the server in `/mcp` and sign in; in Codex, run `codex mcp login commandmail` again; in Cursor, remove the server under **Customize** and add it again. A token refresh can only narrow the granted permissions, so widening them needs this new sign-in. The earlier grant stays valid on the server until it is revoked or expires; the consent screen links to your connections in Command Mail's settings.[^1][^2][^4][^5]

## How the three agents compare for email work

The three tools differ less in what they can do with mail than in where configuration lives and who approves tool calls.

| | Claude Code | Codex | Cursor |
|---|---|---|---|
| Add a remote server | `claude mcp add --transport http` | `codex mcp add --url` | `url` entry in `mcp.json` |
| Sign in | `/mcp` in the session | `codex mcp login` | prompt in Customize → MCPs |
| Personal configuration | `~/.claude.json` (local or user scope) | `~/.codex/config.toml` | `~/.cursor/mcp.json` |
| Project configuration | `.mcp.json` | `.codex/config.toml` (trusted projects) | `.cursor/mcp.json` |
| Status check | `claude mcp list`, `/mcp` | `codex mcp list`, `/mcp` | Customize → MCPs |

Sources: vendor documentation retrieved on 2026-10-20.[^1][^2][^3][^4]

Whichever agent you choose, the mail-side permissions stay the same, because the email service enforces them on the server. Claude Code, Codex and Cursor each add their own approval layer on top.

## Next steps

If you work with several addresses, read [using multiple email accounts with one AI agent](https://commandmail.app/en/guides/multiple-email-accounts-ai-agent). For the permission model in detail, see [permissions and autonomy](https://commandmail.app/en/docs/permissions-and-autonomy). If you are still choosing a server, the [email MCP server comparison](https://commandmail.app/en/compare/best-email-mcp-servers) lists the options.

[Start Command Mail free](https://commandmail.app/login?signup=1) and connect your coding agent.

## Frequently asked questions

### How do I add an email MCP server to Claude Code?

Run claude mcp add --transport http <name> <url>, for example claude mcp add --transport http commandmail https://commandmail.app/mcp. Then start claude, open /mcp and sign in to the server. claude mcp list shows whether it is connected or still needs authentication.

### How do I add a remote MCP server to Codex?

Run codex mcp add <name> --url <url>, then codex mcp login <name> for servers that use OAuth. Codex stores the entry in ~/.codex/config.toml, which the Codex CLI, the IDE extension and the ChatGPT desktop app share.

### Where does Cursor store MCP servers?

In mcp.json: ~/.cursor/mcp.json for all projects or .cursor/mcp.json inside one project. A remote server needs a url field; Cursor handles OAuth for servers that require it.

### Why does my coding agent not see a send tool?

With Command Mail, the server builds its tool list from the permissions granted at sign-in. The direct sending tools send_message and reply only appear with mail:send, which is off by default; forward_message also needs mail:read. Agents with mail:draft and mail:send-approved work through drafts that a person approves, and every kind of sending needs the Pro plan.

### Can a coding agent send email without asking me?

Only if you allow it. In Command Mail that needs the mail:send permission, a Pro plan, a mailbox that can send and is on autonomy level auto, and remaining room in the daily limit; each message goes to at most 20 recipients. Claude Code, Codex and Cursor also have their own approval settings for tool calls.

## Sources

1. [Anthropic: Connect Claude Code to tools via MCP](https://code.claude.com/docs/en/mcp), accessed 2026-10-20
2. [OpenAI: Codex MCP documentation](https://developers.openai.com/codex/mcp), accessed 2026-10-20
3. [Cursor: Model Context Protocol (MCP)](https://cursor.com/docs/mcp), accessed 2026-10-20
4. [Cursor Help: MCP](https://cursor.com/help/customization/mcp), accessed 2026-10-20
5. [Command Mail: llms.txt with plans, scopes and connection options](https://commandmail.app/llms.txt), accessed 2026-10-20

[^1]: [Anthropic: Connect Claude Code to tools via MCP](https://code.claude.com/docs/en/mcp), accessed 2026-10-20
[^2]: [OpenAI: Codex MCP documentation](https://developers.openai.com/codex/mcp), accessed 2026-10-20
[^3]: [Cursor: Model Context Protocol (MCP)](https://cursor.com/docs/mcp), accessed 2026-10-20
[^4]: [Cursor Help: MCP](https://cursor.com/help/customization/mcp), accessed 2026-10-20
[^5]: [Command Mail: llms.txt with plans, scopes and connection options](https://commandmail.app/llms.txt), accessed 2026-10-20

---

Command Mail: one inbox for you and your AI agent. Start free: https://commandmail.app/login?signup=1 · Connect your agent: https://commandmail.app/en/agents · MCP: https://commandmail.app/mcp
