# Agent Mail Gateway

> Agent Mail Gateway is an open-source MCP server for communication. Self-hosted gateway giving each AI agent a restricted mailbox with allow lists and checks. It runs as a hosted remote server, so there is nothing to install locally.

- **Kind:** MCP server
- **Pricing:** Open source
- **Platforms:** Self-hosted, API
- **Repository:** https://github.com/dominikamann/agent-mail-gateway
- **MCP Registry name:** io.github.dominikamann/agent-mail-gateway
- **Categories:** [communication](https://ai-powered.com/categories/communication), [security](https://ai-powered.com/categories/security)
- **Listing updated:** 2026-11-23

## About

The gateway sits between an agent and a normal IMAP and SMTP mailbox. The agent holds only an API key for one mailbox and never sees the password. Allow lists decide who it may receive mail from and write to; mail from other senders is hidden and moved to Trash by default.

Incoming messages arrive as compact Markdown rather than HTML. Attachments and content can be checked for dangerous file types, viruses through ClamAV and prompt injection, each set to hide, flag or off. Outgoing mail is reviewed before it leaves by built-in rules, an optional LLM review and optional plain-language policies, and a send limit and audit log apply.

Calendar invitations can be sent, updated and answered, and signed webhooks announce new mail. It runs as one Docker container with a SQLite state file, speaks MCP over streamable HTTP or a REST API, and works with any IMAP/SMTP server.

## Features

- **One key per mailbox:** Agents get an API key, not the mailbox password.
- **Allow lists:** Restrict senders and recipients per mailbox.
- **Incoming checks:** Flag or hide risky files, viruses and prompt injection.
- **Review before sending:** Rules, optional LLM and policies block sloppy mail.
- **Calendar invitations:** Send, update, cancel and answer invites.
- **Markdown mail:** HTML converts to compact Markdown to save tokens.

## Good for

- Give an assistant its own address without exposing a personal inbox
- Stop prompt-injected emails from reaching an agent
- Let an agent schedule meetings by invitation
- Audit every email an agent sends

## Install

### Claude Code: Add with the CLI (Terminal)

```sh
claude mcp add agent-mail-gateway -- docker run -i --rm ghcr.io/dominikamann/agent-mail-gateway:0.5.0
```

Add --scope user to use it in every project, or --scope project to share it in .mcp.json.

### Claude Code: Or share it with your project (.mcp.json)

```json
{
  "mcpServers": {
    "agent-mail-gateway": {
      "command": "docker",
      "args": [
        "run",
        "-i",
        "--rm",
        "ghcr.io/dominikamann/agent-mail-gateway:0.5.0"
      ]
    }
  }
}
```

### Claude Desktop (claude_desktop_config.json)

```json
{
  "mcpServers": {
    "agent-mail-gateway": {
      "command": "docker",
      "args": [
        "run",
        "-i",
        "--rm",
        "ghcr.io/dominikamann/agent-mail-gateway:0.5.0"
      ]
    }
  }
}
```

Settings → Developer → Edit Config, then quit and reopen Claude Desktop.

### Cursor (~/.cursor/mcp.json)

```json
{
  "mcpServers": {
    "agent-mail-gateway": {
      "command": "docker",
      "args": [
        "run",
        "-i",
        "--rm",
        "ghcr.io/dominikamann/agent-mail-gateway:0.5.0"
      ]
    }
  }
}
```

Use .cursor/mcp.json in a project to share it with the project.

### VS Code (~/.copilot/mcp-config.json)

```json
{
  "mcpServers": {
    "agent-mail-gateway": {
      "type": "stdio",
      "command": "docker",
      "args": [
        "run",
        "-i",
        "--rm",
        "ghcr.io/dominikamann/agent-mail-gateway:0.5.0"
      ]
    }
  }
}
```

Or put the same entry in .mcp.json at your workspace root to share it.

### Codex: Add with the CLI (Terminal)

```sh
codex mcp add agent-mail-gateway -- docker run -i --rm ghcr.io/dominikamann/agent-mail-gateway:0.5.0
```

### Codex: Or add to config.toml (~/.codex/config.toml)

```toml
[mcp_servers.agent-mail-gateway]
command = "docker"
args = ["run", "-i", "--rm", "ghcr.io/dominikamann/agent-mail-gateway:0.5.0"]
```

### Gemini CLI and Antigravity: Gemini CLI (~/.gemini/settings.json)

```json
{
  "mcpServers": {
    "agent-mail-gateway": {
      "command": "docker",
      "args": [
        "run",
        "-i",
        "--rm",
        "ghcr.io/dominikamann/agent-mail-gateway:0.5.0"
      ]
    }
  }
}
```

Or run: gemini mcp add -s user agent-mail-gateway docker -- run -i --rm ghcr.io/dominikamann/agent-mail-gateway:0.5.0

### Gemini CLI and Antigravity: Antigravity (~/.gemini/config/mcp_config.json)

```json
{
  "mcpServers": {
    "agent-mail-gateway": {
      "command": "docker",
      "args": [
        "run",
        "-i",
        "--rm",
        "ghcr.io/dominikamann/agent-mail-gateway:0.5.0"
      ]
    }
  }
}
```

Use .agents/mcp_config.json to add it to one workspace only.

### Devin Desktop (~/.config/devin/mcp_config.json)

```json
{
  "mcpServers": {
    "agent-mail-gateway": {
      "command": "docker",
      "args": [
        "run",
        "-i",
        "--rm",
        "ghcr.io/dominikamann/agent-mail-gateway:0.5.0"
      ]
    }
  }
}
```

On Windows the file is %APPDATA%\\devin\\mcp_config.json. Use .devin/mcp_config.json to share it with a project.

### Cline (cline_mcp_settings.json)

```json
{
  "mcpServers": {
    "agent-mail-gateway": {
      "command": "docker",
      "args": [
        "run",
        "-i",
        "--rm",
        "ghcr.io/dominikamann/agent-mail-gateway:0.5.0"
      ]
    }
  }
}
```

Open it from the MCP Servers icon → Configure → Configure MCP Servers.

### Zed (Zed settings.json)

```json
{
  "context_servers": {
    "agent-mail-gateway": {
      "command": "docker",
      "args": [
        "run",
        "-i",
        "--rm",
        "ghcr.io/dominikamann/agent-mail-gateway:0.5.0"
      ]
    }
  }
}
```

Open it with zed: open settings file. Merge context_servers into the settings you already have.

### JetBrains AI Assistant and Junie: AI Assistant (Settings → Tools → AI Assistant → Model Context Protocol (MCP) → Add)

```json
{
  "mcpServers": {
    "agent-mail-gateway": {
      "command": "docker",
      "args": [
        "run",
        "-i",
        "--rm",
        "ghcr.io/dominikamann/agent-mail-gateway:0.5.0"
      ]
    }
  }
}
```

### JetBrains AI Assistant and Junie: Junie (~/.junie/mcp/mcp.json)

```json
{
  "mcpServers": {
    "agent-mail-gateway": {
      "command": "docker",
      "args": [
        "run",
        "-i",
        "--rm",
        "ghcr.io/dominikamann/agent-mail-gateway:0.5.0"
      ]
    }
  }
}
```

Use .junie/mcp/mcp.json to share it with a project.

### Kiro (~/.kiro/settings/mcp.json)

```json
{
  "mcpServers": {
    "agent-mail-gateway": {
      "command": "docker",
      "args": [
        "run",
        "-i",
        "--rm",
        "ghcr.io/dominikamann/agent-mail-gateway:0.5.0"
      ]
    }
  }
}
```

Use .kiro/settings/mcp.json to add it to one workspace only.

### Other clients (your client's MCP settings (most use this shape))

```json
{
  "mcpServers": {
    "agent-mail-gateway": {
      "command": "docker",
      "args": [
        "run",
        "-i",
        "--rm",
        "ghcr.io/dominikamann/agent-mail-gateway:0.5.0"
      ]
    }
  }
}
```

## Tools

From the tool list in its README, going by the names, all 1 tool only read data. From the server's own tool labels and tool names; not verified by us.

- `get_attachment` (name suggests: reads): Returns an attachment, including PDF or image text with format text.

## FAQ

### What does Agent Mail Gateway need?

Docker and an IMAP/SMTP mailbox, preferably dedicated to the agent.

### Can the agent read all mail?

No, only mail from allowed senders.

### What happens to a bad outgoing mail?

It is rejected with a review_rejected error and the reasons.

### Does Agent Mail Gateway read attachments?

get_attachment can return PDF and image text, using a vision model or Tesseract OCR.

### Is Agent Mail Gateway free?

Yes. Agent Mail Gateway is open source, so you can use and self-host it for free.

### How do I add Agent Mail Gateway to Claude Code?

Run this command in your terminal: claude mcp add agent-mail-gateway -- docker run -i --rm ghcr.io/dominikamann/agent-mail-gateway:0.5.0

### What are the best alternatives to Agent Mail Gateway?

The closest alternatives to Agent Mail Gateway are REA, TrendRadar, AiSOC, x64dbg-mcp-server and redamon.

## Where this comes from

- Description: written from the project's README.
- Install steps: from the official MCP Registry entry.

## Alternatives

- [REA](https://ai-powered.com/mcp/rea): REA is an open-source MCP server for developer tools.
- [TrendRadar](https://ai-powered.com/mcp/trendradar): TrendRadar is an open-source MCP server for communication.
- [AiSOC](https://ai-powered.com/mcp/aisoc): AiSOC is an open-source MCP server for ai models and llm tooling.
- [x64dbg-mcp-server](https://ai-powered.com/mcp/x64dbg-mcp-server): x64dbg-mcp-server is an open-source MCP server for ai models and llm tooling.
- [redamon](https://ai-powered.com/mcp/redamon): redamon is an open-source MCP server for ai models and llm tooling.
- [TryPost](https://ai-powered.com/mcp/trypost): TryPost is a paid MCP server for marketing and seo.
- [Treasure Map](https://ai-powered.com/mcp/treasure-map): Treasure Map is an open-source MCP server for security.
- [Agent Roast](https://ai-powered.com/mcp/agent-roast): Agent Roast is an open-source MCP server for developer tools.

---
Source: https://ai-powered.com/mcp/agent-mail-gateway
