# Agent Mail Gateway

A self-hosted Docker proxy that gives AI assistants controlled access to mailboxes. It filters contacts, converts email to Markdown, and checks outgoing drafts.

- MCP server · `type=mcp` · Claude Code, Codex, Cursor, GitHub Copilot, Windsurf (Devin Desktop), Cline, Zed · ★ 12
- Author: dominikamann
- License: MIT · policy=link-only · description only; the file stays with the author
- Source: https://github.com/dominikamann/agent-mail-gateway
- Updated: 2026-10-20
- HTML: https://affpapa.org/en/nevibecode/mcp/agent-mail-gateway

## What it does

The service operates as a single Docker container sitting between your AI assistants and your standard mail server. Rather than exposing raw IMAP or SMTP passwords, you issue an isolated API token tied to a single address. The gateway strips heavy HTML and delivers incoming text as Markdown, trimming prompt size.

Protection applies in both directions. Incoming mail undergoes virus scans, spoofing checks, and prompt injection filters before the agent ever sees it. Before an outgoing message leaves, built-in heuristics catch missing attachments, blank bodies, and unresolved placeholders. You can also connect a local model via Ollama to evaluate outgoing tone and enforce custom communication guidelines.

Never attach your personal inbox to this gateway: unapproved senders get moved to the trash folder automatically. Each assistant needs a dedicated address on your mail domain.

## Requirements
- Needs: Docker

## Install

### Claude Code (native platform)

**Install**
- The MCP registry has no launch command for it: see the repository README

## When to use it
- Restrict agent access to a single inbox using dedicated API keys instead of server passwords
- Convert incoming rich emails into Markdown to reduce context token consumption
- Intercept outgoing messages containing missing attachments, empty bodies, or leftover draft markers
- Process and respond to calendar invites across common email clients
- Inspect inbound correspondence for prompt injections, suspicious attachments, and forged senders

## Example prompts
- Check for any unread incoming messages from approved senders and summarize them in Markdown.
- Draft a reply to the latest thread, attach `report.csv`, and run the safety checks before sending.
- Send a meeting invitation for tomorrow at 15:00 UTC to the project team and track their replies.

## Similar
- [REA](https://affpapa.org/en/nevibecode/mcp/rea.md) — MCP server · ★ 392262
- [GitHub](https://affpapa.org/en/nevibecode/mcp/github.md) — MCP server · ★ 33989
- [Netdata](https://affpapa.org/en/nevibecode/mcp/netdata.md) — MCP server · ★ 81163
- [browser-use](https://affpapa.org/en/nevibecode/mcp/browser-use.md) — MCP server · ★ 119231
- [Codebase Memory](https://affpapa.org/en/nevibecode/mcp/codebase-memory.md) — MCP server · ★ 47577
- [mcp-server](https://affpapa.org/en/nevibecode/mcp/mcp-server.md) — MCP server · ★ 43902

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
