Skip to content
send.io
All posts

Claude Code email MCP server: complete setup, configuration, and agent inbox guide

Claude Code Email MCP Server setup guide covers send.io hosted server installation, agent inbox provisioning, and production hardening. You authenticate with a scoped API key, provision an agent inbox with POST /v0/inboxes, and connect Claude Code with a single config entry.

On this page
TL;DR: Claude Code can send and receive email through the send.io hosted MCP server, which exposes 160 tools over Streamable HTTP at https://api.send.io/mcp. send.io runs the server, so there is nothing to install. You connect with an OAuth sign-in or an API key, and you provision an agent inbox with a single API call. Claude Code connects with one command, claude mcp add --transport http sendio https://api.send.io/mcp, followed by a sign-in. This guide covers setup, inbound webhook configuration, scoped credential management, production hardening, and the common failure modes you need to close the pilot-to-production gap for agent email.

Your agent can call a weather API, query a database, and write code. It still can't read its own email without a custom adapter you have to maintain.

The gap between an agent email demo and a production pipeline is not model quality. It's the glue code and the operational layer you skipped because the demo worked. This guide walks the full path: connect to the send.io hosted MCP endpoint, configure Claude Code and Claude Desktop, provision scoped agent inboxes, wire webhook triggers, and harden the pipeline with error capture, turn budgets, and a named on-call owner.

Core capabilities of the send.io hosted MCP server

The send.io hosted MCP server exposes 160 tools at https://api.send.io/mcp, and each tool is a call to the send.io API made with your connection's access. The Model Context Protocol uses JSON-RPC 2.0 as its underlying RPC protocol, and the send.io server serves it over Streamable HTTP, so it plugs into Claude Code's native MCP client. send.io runs the hosted server, so there is nothing to install locally, and you can connect with either an OAuth sign-in or an API key.

Exposed MCP email tools

The hosted server exposes 160 tools, each one a call to the send.io API made with your connection's access. They cover sending and scheduling email, received emails and attachments, templates, contacts, broadcasts, automations, domains, API keys, webhooks, suppressions, logs, mailboxes, agent inboxes, and billing. Browse the full tool catalog. Tool names in this guide follow the current hosted server tool list, so confirm the exact name and inputs in the tool catalog before wiring calls.

Key tool categories on the hosted server:

  • Emails (9 tools): Send, batch (up to 100 per call), schedule, reschedule, and cancel email, and list delivery events and attachments for sent email
  • Received emails (4 tools): Read emails received on your domains, with headers, html, text, and attachment download URLs
  • Agent inboxes (17 tools): Create and delete inboxes, read threads and messages, send, reply, forward, label, and send drafts
  • Webhooks (6 tools): Create, update, and delete webhook endpoints, and rotate signing secrets
  • Suppressions (4 tools): Add, list, and remove suppressed addresses
  • Logs (2 tools): List and fetch API request logs
  • Account and audience tools: Domains, API keys, mailboxes, templates, transactional emails, contacts, segments, topics, broadcasts, automations, events, and billing

Managing scoped API credentials

Provisioning an agent inbox returns an inbox-scoped API key at creation time. Permissions limit what the holder can do, so a compromised agent credential doesn't expose your full account. When you sign in to the hosted MCP server, you pick Full access or Sending only, and an API key's own permission applies the same way. Full access can also manage domains, keys, webhooks, and templates, so choose Sending only for an agent that only needs to send email. Details for each access level are on the hosted MCP server page.

Deployment models: hosted vs. local stdio

Hosted send.io MCP server

Local stdio MCP mode

Tool catalog

160 tools at https://api.send.io/mcp

The same tools, run on your machine

Auth required

OAuth sign-in or an API key sent as an Authorization: Bearer header

See the send.io CLI

Use case

Clients that connect to a remote URL, with nothing to install

Clients that only start local servers

Limitations

Requires a send.io account. Approving an OAuth connection takes admin access to the team

You run the process yourself with npx -y @sendio/cli mcp serve

If your client only starts local servers, run the same tools on your machine over stdio with npx -y @sendio/cli mcp serve. Otherwise, use the hosted server, which send.io runs for you. The hosted server remains the full email pipeline, and the email API for AI agents guide covers technical prerequisites.

Bootstrap your email MCP server

