Give an MCP agent its own email address
MCP lets an agent use email the way it uses any other tool. Add one server to your client and the agent can create an inbox, send, reply and wait for a code.
Updated 2 min read
On this page (4)
Connect your client
Mailbay runs a remote MCP server at https://mcp.mailbay.dev/mcp (streamable HTTP). It authenticates with a Mailbay API key in the Authorization header; OAuth sign in is planned. Create a key on the API keys page of the dashboard first.
Claude Code
claude mcp add --transport http mailbay https://mcp.mailbay.dev/mcp \
--header "Authorization: Bearer $MAILBAY_API_KEY"Cursor and other clients with remote servers
{
"mcpServers": {
"mailbay": {
"url": "https://mcp.mailbay.dev/mcp",
"headers": { "Authorization": "Bearer mb_live_xxxxxxxxx" }
}
}
}Claude Desktop and other stdio only clients
mailbay-mcp stdio is a small local process that forwards every request to the remote server with your key, so its tools and errors are always the remote ones.
{
"mcpServers": {
"mailbay": {
"command": "mailbay-mcp",
"args": ["stdio"],
"env": { "MAILBAY_API_KEY": "mb_live_xxxxxxxxx" }
}
}
}The tools
Fifteen tools, each a thin wrapper over the same code the REST API runs:
| create_inbox | A new address, live immediately, on your mailbay.email code or a verified domain |
| wait_for_email | Blocks until a match arrives (up to 120 s); returns the message with codes and links |
| send_email, reply | Send from an inbox, or reply in the same thread |
| list_messages, get_message | Read mail, with codes and links pulled out of every message |
| list_threads, get_thread | Whole conversations, oldest first |
| list_inboxes, get_inbox, delete_inbox | Manage inboxes |
| add_domain, verify_domain, list_domains | Your own domain and its DNS records |
| create_webhook | Signed events at your URL |
Each description tells the model what the tool returns, which errors it can raise and which tool to call next. Errors come back as tool results with isError: true and a fix, so the agent can correct itself instead of stopping. Why we wrote them that way is in the design notes.
Try it
Once connected, ask in plain words:
Create a Mailbay inbox called "newsletter-test", subscribe it to the newsletter
on example.com, then wait for the confirmation email and open the link in it.The agent should make two Mailbay calls around its own browsing:
create_inbox {"name": "newsletter-test"}
→ {"id": "ibx_…", "address": "newsletter-test@k7m3qz.mailbay.email", "created_at": "…"}
wait_for_email {"inbox_id": "ibx_…", "after": "<created_at>", "timeout_seconds": 120}
→ {"message": {…}, "codes": [], "links": ["https://example.com/confirm?t=…"]}For one address per task without creating inboxes, use the Catch-all: any address under your code works, and wait_for_email takes a to argument with the exact address.
tools/list and a wait_for_email call on the Catch-all against a local Mailbay MCP server: it returned the code and link from an email sent over SMTP a second after the call started.Keep it contained
- Use an inbox key for an agent that should only ever touch one inbox. Tools that reach beyond it answer
insufficient_scope. - Sending is sandboxed until you verify a domain: from
mailbay.emailaddresses, mail only reaches your own team and the test addresses. - Every message carries its SPF, DKIM and DMARC results and a spam flag, so you can tell the agent to ignore mail that fails them before it follows a link.
- Keys are revocable at once. The MCP server checks the key on every request, so deleting it stops the agent immediately.
Full reference: MCP docs. Building the agent in code instead of a client? Email inboxes for AI agents has the same flow over HTTP.
The MCP setup for each agent tool is on Mailbay for AI agent builders.
Read next
- An email inbox for your AI agentAn agent that signs up for things needs an address that receives mail, and a way to get the code out of it without polling. Here is the whole flow in three steps.
- MCP serverConnect any MCP client and the tools it gets.
- Mailbay vs OpenMailOpenMail and Mailbay both start from the same idea: an agent should have its own inbox. They differ on custom domains, policy controls and what else sits in the product.
Join the beta
Mailbay is in private beta and free while the beta runs: inboxes, sending, your own domains and MCP. We invite people in small batches and read every note on the form.