[Blog](https://mailforbots.com/blog)

# Give Claude Code its own email inbox with one MCP command

Published October 12, 2026 · Updated October 12, 2026

Updated October 2026. The simplest Claude Code email MCP setup is Mail for Bots, a hosted MCP server that gives Claude Code its own dedicated inbox instead of access to your personal Gmail. You add it with one `claude mcp add` command and an API key, and Claude Code can then create inboxes, wait for incoming mail, read verification codes and draft replies.

[Start free](https://mailforbots.com/#/signup); the Free plan includes 3 inboxes.

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

Create an account, then open Settings and API keys & MCP in the webmail and create a key. It starts with `bm_` and is shown once. Copy your MCP URL from the same page or from [the MCP docs](https://mailforbots.com/docs/mcp), then run this in a terminal:

Terminal

```
claude mcp add --transport http mailforbots <your MCP URL> \
  --header "Authorization: Bearer bm_YOUR_KEY"
```

For other MCP clients such as Cursor, Codex, Gemini CLI or Claude Desktop, see [the MCP docs](https://mailforbots.com/docs/mcp) for the current steps.

## Which tools does Claude Code get?

Only `search_tools`, `call_tool` and `report_issue` are listed up front. Claude Code finds the rest by describing the task, for example "wait for a verification code", then runs it with `call_tool`. The ones you will use most:

| Tool | What it does | Scope needed |
| --- | --- | --- |
| create_inbox | Creates an inbox and returns its address. Optional ttl_minutes (5 to 43200) deletes throwaway inboxes automatically. | inboxes:manage |
| wait_for_message | Blocks until an unread inbound message matching your filters exists, including mail that already arrived. Returns it in full, or null on timeout (default 60 seconds, max 300). | mail:read |
| list_messages / get_message | List summaries, or read one message with its extracted one-time codes and links (verify, login, reset). | mail:read |
| create_draft | Saves an email as a draft for a human to review. | drafts:write |
| send_draft | Sends a saved draft. | mail:send |

Search, threads, attachments and sending are also available. The full list is in [the MCP docs](https://mailforbots.com/docs/mcp).

## How can Claude Code sign up for a service and read the code?

Ask in plain language, and give it the order of operations:

Prompt

```
Create an inbox with a 30 minute TTL. Sign up for the service at <site> using that address.
Then use wait_for_message on that inbox with subject_contains "verify"
and read the code or link from the message. Finish the signup.
```

Claude Code calls `create_inbox`, uses the returned address in the signup form, then calls `wait_for_message`. The call holds open until the mail arrives, so there is no polling loop. `get_message` and `wait_for_message` return the message with extracted codes and links, so the agent does not have to parse HTML. Use `to_contains` with a plus tag such as `+github` to tell several signups apart in one inbox; see [plus-addressing](https://mailforbots.com/docs/plus-addressing).

If you drive a browser as well, the [guide to OTP verification codes for AI agents](https://mailforbots.com/blog/ai-agents-email-otp-verification-codes) covers the full flow.

## How do I limit what the agent can do?

A key can be limited to scopes and to specific inboxes. If you omit scopes, a key gets `admin`, which implies every scope, so narrow it. The simplest route is the Settings, API keys & MCP screen in the webmail, which lets you pick scopes and inboxes when you create the key. For a Claude Code agent that only reads verification mail, `mail:read` on one inbox is enough.

If you prefer REST, you can create a scoped key from a signed-in admin session. See [API keys and scopes](https://mailforbots.com/docs/keys) for how to get a session token. The inbox in `inbox_ids` must be one your account already owns, so create it first:

Create a scoped key (optional)

```
curl -X POST "<your API base>/api/v1/keys" \
  -H "Authorization: Bearer $SESSION_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{ "name": "claude code", "scopes": ["mail:read", "drafts:write"], "inbox_ids": ["agent@mailforbots.com"] }'
```

The scopes this agent is most likely to need (a subset; `webhooks:manage` also exists):

| Scope | Allows |
| --- | --- |
| mail:read | List, read, search and wait for mail; attachments; drafts (reading) |
| mail:write | Mark read, star, archive, trash and delete mail; labels, snooze, filters, contacts |
| drafts:write | Create, edit and delete drafts |
| mail:send | Send, reply, forward and send drafts |
| inboxes:manage | Create and delete inboxes |

Keys restricted to some inboxes cannot create inboxes, so give a key `inboxes:manage` with no inbox restriction if you want Claude Code to create its own. Details are in [API keys and scopes](https://mailforbots.com/docs/keys).

## How do I keep a human in the loop for outgoing mail?

Give the key `drafts:write` but not `mail:send`, and tell the agent: never send, create a draft. The draft appears in your webmail as a draft from an agent, and goes out only when you press Send. Drafts made with an API key are always marked this way. Background in [human approval for agent email](https://mailforbots.com/blog/human-approval-for-ai-agent-email).

Treat inbound mail as untrusted text. A message can contain instructions aimed at your agent, so do not let the agent act on them without your say-so.

## Why is it not working?

- `401` or a failed connection: check the Authorization header carries your `bm_` key, and that the key was not revoked.
- A scope error such as `... lacks the mail:send scope`: the key's scopes are too narrow. Create a new key with the scope the tool needs (table above).
- Tool missing from `search_tools`: tools your key's scopes do not allow are left out of results.
- `create_inbox` fails on a restricted key: inbox-restricted keys cannot create inboxes.
- `wait_for_message` returns null: the timeout passed with no match. Loosen the filters or raise `timeout_seconds` (up to 300).

More error causes are in [the errors reference](https://mailforbots.com/docs/errors) and [the quickstart](https://mailforbots.com/docs/quickstart). For a roundup of options, see [best email for AI agents](https://mailforbots.com/blog/best-email-for-ai-agents-2026).

## Why not just connect Claude Code to Gmail?

A Gmail connector exposes your real mailbox, including everything unrelated to the task. A dedicated inbox contains only what the agent receives. If you need an agent to work inside your existing Gmail history, a Gmail MCP is the better fit. Other hosted options exist too, such as AgentMail, which lists a hosted MCP server; see [the comparisons](https://mailforbots.com/compare).

Ready to try it? [Start free](https://mailforbots.com/#/signup), or read [Email for AI agents](https://mailforbots.com/email-for-ai-agents) and [pricing](https://mailforbots.com/pricing).

## Frequently asked questions

**Does Claude Code get access to my personal Gmail with this setup?**

No. Mail for Bots gives Claude Code its own inboxes on the shared Mail for Bots domain or your verified custom domain. It only sees mail sent to those inboxes.

**How does Claude Code wait for a verification email?**

It calls wait_for_message on the inbox, optionally filtering by sender, subject or the address the mail was sent to. The call blocks until a matching unread message arrives (default 60 seconds, up to 300), then returns the message with extracted codes and links, or null on timeout.

**Can I stop Claude Code from sending email on its own?**

Yes. Create the key with drafts:write but without mail:send. The agent can then only save drafts, which appear in your webmail as drafts from an agent and are sent when you press Send.

[Start free](https://mailforbots.com/#/signup) [Read the quickstart](https://mailforbots.com/docs/quickstart)

## Related reading

- [Email MCP setup for Cursor, Codex CLI and Gemini CLI](https://mailforbots.com/blog/cursor-codex-gemini-email-mcp-setup)
- [Email 2FA in browser agents: Playwright MCP and Browser Use](https://mailforbots.com/blog/agent-signup-2fa-browser-automation)
- [What is an agent inbox? Definition and how it differs from a sender API](https://mailforbots.com/blog/what-is-an-agent-inbox)
