# Send & Receive Emails with Claude Code (/integrations/frameworks/claude-code)

<!-- agent-signals: reading_time_min: 2 · est_tokens: 655 · updated: 2026-09-06 -->
Related: [Send & Receive Emails with Claude Cowork](/integrations/frameworks/claude-cowork.md), [Send & Receive Emails with OpenAI Codex](/integrations/frameworks/codex.md), [Send & Receive Emails with OpenClaw](/integrations/frameworks/openclaw.md), [Send & Receive Emails with Grok](/integrations/frameworks/grok.md), [Send & Receive Emails with Manus](/integrations/frameworks/manus.md), [Send & Receive Emails with Cursor](/integrations/frameworks/cursor.md)



# Connect Claude Code to AgentMail

Add AgentMail's hosted MCP server to Claude Code with `claude mcp add`. It gets `@agentmail.to` inboxes to send, receive, and reply from, authenticated by an API key header or an OAuth sign-in.

## Do this

1. Register the server with an API key from `https://console.agentmail.to/dashboard/api-keys`:

```bash
claude mcp add --transport http agentmail https://mcp.agentmail.to/mcp \
  --header "x-api-key: $AGENTMAIL_API_KEY"
```

2. Confirm with `claude mcp list`, then prompt:

```text
Create an AgentMail inbox and send a hi email from it to you@example.com.
```

## Facts

* API-key registration: `claude mcp add --transport http agentmail https://mcp.agentmail.to/mcp --header "x-api-key: $AGENTMAIL_API_KEY"`.
* OAuth registration: the same command without `--header`. Claude Code opens the AgentMail sign-in on first use.
* The endpoint is exactly `https://mcp.agentmail.to/mcp`. Full tool catalog and OAuth details: [MCP and Skills](/integrations/mcp-and-skills).
* Creating an inbox without a username lets AgentMail generate an available one. A taken username makes `create_inbox` return `403` with up to 3 available variants in `suggestions`.

## Not supported

* The API-key path needs a valid key. To connect without one, drop `--header` and use the OAuth sign-in.

## Errors

| Error               | Status | Cause                                                                   | Fix                                                                 |
| ------------------- | ------ | ----------------------------------------------------------------------- | ------------------------------------------------------------------- |
| `404` on every call | 404    | Incorrect server URL                                                    | Set the URL to exactly `https://mcp.agentmail.to/mcp`               |
| `resource_taken`    | 403    | The requested inbox username belongs to another organization            | Retry with one of the up to 3 variants in `suggestions`             |
| `already_exists`    | 403    | An inbox with the requested username already exists in the organization | Retry with a username from `suggestions`, or use the existing inbox |

## Verify

Run `claude mcp list` (the AgentMail server appears), then prompt `List my AgentMail inboxes`. Success is Claude Code calling `list_inboxes` and returning the addresses.

## Related

* [MCP and Skills](/integrations/mcp-and-skills): the full tool catalog, OAuth details, and skills.
* [Agent safety](/advanced/safety): treat inbound mail as untrusted and confirm sends before the agent acts.
