postkeep
OfficialAllows connecting Gmail mailboxes via app password or Google OAuth sign-in, treats labels as folders, and provides tools to search, read, reply, send, file, flag, move, and delete mail and attachments.
Allows connecting iCloud Mail accounts with an app-specific password and provides tools to list folders, search and read messages, download attachments, send and reply, manage flags, move/delete messages, and create folders.
This server has a remotely hosted endpoint. Open its connector listing for connection details, authentication requirements, and setup instructions:
postkeep
postkeep is a free, MIT-licensed MCP server for iCloud, Gmail, Outlook, Fastmail, Yahoo and IMAP mail. Your agent can search, read, reply and file, and a webhook can tell it when new mail arrives.
Mailboxes
Mailbox | How you connect |
iCloud Mail | An app-specific password. The sign-in page shows the steps. |
Gmail | An app password, or Sign in with Google. Labels show up as folders. (setup) |
Outlook.com and Microsoft 365 | Sign in with Microsoft, with a personal or a work or school account. (setup) |
Fastmail | An app password. |
Yahoo Mail | An app password. |
Your own IMAP server | Added by the server's operator, with IMAP and SMTP settings. (setup) |
For Outlook, and for Gmail with Sign in with Google, you register one OAuth app with Microsoft or Google. The setup guides walk you through it. Each connection is one mailbox, so add the server to your agent app once for each mailbox you want.
Related MCP server: mailmux
Self-host
Fits the machine you have. A VPS, a home server, a container platform or Kubernetes. Give it HTTPS, the master key and a volume or PostgreSQL.
SQLite or PostgreSQL. SQLite by default. Point it at PostgreSQL and set
POSTKEEP_WEBHOOKS=falseto run several replicas.You hold the key. Saved app passwords, Microsoft and Google sign-ins, webhook secrets and filter patterns, stored events and uploaded files, in your bucket, are encrypted with AES-256-GCM under data keys wrapped by a master key you generate.
You choose who connects. List the addresses allowed to use your server in
POSTKEEP_ALLOWED_EMAILS. postkeep checks it at sign-in and on every request.An account page for each person. At
/accounton your server, each person can see their connection, disconnect their agent apps, set up a webhook, or delete what the server keeps about them.Whoever holds the key can read the saved passwords and sign-ins. Connect a mailbox only to a server whose operator you trust.
The threat model says what the server protects and how. To report a vulnerability privately, see SECURITY.md.
Install
You need a machine with Git and Docker (with Compose), a domain name that points at it, and ports 80 and 443 open.
# App plus Caddy, which gets the HTTPS certificate for you
git clone https://github.com/postkeep/postkeep.git
cd postkeep/deploy/compose
cp -i .env.example .env && chmod 600 .env
# Generate MASTER_KEY once, and keep a copy somewhere safe
docker run --rm postkeep/postkeep generate-key
# edit .env: PUBLIC_URL, MASTER_KEY, ALLOWED_EMAILS, DOMAIN, CLIENT_IP_HEADER
docker compose --profile caddy up -dWith ALLOWED_EMAILS empty, anyone who reaches your server can connect a
mailbox.
Back up the master key apart from the data, and keep the same key across restarts and upgrades: it decrypts the saved passwords and sign-ins. With another key, everyone must connect again, and webhook secrets, queued events and filter rules are lost. To change it, rotate it.
The latest image is built from main: read
Upgrading before you pull a newer one. Docker
without Compose, the binary with systemd, Fly.io and Kubernetes are in the
deployment guide, which ends with a security checklist.
Connect your agent app
Add this address to your agent app: https://mail.example.com/mcp.
The app needs remote MCP with OAuth sign-in. The Agent apps page has the steps for Claude, ChatGPT, Grok, Cursor and VS Code.
For setup in AI editors, see the agent install guide and client configuration examples.
When you add the address, the app opens postkeep's sign-in page. Sign in with an app password, or with Microsoft or Google once you have set up their sign-in. Then ask your agent to list your folders.
Your agent reads your mail, attachments included, and text in a message can try to steer it. Each tool is marked read-only or not, so many agent apps ask you before anything is sent, moved or deleted: keep that on. postkeep itself doesn't ask.
MCP tools
Tool | What it does |
| Lists your folders and their roles, such as Inbox, Sent and Trash. |
| Searches a folder by sender, recipient, subject, text, date, unread or flagged, newest first. |
| Reads one message: headers, the body as Markdown (links and images as references, never loaded) or plain text, and the attachment list with ids; |
| Downloads one attachment of a message: images as images, text as text, other files as base64, or any file as base64 with |
| Sends a new plain-text email with any attachments or forwards a message with its attachments. Saves a copy to Sent by default. |
| Replies, or replies to all, with any attachments, and keeps the thread together. |
| Saves a new draft or threaded reply, with any attachments, to the Drafts folder without sending it. Not available for Outlook or for Gmail with Sign in with Google. |
| Marks a message read or unread, flagged or unflagged. |
| Moves a message to another folder. |
| Moves a message to the trash, or deletes it for good when you ask. |
| Creates a new folder. |
| Gives a one-time upload for one file's bytes, sent with a command, to attach to one message. Off unless the server has a bucket. |
| Shows whether this mailbox's new-mail webhook is active, paused, off, not set up, unreadable, waiting for a new password, or |
| Turns this mailbox's new-mail webhook on or off. |
| Sets how long new-mail events are kept, and how many. |
| Lists this mailbox's webhook filter rules, oldest first, a page at a time. |
| Adds a rule that chooses which new mail sends an event. |
| Removes one filter rule, or all of them. |
The tool reference has each tool's options and how providers differ.
New-mail webhooks
Turn on a webhook for a mailbox on the account page, and postkeep sends a small event, signed by default, to an HTTPS address you choose when mail lands in the Inbox. Point it at something that can wake your agent. Events carry the folder, the message id and the date, and no message body. New-mail webhooks has the payload and how to check the signature.
You set the webhook address and its secrets yourself, on your server's account page. The webhook tools can't change them, so an agent that reads untrusted mail can't redirect your webhook, though it can silence it with filter rules (threat model).
Documentation
Configuration: every setting
Embedding: run the server from your own Rust binary
Contributing
CONTRIBUTING.md has the checks, the integration tests and the pull request workflow; CHANGELOG.md lists the changes.
License
Licensed under the MIT license.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you shall be licensed as above, without any additional terms or conditions.
postkeep is an independent project. It is not affiliated with, sponsored by or endorsed by Anthropic, Anysphere, Apple, Docker, Fastmail, GitHub, Google, Microsoft, OpenAI, xAI or Yahoo. Product names and logos are trademarks of their owners.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
Email infrastructure for AI agents — send, receive, search, and reply to email over MCP.
Email inboxes for AI agents: send, receive, reply, search, and manage threaded email over MCP.
Hosted MCP server for your Gmail, Outlook and IMAP mail, with mailboxes and scopes set per agent.
Hosted email MCP for your own Gmail, Outlook.com, Microsoft 365, iCloud or IMAP inbox: read, search, draft, reply in thread, forward and file mail. It moves or flags up to 500 messages in one call, and a send leaves exactly one copy in Sent. A calendar is a separate connection, and connecting one adds diary and scheduling tools.
Related MCP Servers
- AlicenseNot gradedqualityBmaintenanceAn open-source MCP server that provides AI agents with secure access to read, search, and manage emails via Microsoft 365 and Gmail. It features security-first defaults like recipient allowlists and markdown content conversion to facilitate safe agent interaction with mailboxes.7Apache 2.0
- AlicenseNot gradedqualityAmaintenanceA self-hosted MCP server that unifies multiple IMAP/SMTP mailboxes into one agentic inbox, enabling agents to list, search, read, and send email through MCP tools.MIT
- AlicenseNot gradedqualityNot gradedmaintenanceA self-hosted, multi-mailbox MCP server that exposes IMAP/SMTP operations as tools for AI agents, enabling email management like listing folders, reading, searching, sending, and moving messages via natural language.MIT
- FlicenseAqualityBmaintenanceA local stdio MCP server that gives any MCP client one connection to all of the user's Gmail, Google Workspace and IMAP accounts at once, letting assistants list accounts, read messages and attachments, run full-text search across mailboxes, trigger syncs and export messages as .eml. It runs on the user's own computer with encrypted secrets and no intermediary server, so mail is fetched directly from the providers.91-