Email MCP
Allows Claude to access Gmail mailboxes via IMAP/SMTP using an app password, supporting reading, searching, drafting, managing, and optionally sending email with per-mailbox permissions.
Allows Claude to access iCloud mailboxes via IMAP/SMTP using an app password, supporting reading, searching, drafting, managing, and optionally sending email with per-mailbox permissions.
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.
Email MCP for Claude – on your own Cloudflare Worker
Give Claude (claude.ai, Claude Desktop, Claude Code, scheduled tasks) secure access to your own IMAP mailboxes: read, search, draft, manage and – if you allow it – send email. Runs as a single Cloudflare Worker on your own free Cloudflare account. Nobody else ever sees your passwords.
Deutsch: Kurzfassung unten.
Features
Any IMAP provider with password/app-password login (presets for Yahoo and Gmail, everything else auto-detected via the Thunderbird autoconfig database or entered manually).
Several mailboxes in one Claude connection. Claude picks the mailbox per call or searches all of them at once (
account: "all").Permissions per mailbox (read / manage / drafts / send) and per Claude connection (you choose the maximum when connecting).
Reading never marks mail as read. Trash instead of permanent delete. Daily send limit.
Only you can connect: login through Cloudflare Access (one-time PIN to your email) in front of the consent page and the settings page.
Mailbox passwords are stored AES-GCM encrypted in D1. You enter them only on your Worker's settings page, never in a chat.
Tool | Permission | What it does |
| read | Mailboxes and permissions of this connection |
| read | Folders with message/unread counts |
| read | Newest emails (headers only), |
| read | Search by from/to/subject/text/date/flags |
| read | Text body (HTML converted), attachment list |
| read | One attachment up to 1 MB (images, text, PDF …) |
| manage | Read/unread, flagged |
| manage | Move to another folder |
| manage | Move to trash (never permanent) |
| drafts | New mail or reply in the drafts folder |
| send | Send via SMTP, copy to "Sent" |
Related MCP server: email-mcp
How it works
Claude ──OAuth 2.1──▶ your Worker (https://email-mcp.<subdomain>.workers.dev)
/authorize → Cloudflare Access login → consent (choose permissions)
/settings → add mailboxes (app password), permissions, disconnect all
/mcp → MCP tools ──IMAP 993 / SMTP 465·587 (TLS)──▶ your mail provider
KV: OAuth tokens · D1: mailboxes (passwords encrypted)Setup (about 15 minutes)
You need: a free Cloudflare account, a GitHub account, and an app password for your mailbox (Yahoo, Gmail, iCloud and others require one; normal passwords don't work for IMAP).
0. (Optional) A subdomain without your name
Your Worker URL is https://email-mcp.<subdomain>.workers.dev, and the subdomain defaults to your account name. To change it, go to Workers & Pages → "Your subdomain" → Change before deploying.
1. Enable Zero Trust and one-time PIN login
Dashboard → Zero Trust. Choose a team name (it appears in the login URL, so pick a neutral one) and the Free plan. Cloudflare asks for payment details even for the free plan, but does not charge.
Zero Trust → Settings → Authentication → Login methods → Add new → One-time PIN.
2. Create the Access application (OIDC)
Zero Trust → Access → Applications → Add an application → SaaS:
Name:
Email MCP. Authentication protocol: OIDC. Click Add application.Redirect URL:
https://email-mcp.<subdomain>.workers.dev/callbackScopes:
openid,email,profile.Policy: Action Allow → Include → Emails → your email address.
Login methods: only One-time PIN.
Copy Client ID, Client secret, Authorization endpoint, Token endpoint, Key endpoint. You need them in step 3.
3. Deploy
Click Deploy to Cloudflare above. Cloudflare copies this repo to your GitHub, creates the KV namespace and the D1 database, and asks for the secrets:
Secret | Value |
| Your email address (the one in the Access policy) |
| Random string, e.g. |
| Random string, e.g. |
| From step 2 |
| Authorization / Token / Key endpoint from step 2 |
Keep the Worker name email-mcp, or adjust the redirect URL from step 2 to match. From now on every push to main of your copy deploys automatically. Recommended under Worker → Settings → Builds: set the build command to npm test and disable preview builds.
4. Add your mailboxes
Open https://email-mcp.<subdomain>.workers.dev/settings, log in with the one-time PIN, and add a mailbox with its app password. Tick the permissions Claude may use for it. The connection is tested before saving.
5. Connect Claude
claude.ai / Desktop: Settings → Connectors → Add custom connector →
https://email-mcp.<subdomain>.workers.dev/mcpClaude Code:
claude mcp add --transport http email https://email-mcp.<subdomain>.workers.dev/mcp
When connecting, the consent page lets you limit what this connection may do (e.g. no sending).
Fork this repo, then run
npm installandnpx wrangler login.Run
npx wrangler deploy. KV and D1 are created automatically on the first deploy.For every secret from step 3, run
npx wrangler secret put <NAME>.Optional: dashboard → Worker → Settings → Builds → connect your fork for automatic deploys. Do the first deploy with wrangler, because the default build token cannot create D1 databases.
Security model
Who can connect: only someone who passes your Cloudflare Access policy, i.e. receives the one-time PIN at your address. The Worker additionally checks the email against
OWNER_EMAILS. OAuth tokens are only issued toclaude.ai/claude.comand localhost callbacks.Where things live:
OAuth tokens of claude.ai connectors are stored by Anthropic for your Claude account; Claude Code keeps them on your machine.
The Worker stores token hashes in KV and mailbox passwords AES-GCM-encrypted in D1, with
MAILBOX_KEYas the key.
Your accounts are the keys: whoever controls your Cloudflare account controls the Worker; whoever controls your Claude account can use the connector. Enable 2FA on both, and on the mailbox that receives the one-time PIN. Disconnect everything any time on
/settings("disconnect all Claude connections").Untrusted content: email bodies are marked as untrusted data for Claude. Destructive tools are annotated so Claude asks first. Keep "always ask" enabled for
send_emailin Claude.Hardening: no JavaScript on the pages, strict CSP, CSRF tokens,
__Host-cookies. Mail server hosts are validated (no IPs/internal names, only ports 993/465/587, TLS only).
Limits and known gaps
Not supported: Outlook/Hotmail/Microsoft 365 (OAuth-only IMAP), Proton (local Bridge only), Tuta (no IMAP).
Workers Free plan allows 10 ms CPU per request. Only text parts are loaded, and attachments are limited to 1 MB.
Every tool call opens a new IMAP connection (≈1–4 s depending on the provider).
Some providers email you once when a new app password is first used. That's expected.
The settings and consent pages are currently in German.
Development
npm install
npm run check # generate types, type-check, tests (incl. full OAuth → MCP flow)Local Worker: create .dev.vars (git-ignored) with OWNER_EMAILS, SESSION_SECRET, MAILBOX_KEY and DEV_LOGIN_EMAIL=<same address>. The dev login skips Access and works on localhost only. Then run npx wrangler dev --port 8788 --ip 127.0.0.1. End-to-end test against a real mailbox: put E2E_EMAIL / E2E_PASSWORD in .e2e.vars and run node scripts/e2e-local.mjs [--write]. It prints metadata only.
Built with @cloudflare/workers-oauth-provider, the Agents SDK MCP handler, imapflow and postal-mime.
Deutsch (Kurzfassung)
Ein eigener MCP-Server auf deinem kostenlosen Cloudflare-Konto, über den Claude auf deine IMAP-Postfächer zugreift: lesen, suchen, Entwürfe, verwalten und, wenn du es erlaubst, senden. Nur du kommst rein, über Cloudflare Access mit Einmal-Code an deine Adresse. Deine Passwörter liegen verschlüsselt auf deinem Worker.
Einrichtung wie oben:
Zero Trust aktivieren und den Einmal-Code-Login hinzufügen.
Eine Access-App vom Typ SaaS/OIDC anlegen, mit Callback
…/callbackund der Regel „nur meine Adresse“.Auf Deploy to Cloudflare klicken und die Secrets eintragen.
Auf
/settingsPostfächer mit App-Passwort hinzufügen.In Claude den Connector
…/mcphinzufügen.
License
MIT
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
Connect any IMAP/SMTP mailbox to Claude & ChatGPT: search, read, sort, draft. Sends only with OK.
Your mailboxes in ChatGPT and Claude: Gmail, iCloud, Fastmail, any IMAP. Passwords stay yours.
Connect any mailbox to Claude, ChatGPT & AI: read, send, reply, schedule & search emails.
Give Claude, Cursor or any agent its own email address: send, read and reply in threads.
Related MCP Servers
- FlicenseNot gradedqualityDmaintenanceEnables Claude to read, search, send, and manage emails across multiple IMAP/SMTP accounts via a single deployment.-
- FlicenseNot gradedqualityBmaintenanceEnables Claude to read, search, draft, send, flag, and move email across multiple IMAP/SMTP mailboxes while keeping credentials local.-
- AlicenseNot gradedqualityCmaintenanceConnects Gmail to Claude and other MCP clients so an assistant can search and read mail, send, reply-all with quoted history, forward, handle attachments and inline images, and manage drafts, labels, and threads. Runs as a remote server on your own Cloudflare Worker, serving several Google accounts simultaneously to desktop, browser, and phone clients while you retain the refresh tokens.MIT
- AlicenseNot gradedqualityBmaintenanceEnables Claude and ChatGPT to read, search, and organize mail in a user's own email account, including folders, threads, attachments, drafts, and optional sending, with per-user permission levels and OAuth-secured remote connections.MIT