Self-hosted MCP email gateway giving agents controlled mailbox, messaging, attachment, and calendar access.
Copy the AI prompt to install this server into Claude Code, Cursor, or another agent — or use 1-click editor setup below.
💡 Paste the JSON block into your client's configuration file under mcpServers, then restart the application.
Inspect callable tools, capabilities, and parameters exposed to AI agents by Agent Mail Gateway.
get_mailbox_infoOwn address, current date and time, allow lists, limits and the review rules/policies
list_messagesReceived mail, newest first; filter by unread, or search by text, sender, subject, date
read_messageOne message as Markdown, incl. attachments list and received invitations
get_attachmentDownload an attachment
mark_messageMark read/unread; move to Trash (if allowed)
send_messageSend a new email (Markdown, attachments)
The Agent Mail Gateway MCP server gives an AI agent controlled access to a mailbox hosted on an existing mail server. Each configured mailbox has its own API key, and the gateway keeps the IMAP and SMTP credentials out of the agent. It can expose mail as Markdown, convert outgoing Markdown to HTML, and handle calendar invitations alongside ordinary email.
The service is intended for self-hosting, typically as one Docker container. Mail remains on the configured mail server, while the gateway stores its operational state in SQLite. Agents can connect through MCP over Streamable HTTP, use the included stdio bridge, or call the REST API.
An API key maps to exactly one configured mailbox. Receive and send allow lists determine which addresses the agent can see and contact; patterns such as *@domain are supported. Messages from disallowed senders are hidden from the agent and are moved to Trash or retained according to configuration.
Before sending an email or calendar invitation, the gateway can run fixed checks, optional LLM review, and administrator-defined policy checks. Built-in checks cover cases such as empty content, missing attachments referenced by the message, unresolved placeholders, duplicate messages, missing subjects, and invitations in the past. Reviews can block a request or issue a warning, depending on the mailbox settings.
Run the service with Docker Compose, then create a config.yaml entry for each mailbox. The entry contains the mailbox address, API key, IMAP and SMTP connection details, login credentials, and receive/send allow lists. Secrets can be supplied through .env; the example uses AGENT_API_KEY and AGENT_MAIL_PASSWORD.
The health endpoint runs at /health, and the REST API provides OpenAPI documentation at /docs. A mailbox can be checked with an authenticated request to /v1/mailbox. A dedicated mailbox per agent is recommended because messages outside the receive allow list may be moved to Trash.
The Agent Mail Gateway MCP server exposes tools to:
It also supports signed new-mail webhooks and records sends, rejections, and deletions in an audit log. Calendar invitations are designed to update in Outlook, Gmail, and Apple Calendar.
The gateway does not replace the underlying IMAP/SMTP server; each mailbox still requires working mail-server configuration and credentials. Access is limited by the configured allow lists and review behavior. Optional LLM review uses an OpenAI-compatible endpoint, such as a local Ollama service, and policies can be scoped to particular recipients. The material does not specify a hosted deployment option, so operation requires self-hosting.
Factual signals from GitHub, npm, and our automated checks — not a rating.
No reviews yet — be the first to share how this listing worked for you.
Showcase your server listing on GitHub or your project documentation. Embed this dynamic SVG badge to highlight official listing status and live engagement.
[](https://allmcps.com/mcp/agent-mail-gateway)<a href="https://allmcps.com/mcp/agent-mail-gateway"><img src="https://allmcps.com/api/badge/agent-mail-gateway?style=directory" alt="Agent Mail Gateway on AllMCPs" /></a>