The hosted server requires a send.io account. Clients that support sign-in connect through OAuth with no key needed, while clients without sign-in, and scripts, send an API key from the send.io dashboard instead.

Authenticate your MCP instance

  1. Sign in with OAuth: Add the endpoint URL to your client and sign in when it asks. The client opens send.io in your browser, you pick the team and choose Full access or Sending only, and it connects using OAuth 2.1 with PKCE. Approving a connection takes admin access to the team.
  2. Or generate an API key: For clients without sign-in, and for scripts, create a key from your send.io dashboard (app.send.io). Only admins can create keys. A key can be full access, limited to an inbox or pod, or limited to a permission list such as message_read and message_send. Restrict it to what your agent needs. A scoped key exists for exactly this, even in development.
  3. Set the environment variable: Export SENDIO_API_KEY in your shell profile. The hosted MCP server accepts an API key as an Authorization: Bearer header.
  4. Confirm the key works: Send an authenticated test request to the send.io API with your key in the Authorization header and check for a successful JSON response rather than a 401 or 403 before configuring MCP.

Configure the MCP server connection

Claude Desktop reads MCP server entries from claude_desktop_config.json. The file location depends on your OS:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%\Claude\claude_desktop_config.json
  • Linux: ~/.config/Claude/claude_desktop_config.json

The config file has one top-level key, mcpServers, and each child key is a server name you choose. Each entry sits under a name key in the mcpServers object. Stdio servers require a command. args and env are optional, and env$env supports ${VAR} expansion and merges with the inherited environment. Claude Desktop's connector screen can't send a custom header, so for an API key, mcp-remote bridges to the hosted server with your key. For httpsseOAuth, skip the config file and use the connector screen instead: set Name to wssend.send.io and Remote MCP server URL to typehttps:https://api.send.io/mcpurlheadersheadersHelperoauthmcp. For the hosted send.io server using an API key, add this stdio entry:

{
"mcpServers": {
"sendio": {
"command": "npx",
"args": ["-y", "mcp-remote", "https://api.send.io/mcp", "--header", "Authorization:${AUTH_HEADER}"],
"env": { "AUTH_HEADER": "Bearer mx_your_api_key" }
}
}
}

The hosted endpoint is https://api.send.io/mcp. An MCP endpoint is an ordinary HTTPS URL, and the path is the server operator's choice. If a connection fails, confirm the URL and path match the hosted endpoint, https://api.send.io/mcp.

Validate JSON syntax before restarting. Invalid JSON can prevent the client from loading any servers, and the client may not surface a clear parse error.

Validate SMTP server connectivity

If your agent also sends email over SMTP directly, point it at smtp.send.io on port 587 with STARTTLS, which is required before you sign in. The username is a mailbox address on a verified domain, and the password is that mailbox's password or a full-access API key of the team that owns it. The SMTP ports guide explains when to use 587 versus 465 versus 25. If your agent sends only through MCP tool calls, each call is a request to the send.io API, so those sends need no separate SMTP setup.

Configuring the Claude Code email MCP server

Claude Code connects to the hosted endpoint over Streamable HTTP with one command, so setup comes down to adding the server, signing in, and confirming the tools register. The sections below also cover the most common credential failure.

Add the send.io MCP server to Claude Code

send.io runs the hosted server, so there is nothing to install.

Add it to Claude Code with one command:

claude mcp add --transport http sendio https://api.send.io/mcp

Then run /mcp in Claude Code, pick sendio, and sign in. A browser opens on send.io where you choose the team and what Claude may do. Add --scope user to use the server in every project. For an API key instead of the OAuth sign-in, follow the API key option.

Configure the server in .mcp.json

The command above stores the server in Claude Code's configuration. To share the same entry with your team, define it in a project-level .mcp.json file. Claude Code reads MCP server entries from the --mcp-config flag, a project-level .mcp.json file, or the user-scoped ~/.claude.json file. This entry uses an API key:

{
"mcpServers": {
"sendio": {
"type": "http",
"url": "https://api.send.io/mcp",
"headers": {
"Authorization": "Bearer ${SENDIO_API_KEY}"
}
}
}
}

Restart Claude Code. MCP clients typically group tools under the server entry that provided them, so check the tool listing in your session to confirm how the send.io tools are namespaced.

