Claude Code email: add an email MCP server and send your first message
Claude Code email setup: add send.io MCP server to your config, send your first message in under five minutes with scoped API keys. You get exact JSON config, terminal commands, and a troubleshooting table for the four common failures that block first send.
On this page
TL;DR: Point Claude Code's~/.claude.jsonat send.io's hosted MCP server over Streamable HTTP with a scoped API key, restart the session, and send your first email from the terminal in under five minutes. The config requires two fields, type and url, and this setup adds an optional Authorization header to carry the scoped key. Choose send.io over outbound-only options because the same connection returns full inbound message bodies, headers, and attachments, and each agent gets its own inbox with a scoped key instead of sharing a mailbox. If setup fails, the troubleshooting table below lists likely causes and suggested fixes for common symptoms, such as a server missing from/mcp, a 401 on send, or an empty inbox. Choose send.io when the agent must read replies or thread responses from a dedicated inbox.
Your agent needs a real inbox, not a workaround through a shared account, so it can receive verification codes, read replies, and respond without a human in the loop. Claude Code talks to external tools through MCP servers registered in a JSON config file, and when you point that config at send.io's MCP server with a scoped API key, Claude can send email, fetch replies, and thread responses without custom adapter code. This guide gives you the exact config, commands, and fixes for the failures you will hit.
Before you start, here is how the main options compare:
Option | Setup time | Inbound support | Agent inbox primitive |
|---|---|---|---|
send.io MCP server | No local install, hosted endpoint plus scoped API key | Full body, headers, attachments | Yes, scoped key per inbox |
Resend MCP | Varies with your client setup | Metadata-only webhook | No |
Gmail MCP | Varies, OAuth consent flow | Full via Gmail API | No, acts on your own Gmail mailbox |
Custom SMTP MCP | Varies with your build | Build it yourself | No |
Resend's MCP path works for outbound sends, but its inbound webhook delivers metadata only, so the agent cannot read a reply body without a separate fetch layer. Gmail-based servers expose your personal mailbox to the agent. send.io provisions a dedicated inbox with its own scoped credential, and the rest of this guide configures that setup.
Prerequisites for sending email from Claude Code
Before you edit any config, confirm that your environment and accounts are ready. The checklist below covers the tools, credentials, and file access the setup depends on, so you don't hit a failure halfway through.
System dependencies for email MCP
You need four things before the config works:
- Claude Code installed and authenticated (any recent version that supports Streamable HTTP MCP servers)
- A send.io account with an agent inbox provisioned via the agent mailbox API
- A scoped API key for that inbox (you generate this in step two)
- Terminal access to edit
~/.claude.json
No local server binary, no Node dependencies, and no SMTP relay configuration. The hosted MCP server at api.send.io/mcp accepts JSON-RPC 2.0 requests over Streamable HTTP, so no local process runs on your machine.
Time to first email
Budget five minutes: two minutes to generate the scoped key, one to edit the config, one to restart Claude Code, and one to send. Treat that total as an estimate from the steps below, not a measured benchmark. If you already have a send.io account and an inbox, it runs closer to three minutes.
Configure the email MCP server for Claude
By the end of this guide you will have sent a real email from a Claude Code session, fetched the reply, and threaded a response. Every step produces verifiable output: a JSON response, a tool call log, or a message ID you can check in the send.io docs.
Claude Code reads MCP server registrations from two files: .mcp.json in your project root for servers shared with a team, and ~/.claude.json for your own user-scoped servers. For a personal email setup, use ~/.claude.json so the credential never lands in a shared repo.
1. Locate your Claude config file
Open ~/.claude.json in your editor. If you have never registered an MCP server, the file may not contain an mcpServers key yet. That is fine, you will add it.
$EDITOR ~/.claude.json
If you want the email server available to every developer on a project, use .mcp.json at the project root instead. The shape is identical, but never commit a live API key to version control. Use an environment variable reference for team configs.
2. Configure the MCP email server
Add this block inside mcpServers:
{
"mcpServers": {
"sendio-email": {
"type": "http",
"url": "https://api.send.io/mcp",
"headers": {
"Authorization": "Bearer sk_inbox_YOUR_SCOPED_KEY"
}
}
}
}
Three details matter here. First, the type field accepts "http", and "streamable-http" works as an alias. Second, the URL points at send.io's hosted MCP endpoint, which speaks JSON-RPC 2.0 over Streamable HTTP. The MCP specification standardized this transport, so consult the spec for session statefulness details. Third, the Authorization header uses the same bearer-token scheme as send.io's REST API, documented in the MCP server reference.
The hosted server exposes 160 tools, but this guide uses only the send, inbox fetch, and reply tools. The remaining tools cover email listing, domains, API keys, webhooks, suppressions, templates, agent inboxes, automations, events, and logs. For comparison, the official Postmark MCP server registers 24 tools across email sending, templates, message search, delivery diagnostics, bounces, suppressions, webhooks, and server info. Mailgun's MCP server exposes 50+ tools. A hosted server removes the local dependency at the cost of one network hop per tool call.
3. Confirm MCP server availability
Restart Claude Code, then run:
/mcp
You should see sendio-email listed with a healthy status and its tool count. If the server does not appear, jump to the troubleshooting section. Do not proceed until the server shows as connected, because every later step depends on the tool registry loading.
Configure scoped credentials for email access
A scoped API key works like a keyed entry card: it opens only the inbox it was provisioned for, so a compromised agent credential does not expose your full account. This is the core security property of the setup, and it is why you should never hand Claude Code an admin-level key for a single agent's email.
Generate your scoped email API key
When you provision an agent inbox with POST /v0/inboxes, the creation call returns IMAP/SMTP credentials once, including an inbox-scoped API key. If you already created the inbox and lost the key, rotate it from the dashboard or re-provision. Scoped keys carry permission lists and cannot grant permissions they do not hold, and only admin-level keys can create, change, or delete other keys, per the send.io API reference.
For a read-and-reply agent, the minimum permission set is:
- Send: dispatch new messages and replies from this inbox
- Read: fetch message bodies, headers, and attachments
- List: enumerate threads in this inbox
Skip admin, domain management, and suppression permissions. The agent does not need them, and scoped keys exist so it cannot escalate.
Configure the MCP server credentials
Paste the scoped key into the Authorization header in your config, replacing the placeholder:
"headers": {
"Authorization": "Bearer sk_inbox_a1b2c3d4e5f6"
}
Some teams prefer OAuth tokens over API keys because OAuth supports granular, revocable, per-session grants. For a single agent inbox, though, a scoped key with a narrow permission list achieves the same containment with one config line and no token refresh logic. Rotate the key on a schedule, and rotate immediately if the key appears in logs or a commit.
Reinitialize the email MCP server
Claude Code loads MCP servers at session start, so quit the session completely and relaunch. A /mcp check inside a running session will not pick up a config edit. After relaunch, run /mcp again and confirm sendio-email shows healthy with the scoped key authenticated.
Verify your MCP server with a manual send
With the config registered and credentials scoped, prove the path works with a real send.
Trigger your first email via Claude
In the Claude Code session, prompt:
Use the sendio-email server to send an email from the agent inbox
to you@yourdomain.com with subject "MCP smoke test" and body
"Config works. Reply to this message."
Claude resolves the send tool from the MCP registry, constructs the call, and asks for your approval before executing. Approve it. The tool call hits POST /mcp on the hosted server, which dispatches through send.io's sending layer, described in the transactional email API docs.
Watch the tool call log in the session. A successful send returns a JSON response containing a message ID, the thread ID, and a queued status, typically in under a second. Save the message ID. If you tag time-sensitive sends (OTP codes, verification links) for priority, they queue ahead of bulk traffic, which matters once the same account sends campaigns.
Two things worth knowing about how sends behave under the hood:
- Every send accepts a client-generated
Idempotency-Keyheader, stored for 24 hours, so a retried call that carries the same key returns the original result instead of sending a duplicate. The caller sets this header. A request without it has no deduplication protection. - Delivery, bounce, and complaint events arrive as webhooks carrying metadata and diagnostics only, never message content. Bounce events on send.io's sending IPs include the raw SMTP response and DSN code, which you can decode against send.io's SMTP response codes reference.
Validate SMTP and MCP connectivity
Check delivery from the receiving side. The test message should land at you@yourdomain.com within seconds. If the tool call returned a message ID but nothing arrived, the send succeeded and the problem is downstream: spam folder, domain authentication, or a suppression entry. Check DKIM, SPF, and DMARC alignment for the sending domain first, the same checklist send.io's transactional email production guide walks through, because MCP transport failures look different (no message ID, explicit error in the tool response).
Confirm server sync by fetching your inbox
Sending is only half the job, and the reason to run Claude Code email through send.io rather than an outbound-only MCP server is that the same connection reads the reply.
Set up email ingestion for Claude
Reply to the smoke test message from your mail client. Then prompt Claude:
Check the sendio-email inbox for new messages and show
the latest one with its full body.
The inbox fetch tool returns the full message body, headers, and Base64-encoded attachments, not just metadata. This is the concrete difference from the Resend path: with Resend, the webhook tells you a message arrived and you build a second fetch step against their API to get the content. Metadata-only webhooks fit serverless platforms that cap request body size, but they leave the agent without a one-call read path. For a deeper look at what agents need from email infrastructure, see send.io's guide to email APIs for AI agents.
Retrieve and format email text
The fetched message includes parsed plain text and HTML, the From, To, and Subject headers, and threading headers (Message-ID, In-Reply-To, References). Claude can quote or summarize the body directly because the content arrived in the tool response. If you need the raw MIME for custom parsing, the fetch tool exposes it on request.
Send a threaded reply
Now close the loop:
Reply to that message with "Threading confirmed from Claude Code."
A reply sets the threading headers automatically and unarchives the thread, so the recipient sees one continuous conversation rather than a new message. Sending a new message or forwarding a message always starts a new thread, while replies stay in the existing one. Verify in your mail client that the reply nests correctly under the original.
Troubleshooting common email MCP integration errors
Most Claude Code MCP email setups fail in one of four ways, each with a specific fix. The table below summarizes them, and the subsections cover the detail.
Symptom | Likely cause | Fix |
|---|---|---|
Server not listed in | Config file or JSON error | Validate JSON, check file path, restart |
401 on send tool call | Wrong, expired, or admin-key misuse | Regenerate scoped key, update header |
Empty inbox after reply | Agent inbox vs. personal mailbox mismatch | Send to the agent address, re-fetch |
Tool call returns no message ID | Network or server-side failure | Check error body, retry with backoff |
Fixing email server registration issues
If sendio-email does not appear in /mcp output, the config never loaded. Check three things in order: the file path (~/.claude.json for user scope), JSON validity (a trailing comma kills the whole file silently), and a full session restart. Running claude --mcp-debug at launch prints server registration errors to the terminal, which surfaces malformed type fields and unreachable URLs before you guess.
Debugging 401 credential failures
A 401 from the send tool means the bearer token failed authentication. The common causes: the key was rotated and the config still holds the old value, the key is inbox-scoped but the call targets a different inbox, or someone pasted an SMTP password into the header instead of the API key. Regenerate the scoped key, update the config, and restart. Scoped keys cannot escalate permissions, so a 401 on a valid key usually means the permission list lacks the action, not that the key is wrong.
Fixing missing email sync issues
If the fetch tool returns an empty inbox after you replied, confirm the reply went to the agent inbox address, not to a catch-all or a personal mailbox. Agent inboxes receive only mail addressed to them. Also check thread state: a reply to a thread the agent already archived still fetches, but filtering by "unread" will hide it. Re-fetch without filters before assuming ingestion failed.
Debugging failed MCP message dispatch
When a tool call fails without returning a message ID, read the error body in the tool response. A 429 means you hit a rate limit, so back off and retry, and check the error response for retry guidance. A 5xx means the failure is server-side. Retrying is safe from duplicate sends only if the original request carried an Idempotency-Key header, because a request without one has no deduplication protection. A 403 with sending_suspended means the team's reputation thresholds tripped, queued mail is held, and sending resumes only after a manual review, per the API docs. If you want to understand the protocol layer underneath, send.io's SMTP protocol guide covers the command sequences, and the SMTP vs API comparison explains when to bypass the API entirely.
Provision an agent inbox and connect it to Claude Code with the MCP quickstart guide. Use the config from this article with test traffic first, so you can validate the full send-reply-thread loop before pointing a production agent at it.
FAQs
How do you add an email MCP server to Claude Code?
Add an entry under mcpServers in ~/.claude.json with type set to http, the server's url, and an Authorization header carrying your scoped API key, then restart Claude Code. Verify with /mcp that the server lists as healthy before sending.
Can you use a different email provider with MCP?
Yes. Postmark's MCP server exposes 24 outbound-focused tools, Mailgun's exposes 50+ tools, and Resend's inbound webhook delivers metadata only. None of the three provisions a per-agent inbox with scoped credentials, which is the primitive this guide's threading and isolation steps depend on.
What happens if the MCP server crashes mid-session?
Claude Code marks the server unhealthy in /mcp and tool calls fail with a transport error, not a silent drop. Restart the session to re-register. A successful send returns a message ID confirming dispatch, while an in-flight call's outcome depends on where the crash lands in the request lifecycle.
Does Claude Code need a restart after a config change?
Yes. Claude Code loads MCP servers at session start, and edits to ~/.claude.json do not apply to a running session. Quit completely and relaunch, then confirm with /mcp.
Can Claude Code access an existing email inbox?
Not through this setup, by design. send.io provisions a dedicated agent inbox with its own scoped key, so the agent never touches your personal mailbox or primary account credentials. For existing app mail, point the agent at mailboxes you create via the API.
Key terms glossary
MCP server: A process or hosted endpoint that exposes tools to an MCP client like Claude Code using JSON-RPC 2.0, standardized by the Model Context Protocol.
Streamable HTTP: The HTTP-based MCP transport where the client posts JSON-RPC messages and the server responds, optionally streaming. Registered in Claude Code with type: "http".
Scoped API key: A credential limited to one inbox with an explicit permission list (send, read, list). It cannot grant permissions it does not hold, so a leaked agent key cannot escalate.
Agent inbox: A dedicated email address provisioned via POST /v0/inboxes with its own IMAP/SMTP credentials and API key, separate from any human account.
Idempotency key: A client-generated header stored for 24 hours that makes retried sends return the original result instead of dispatching duplicates.
Threading headers: Message-ID, In-Reply-To, and References fields that keep a reply nested under the original message in the recipient's mail client.