Postern
Provides access to Gmail mailboxes over IMAP and SMTP, enabling folder listing, message search and reading, attachment retrieval, and optional plain-text email sending with attachments.
Provides access to iCloud Mail over IMAP and SMTP, enabling folder listing, message search and reading, attachment retrieval, and optional plain-text email sending with attachments.
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
Postern
A small, self-hosted MCP server that gives Grok Bot (or any MCP client) access to your email when the bot can't connect to mail servers directly.
Postern runs on Google Cloud Run. The bot sends it requests over HTTPS with a secret token, and Postern signs in to your mail provider to read and send email on the bot's behalf.
Tools
Tool | What it does |
| Lists folders |
| Searches a folder by sender, recipient, subject, text, date or unread status |
| Reads one message as plain text, including its Reply-To address, and lists its attachments |
| Downloads an attachment: images as images, text as text, other files as base64 |
| Sends plain-text mail, with attachments and an optional alias or display name. Replies reference the original email, and Postern adds the threading headers and "Re:" subject. Only available when |
Attachments can be new files or attachments of existing emails, which are forwarded without passing through the bot. Messages over 40 MB can't be read, and requests are limited to 25 MB (about 18 MB of new attachments). Most providers only let you send from addresses the account owns.
Related MCP server: mcp-mail
Security
The mail password stays in Google Secret Manager. Bots only get a revocable 256-bit bearer token, and every request without it is rejected.
Folders are opened read-only: reading never marks messages as read, moves or deletes anything.
The mail servers are fixed at deploy time, and connections require TLS 1.2+ with certificate checks.
Sending is only enabled when
SMTP_HOSTis set. A bot that can read and send can be tricked by a malicious email into forwarding your mail, so leave it out unless the bot needs to send.Attachments can only come from the request itself or from emails in the mailbox. Postern never reads files or URLs.
Every sent email is logged with its sender, recipients, attachment count and Message-ID. Review them with
gcloud run services logs read postern --region us-central1 --project $(cat .project-postern).Each deployment gets its own Google Cloud project, so nothing else shares access to its secrets. The service runs as its own service account, which can read only its two secrets, in a distroless non-root container with at most one instance.
Providers
Any provider with IMAP/SMTP password login works. Use an app password, not your main password.
Provider |
|
|
|
iCloud | imap.mail.me.com | smtp.mail.me.com | 587 |
Gmail | imap.gmail.com | smtp.gmail.com | 587 |
Fastmail | imap.fastmail.com | smtp.fastmail.com | 465 |
Yahoo | imap.mail.yahoo.com | smtp.mail.yahoo.com | 465 |
Outlook.com and Microsoft 365 aren't supported, because they no longer allow password login over IMAP.
Deploy to Google Cloud Run
You need the gcloud CLI, signed in with gcloud auth login, and a Google Cloud billing account. Usage at personal scale normally stays within the free tier.
IMAP_HOST=imap.mail.me.com SMTP_HOST=smtp.mail.me.com MAIL_USERNAME=you@icloud.com ./deploy.shThe first run creates a dedicated Google Cloud project, links your billing account (it asks which one if you have several), and asks for the app password. The project ID is saved in .project-postern, so re-running the same command updates the same deployment. Leave out SMTP_HOST for read-only access.
To use an existing project instead, set PROJECT_ID. To remove everything, delete the project with gcloud projects delete $(cat .project-postern).
To serve another mailbox, deploy again with a different SERVICE name (default postern).
Connect Grok Bot
Copy the header value (Bearer plus the token) to your clipboard:
{ printf 'Bearer '; gcloud secrets versions access latest --secret postern-token --project $(cat .project-postern); } | pbcopyIn the Grok Bot app, open Connect apps, choose Add a custom connector, and fill in:
Field | Value |
Name |
|
Type | Remote HTTPS |
Server URL | the MCP endpoint |
HTTP headers | Key |
Client ID | leave empty |
Click Add plugin, then type @ in a bot's chat to attach Postern. Don't paste the token into the chat.
Other MCP clients: use Streamable HTTP at /mcp with the same Authorization header.
Rotate credentials
P=$(cat .project-postern)
# New bot token, then update the connector's header
openssl rand -hex 32 | tr -d '\n' | gcloud secrets versions add postern-token --data-file=- --project $P
# New mail password
read -rs p && printf '%s' "$p" | gcloud secrets versions add postern-mail-password --data-file=- --project $PThen re-run your deploy command, with the same variables, so the service picks up the new values.
Run locally
npm install
cp .env.example .env # fill in your values; MCP_BEARER_TOKEN from `openssl rand -hex 32`
npm run dev # http://127.0.0.1:7993/mcpTool 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
Your mailbox for MCP clients: search, read, draft, send, rules and notes. Sending is off by default.
Your IMAP mailbox as an MCP server: read, search and (if you allow it) organize mail. Open source.
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.
Email infrastructure for AI agents — send, receive, search, and reply to email over MCP.
Related MCP Servers
- AlicenseNot gradedqualityCmaintenanceExposes any IMAP mailbox and SMTP relay as MCP tools, enabling email management (read, search, send, delete) through MCP-compatible agents.1MIT
- AlicenseNot gradedqualityBmaintenanceMCP server providing read and send access to a single IMAP/SMTP mailbox over Streamable HTTP with GitHub OAuth authentication, featuring recipient allowlists for security, email reading/searching/threading, attachments, drafts, folder management, and sending/reply tools.MIT
- AlicenseNot gradedqualityBmaintenanceEnables searching, reading full conversations, and sending email across multiple IMAP/SMTP mailboxes from any MCP client, with multi-user support and per-user API tokens.MIT
- AlicenseNot gradedqualityBmaintenanceBridges one or more IMAP mailboxes over Streamable HTTP so AI agents can list folders and accounts, read and search messages, and set or clear read flags. Optionally sends plain-text mail via SMTP with an automatic Sent-folder copy, but sending stays disabled unless explicitly enabled.MIT