Validate MCP tool registration status

List the active MCP servers and their registered tools in your Claude Code session by running /mcp. You should see sendio-email (or the entry name you chose) listed with its email tools. If the server doesn't appear or no tools register, check the debugging section below.

Debugging invalid MCP credential errors

The most common failure with an API key is one that was revoked or copied with trailing whitespace. With OAuth, access tokens last an hour and only work with the MCP server, and they stop when the person who approved the app is no longer a team admin or when you revoke the app. Symptoms:

  • 403 on all tool calls: The connection authenticated but lacks the required permission for that tool category. A Sending only connection can't manage domains, keys, webhooks, or templates, so reconnect with Full access if the agent needs them. A 401 typically means the server couldn't authenticate the credential, which happens when an API key is invalid or revoked, or an OAuth session ended. In that case, generate a new key or sign in again with /mcp.
  • Connection refused or DNS failure: Confirm the URL in your config is the hosted endpoint, https://api.send.io/mcp.
  • Tools registered but returning empty results: The connection may lack the permission for that tool category, so check its access level first. Empty results can also mean the request matched no data, so confirm the inbox actually holds matching messages before rotating credentials.

Configuring the Claude Desktop email MCP server

Claude Desktop connects differently from Claude Code: OAuth goes through the connector screen, and an API key goes through an mcp-remote stdio entry in the config file. The sections below enable the server, assign a key per inbox, and verify the handshake.

Enable email MCP in Claude Desktop

Claude Desktop uses the same claude_desktop_config.json file, and each entry sits under a name key in the mcpServers object. The name is a key rather than a field. For OAuth, open the connector screen and set Name to send.io and Remote MCP server URL to httphttps://api.send.io/mcpssews. For an API key, the connector screen can't send a typeurlheaderscustom header, so add a stdio entry with a command (npx), args that run mcp-remote against https://api.send.io/mcp with an --header argument, and an env object that holds the Authorization value. After adding the send.io entry and restarting, email tools appear in the tools panel.

Configure scoped credentials per inbox

For production, use a scoped key per agent inbox rather than a full-access key, so the credential can only read and act on that one inbox. A key can be limited to an inbox or pod or to a permission list such as message_read and message_send. Example entry:

{
"mcpServers": {
"sendio-support-agent": {
"command": "npx",
"args": ["-y", "mcp-remote", "https://api.send.io/mcp", "--header", "Authorization:${AUTH_HEADER}"],
"env": { "AUTH_HEADER": "Bearer mx_your_support_inbox_key" }
}
}
}

Each scoped key is tied to one inbox. Multiple agents each get their own server entry with their own scoped key.

Validate server-to-agent handshake

Ask Claude Code to list inbox contents:

"Using the sendio-email tools, list the last 5 messages in the inbox."

If the handshake works, Claude Code calls a tool such as list-inbox-messages and returns the inbox messages. Confirm the fields each tool returns. If it errors, check that the connection's permission covers agent inboxes and the inbox has at least one message. The agent mailbox guide covers provisioning and credential scoping.

Managing message state and response triggers

Once the server is connected, the agent handles email through tool calls for sending, reading, threading, and attachments. The sections below describe what each tool accepts and returns, so you can design response triggers around real payloads.

Sending outbound email through MCP tools

The send-email tool sends an email from inline html and text, a published template with its variables, or a transactional email by id. The send-batch-emails tool sends up to 100 emails in one call. A scheduled email can be rescheduled with update-email and cancelled with cancel-email, and send-inbox-message sends a new message from an agent inbox. The hosted MCP server page lists what each tool does, and the agent reads each tool's input schema from the server when it connects, so you can design prompts around the tool names and behavior above.

Idempotency keys let a retry return the original result instead of sending a duplicate. Idempotency keys are a REST API feature, and each MCP tool is a call to the send.io API. The tool list doesn't name an idempotency parameter on the send tools, so don't assume the server deduplicates a retried call. Track what your agent already sent in your own handler, because requests without deduplication protection can send duplicates on retry.

Accessing inbox data via MCP

The list-inbox-threads, get-inbox-thread, and list-inbox-messages tools read agent inbox content. For mail received on your domains, list-received-emails lists it newest first, and get-received-email returns a received email with its headers, html, and text. The send.io API webhooks section describes the inbound payload your application receives, so the agent can work from parsed content instead of a bare notification.

