Agent Mail Gateway logo

Agent Mail Gateway

Self-hosted MCP email gateway giving agents controlled mailbox, messaging, attachment, and calendar access.

Install Agent Mail Gateway

Run the project’s own setup commands, in order.

Setup steps from the project

Agent Mail Gateway installs with its own steps rather than a config we can generate, so these are copied as-is. Follow them in order and run the commands in a terminal. Source: github.com

  1. 1. Configure
    mkdir agent-mail-gateway && cd agent-mail-gateway
    
  2. 2. Configure
    curl -LO https://raw.githubusercontent.com/dominikamann/agent-mail-gateway/main/docker-compose.yml
    
  3. 3. Configure
    curl -L -o config.yaml https://raw.githubusercontent.com/dominikamann/agent-mail-gateway/main/config.example.yaml
    
  4. 4. Configure
    curl -L -o .env https://raw.githubusercontent.com/dominikamann/agent-mail-gateway/main/.env.example
    
  5. 5. Start the server
    docker compose up -d
    

Overview

The Agent Mail Gateway MCP server connects AI agents to existing IMAP/SMTP mailboxes through per-mailbox API keys. It exposes tools for reading, searching, sending, replying to, and managing email, plus attachments and calendar invitations. Allow lists, send limits, audit records, and configurable pre-send reviews restrict agent actions. Use it when an agent needs email access without receiving the mailbox password or unrestricted access to incoming and outgoing mail.

Use cases

  • Give an AI agent a dedicated email address
  • Restrict agent communication to approved contacts
  • Let agents manage email attachments
  • Process calendar invitations through MCP
  • Review agent-written messages before sending

Key features

  • Per-mailbox API-key authentication
  • IMAP and SMTP email access
  • Markdown email conversion
  • Attachment and thread handling
  • Calendar invitation management
  • Rules, LLM, and policy-based send review

Tools10

What Agent Mail Gateway lets your agent do. Expand a tool for its parameters.

Self-reported~181 tokens of context

Security & health

What it can reach and how reliably it runs — from our own checks, not the maintainer’s claims.

ActiveLast checked

Recent health check succeeded.

13/13 checks healthy over the last 52d

Adoption & maintenance

Factual signals from GitHub, npm, and our automated checks — not a rating.

GitHub stars18Stargazers on the source repository.
Last commit7d agoMost recent push to the default branch.
Tools exposed10Callable tools this server registers over MCP.

How Agent Mail Gateway works

What Agent Mail Gateway does

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.

How the Agent Mail Gateway MCP server works

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.

Setup and configuration

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.

Tools and capabilities

The Agent Mail Gateway MCP server exposes tools to:

  • Inspect mailbox identity, current time, limits, allow lists, and review settings.
  • List received messages with unread, text, sender, subject, and date filters.
  • Read messages as Markdown and inspect attachment and invitation information.
  • Download attachments, mark messages read or unread, and move permitted messages to Trash.
  • Send new messages, reply or reply-all, and forward messages with attachments.
  • Create, update, or cancel calendar invitations; list events and attendee responses.
  • Accept, decline, or tentatively accept received invitations.

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.

Limitations and notes

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.

Written by AllMCPs with AI assistance from the project’s README and listing data. How we build listings

Reviews

No reviews yet — be the first to share how it worked for you.

Frequently Asked Questions about Agent Mail Gateway

Agent Mail Gateway is an MCP server that connects AI agents to existing IMAP/SMTP mailboxes without exposing mailbox passwords. Its main tools list, read, search, send, reply to, and manage messages and attachments, plus create events, list events, and respond to calendar invitations.

Install it with Docker Compose using the repository’s compose file, then configure `config.yaml` and `.env`. Add one mailbox entry with IMAP, SMTP, credentials, an API key, and allow lists, start the container, and check `/health`.

Yes. Configure per-mailbox receive and send allow lists using individual addresses or patterns such as `*@yourcompany.eu`. Disallowed incoming mail is hidden from the agent and moved to Trash or retained according to configuration.

Yes. The MCP tools can create, update, and cancel invitations, show events and attendee responses, and accept, decline, or tentatively accept invitations received by the mailbox.

Yes. Built-in checks are enabled by default, while LLM review and plain-language policies are optional. Reviews can block or warn about issues such as empty messages, missing attachments, placeholders, duplicates, or policy violations.

Related MCP servers

Add a badge to your READMEShow it’s listed — live SVG, Markdown or HTML.

AllMCPs Directory Badge

Full Badge Customizer

Showcase your server listing on GitHub or your project documentation. Embed this dynamic SVG badge to highlight official listing status and live engagement.

Badge Style:
Live Dynamic SVG PreviewAgent Mail Gateway AllMCPs Directory Badge
Markdown (GitHub README)
[![AllMCPs](https://allmcps.com/api/badge/agent-mail-gateway?style=directory)](https://allmcps.com/mcp/agent-mail-gateway)
HTML Embed
<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>