Agent Mail Gateway
dominikamann/agent-mail-gateway
Self-hosted email gateway that gives each AI agent its own IMAP/SMTP mailbox with allow lists
Agent Mail Gateway is a self-hosted service, run as one Docker container, that sits between AI agents and ordinary IMAP/SMTP mailboxes. Agents use MCP or a REST API with one API key per mailbox, and a Hermes Agent plugin and skill are included.
What Agent Mail Gateway does
Agent Mail Gateway keeps the mailbox password to itself. Each agent gets one API key for exactly one mailbox, and per-mailbox allow lists (name@domain or *@domain) decide whom the agent can receive mail from and write to. Mail from other senders is invisible to the agent and moved to Trash, or kept. Forged senders are rejected using the SPF, DKIM and DMARC results from your mail server. Incoming HTML is converted to Markdown to save tokens.
Outgoing mail is reviewed before it leaves. Built-in rules catch empty mails, attachment-only mails, 'see attached' without an attachment, leftover placeholders and duplicates. An optional LLM review, for example a local model in Ollama, and plain-language policies can be added. The gateway also manages calendar invitations, enforces an hourly send limit, keeps an audit log and sends signed webhooks on new mail that are compatible with Hermes Agent webhook routes. It offers MCP over Streamable HTTP, a stdio bridge and a REST API with OpenAPI docs at /docs.
Key features
- One API key per agent, mapped to exactly one mailbox
- Sender and recipient allow lists per mailbox
- Pre-send review with built-in rules, optional LLM check and custom policies
- HTML to Markdown conversion for reading, Markdown to HTML for sending
- Calendar invitations: send, update, cancel and respond
- Signed webhooks on new mail, compatible with Hermes Agent webhook routes
When to use it
- Giving a Hermes agent its own mailbox without sharing the IMAP/SMTP password
- Limiting an agent to replying only to approved contacts
- Letting an agent handle meeting invitations in Outlook, Gmail or Apple Calendar
- Reducing token cost of reading HTML-heavy email
Who it is for: Self-hosters who want AI agents to read and send email through an existing mail server with enforced limits.
How it fits with Hermes Agent
It supports Hermes Agent among other MCP and REST clients, with a Hermes Agent plugin and skill that teaches the agent to use its mailbox, plus webhook compatibility.
Requirements: An IMAP/SMTP mailbox on an existing mail server, and Docker to run the single container
FAQ
What is Agent Mail Gateway?
Agent Mail Gateway is a self-hosted email MCP server and REST gateway. It gives each AI agent one API key for one mailbox while enforcing allow lists and pre-send checks.
Does Agent Mail Gateway work with Hermes Agent?
Yes. It includes a Hermes Agent plugin with a skill, and its signed new-mail webhooks are compatible with Hermes Agent webhook routes.
Is Agent Mail Gateway free and open source?
Yes. The repository is released under the MIT license.
Similar mcp & tools for Hermes Agent
All mcp & toolsMCP server with 104 tools for X/Twitter automation, usable from Hermes Agent and other MCP clients
JorG18 AgentCrawlSelf-hosted web scraper that turns pages into Markdown for AI agents via CLI, API or MCP
JerryLiu369 Agent Web SearchProvider-neutral web search for AI agents as an MCP server, CLI and Python library
rfdiosuao Hermes-Agent-PhoneAndroid app that lets an AI agent control a phone through an HTTP API and accessibility service
ekaya-inc DataClawLocalhost MCP server that gives agents such as Hermes and OpenClaw controlled access to a database
Vasallo94 Obsidian MCP ServerMCP server that lets Hermes, Codex and Claude Code read, search and safely edit Obsidian notes
Related guides: What is Hermes Agent? · How to run Hermes Agent securely