Managing threaded email conversations

The reply-to-thread tool replies on an existing thread, forward-thread forwards one, and update-thread marks a thread read or archived or changes its labels. Sending a new message with send-inbox-message starts a new thread, and per RFC 5322, email threading relies on the Message-ID, In-Reply-To, and References headers to attach a reply to its parent. The reply-to-thread tool sets those headers for you, so a reply attaches to its parent automatically. Have the agent call get-inbox-thread to read the full conversation before composing a reply, which matters for multi-turn workflows.

Extracting data from email attachments

Attachment tools return download URLs: list-email-attachments and get-email-attachment for sent email, and list-received-email-attachments and get-received-email-attachment for received email. The agent can fetch the file from the URL, then decode, parse, and extract structured data from CSV, JSON, PDF, and other formats. Webhook payloads can also carry attachments, so confirm how they're encoded in the send.io API webhooks section. The transactional email best practices guide covers attachment size limits and encoding patterns.

Configuring email inboxes for MCP servers

Each agent needs its own inbox and credentials so one agent's access can't reach another agent's messages. The sections below cover provisioning an inbox, grouping inboxes into pods, and setting the triggers that fire on inbound delivery.

Define scoped agent inbox parameters

Provision an agent inbox with one API call:

curl -X POST https://api.send.io/v0/inboxes \
-H "Authorization: Bearer $SENDIO_API_KEY" \
-H "Content-Type: application/json" \
-d '{"username": "support-agent", "domain": "mail.yourdomain.com"}'

Omit username for a random address, or domain for the shared agent domain. Confirm which credentials the response returns and whether they're shown only once at creation time. Store them immediately, because you may not be able to retrieve them later.

Assign API keys to specific agents

Inbox pods group inboxes for isolation. A pod's API key can only see that pod's inboxes, and a pod can't be deleted while it holds inboxes. Use one pod per end customer or agent function:

  1. Create a pod: POST to the pods endpoint with a name and optional metadata.
  2. Create inboxes within the pod: Pass the pod ID when creating the inbox.
  3. Generate pod-scoped keys: These manage only inboxes within that pod.

This prevents cross-contamination. A scheduling agent's key can't read the support agent's messages.

Configure inbox triggers and dispatch rules

Event webhooks fire on inbound delivery to the agent inbox. Configure the endpoint URL and event selection in the send.io API webhooks section. The payload includes the full message body, headers, attachments, and routing metadata, not just a notification.

Configuring webhook triggers for agent flows

Webhooks close the loop between inbound email and your agent: send.io posts each message to your endpoint, and your handler decides when to invoke Claude Code. The sections below cover the payload, an extraction pattern, the trigger flow, and retry behavior.

Managing inbound email webhook events

Event webhooks deliver inbound messages as JSON POSTs, as described in the send.io API webhooks section. Each payload includes:

  • Message body: Full HTML and plain text
  • Headers: All RFC 5322 headers including custom X-headers
  • Attachments: Base64-encoded with filename, content type, and size
  • Routing metadata: Inbox ID, timestamp, message ID, and thread references

Mapping incoming email JSON schemas

A minimal extraction pattern:

def handle_inbound(payload):
body_text = payload["body"]["text"]
sender = payload["headers"]["from"]
subject = payload["headers"]["subject"]
thread_id = payload.get("thread_id")
attachments = payload.get("attachments", [])
# Route to agent loop with extracted context

The SMTP commands reference covers protocol sequences for debugging delivery issues.

Binding email webhooks to tool execution

A common pattern to close the send-receive loop:

  1. Webhook fires: Inbound message arrives at your endpoint.
  2. Extract context: Parse body, sender, subject, thread history.
  3. Trigger agent: Pass context to Claude Code with a prompt template.
  4. Agent responds: The agent uses MCP tools to reply on the same thread.

Configuring retry logic for email MCP

For webhooks, acknowledge deliveries promptly and keep the handler idempotent, because slow or failed responses can trigger retries. send.io is expected to retry failed deliveries with backoff, and exhausted retries may move to a dead-letter state in dashboard logs, but confirm the retry schedule and final-state behavior in the send.io API webhooks section. Use the message ID as a deduplication key, since network retries can deliver the same event twice.

Defining scoped access for email agents

Scoped access limits what a misbehaving agent can read or change. The sections below cover logical limits on inbox visibility, key rotation, and the tool call logs that show what the agent actually did.

Limit agent visibility to inbox subfolders

Use the update-thread tool to label threads (e.g., "processed," "escalated," "spam-review"), and configure the agent's prompt to only read threads with specific labels. Enforce the same split in your own handler. This adds logical access control on top of credential-level scoping.

Managing scoped key expiration

Don't assume scoped keys expire on their own. Confirm the expiration behavior. For production, implement rotation:

  1. Generate a new key via the API or dashboard.
  2. Update the MCP configuration with the new key.
  3. Revoke the old key after confirming normal operation.

The create-api-key tool creates a key (the token is shown once) and remove-api-key revokes one, but only a Full access connection can manage keys, so rotate from the dashboard or a Full access connection. Revoking a key takes effect right away, so requests made with the old key fail the moment you revoke it. Update the MCP configuration with the new key first. A key can't delete itself, so revoke the old key with a different credential. The key management reference covers the create, update, and delete routes. Run the full rotation against a non-production inbox before you rely on it.

Monitor Claude Code tool call history

Each tool call is an API request made with the connection's access, so it appears in Logs next to your other requests, and the list-logs and get-log tools query them. Each log records the method, path, status, timing, and user agent. Also log every tool call on the client side with the agent's identity, tool name, parameters, and response status, so you can reconstruct what the agent actually did.

Diagnosing email server integration issues

Most agent email failures fall into a small set of categories, each with a recognizable error signal and a programmatic fix. The table below summarizes the common failure modes, and the subsections that follow walk through each diagnosis in detail.

Failure Mode

Error Signal

Programmatic Resolution

SMTP timeout

421 or 450 response, connection reset

Retry with exponential backoff. A 451 means the message was not stored, so a retry is safe

API rate limit

429 response with Retry-After header

Queue requests and respect the Retry-After interval

Scoped

401 or 403 on all tool calls

Rotate the key and update MCP configuration

Webhook delivery failure

Endpoint timeout or non-2xx response

Check endpoint health, review retry logs, implement idempotent handler

Resolving MCP server discovery issues

If Claude Code doesn't list the send.io server:

  1. Validate JSON syntax: Run jq . claude_desktop_config.json. Invalid JSON can prevent the client from loading any servers.
  2. Check the URL: Confirm the URL in your config is the hosted endpoint, https://api.send.io/mcp.
  3. Verify the environment variable: Run echo $SENDIO_API_KEY in the shell where you launch Claude Code. Variables in .bashrc may not propagate to GUI-launched apps.

Resolving MCP server access denials

A 401 means the request lacks valid authentication credentials, so generate a new key or sign in again if yours is invalid, expired, or revoked. A 403 means the server understood the request but refuses it, which here usually points to a missing permission. Full access can also manage domains, keys, webhooks, and templates, while Sending only limits the assistant to sending email, so a 403 on those tools from a Sending only connection is expected. Reconnect with Full access if the agent needs them.

Handling webhook timeout errors

Webhook response timeouts vary by platform, so confirm send.io's current threshold in the send.io API webhooks section. If your endpoint responds too slowly or times out, send.io may mark the delivery failed and retry it, so confirm the retry behavior in the same section. Common causes:

  • Cold start latency: Serverless handlers may exceed the timeout after idle time. Use warm-up pings or provisioned concurrency.
  • Synchronous processing: Return 200 immediately and process asynchronously via a queue.
  • DNS issues: Test with a public URL first.

Diagnosing message routing errors

If inbound messages aren't reaching the agent inbox, check MX records for your domain. For a custom domain with receiving enabled, publish the DNS records that the create-domain or get-domain tool returns, then run verify-domain to check them. The domain management section covers DKIM, SPF, DMARC, and return path configuration. The SMTP protocol guide explains lower-level mechanics.

Hardening your Claude Code MCP for production

A pilot that works on clean inputs still needs error capture, a session ceiling, and a named owner before it handles production traffic. The sections below cover each operational layer, plus the tests that catch regressions before you deploy prompt or model changes.

Capturing email MCP error states

Log every tool call result, not just successes. MCP servers generally report tool failures as error responses, but send.io's exact error format isn't documented here, so confirm the codes and messages. Key error states:

  • Tool call timeout: The API didn't respond within the client's timeout
  • Permission denied: The connection or key lacks the required permission
  • Rate limited: Too many requests in the current window
  • Invalid parameters: The agent constructed a malformed tool call

Implement turn budgets for MCP agents

Set a maximum number of tool calls per session to prevent runaway loops. Pick an explicit ceiling that matches your workload and route the session to human review when it is hit, since no authoritative default exists. On hitting the budget, halt execution, log session state, and alert on-call. High hit rates signal prompt or model instability, not complex tasks.

Assigning on-call duties for MCP emails

Your runbook for agent email failures:

  1. Check webhook delivery logs for failed or timed-out deliveries
  2. Check API key and connected app status for revoked or expired credentials, including the Connected AI apps list on the API keys page
  3. Check agent session logs for error states and budget hits
  4. Verify MX record health for the receiving domain

The transactional email production checklist covers pre-deployment verification steps that apply to agent email pipelines.

Implement unit tests for email workflows

Extract edge cases from production traffic into test datasets. Use test addresses that simulate bounces, complaints, and failures without affecting sender reputation, and confirm which test addresses send.io offers. Build a harness that sends known inputs and asserts on the agent's tool call sequence and response. Run these in CI before deploying prompt or model changes.

Ready to test the full path? Provision an agent inbox and connect it to your MCP-compatible assistant. The MCP server reference and agent mailbox docs have everything you need.

FAQs

How do you send and receive email from Claude Code through the send.io hosted MCP endpoint?

Run claude mcp add --transport http sendio https://api.send.io/mcp in your terminal, then run /mcp in Claude Code, pick sendio, and sign in. The server exposes 160 tools covering sending, received emails, agent inbox threads, and attachments. send.io runs the server, so there is nothing to install. For an API key instead of the OAuth sign-in, follow the API key steps.

Does the send.io hosted MCP endpoint support multiple agent inboxes?

Yes. The create-inbox and list-inboxes tools manage multiple agent inboxes from one connection, as described in the agent mailbox guide. To isolate agents from each other, create multiple server entries, each with a different scoped key per inbox. Client-side tool naming depends on the entry name (e.g., sendio-support, sendio-scheduling), so check how your session namespaces the tools.

What happens when a webhook delivery fails?

send.io is expected to retry failed deliveries with backoff, and exhausted retries may move to a dead-letter state in dashboard logs. Confirm the retry behavior in the send.io API webhooks section. Return 2xx promptly and use the message ID as a deduplication key.

How do you rotate API keys without breaking running agents?

Generate a new key, update the MCP configuration, restart Claude Code, verify normal operation, then revoke the old key. Confirm whether credential changes apply immediately, so you can plan for a brief window where the old credential stops working.

Does the MCP server support attachments and HTML email?

Yes. The send-email tool accepts inline html and text, and the attachment tools (get-email-attachment and get-received-email-attachment) return a download URL for each attachment on sent and received email. The get-received-email tool returns a received email with its headers, html, and text. The send.io API webhooks section describes the inbound payload structure, including how message bodies and attachments are delivered.

Key terms glossary

MCP (Model Context Protocol): An open protocol built on JSON-RPC 2.0, commonly carried over Streamable HTTP, that lets AI assistants call external tools. send.io's hosted MCP server exposes 160 tools to Claude Code over Streamable HTTP without custom adapters.

Agent inbox: A dedicated email address provisioned via POST /v0/inboxes with its own IMAP/SMTP credentials and scoped API key.

Scoped API key: An API key with a permission list that restricts which actions the holder can perform. An inbox-scoped key is intended to cover only its own inbox and not other inboxes or account settings. Confirm the permissions a key carries.

Inbox pod: A grouping of agent inboxes for isolation. A pod's key sees only that pod's inboxes, and a pod can't be deleted while holding inboxes.

Turn budget: A maximum tool call count per agent session before execution halts and alerts on-call. Prevents runaway loops.

Streamable HTTP: The MCP transport protocol that replaced HTTP+SSE in the March 2025 specification, enabling bidirectional communication over standard HTTP connections.