mail-mcp-oauth
mail-mcp-oauth
Selbstgehosteter, OAuth-2.1-fähiger IMAP/SMTP-MCP-Server für Claude.ai – ein Fork von maxx3250/claude-mail-mcp mit einer eingebauten Schicht für OAuth 2.1, Dynamic Client Registration und PKCE, angepasst für den Betrieb als einzelner zustandsloser Prozess auf Render (ohne VPS, ohne nginx, ohne systemd, ohne dauerhaften Datenträger).
Multi-Konto: Eine einzige Bereitstellung kann mehrere Postfächer bedienen
(Gmail, eigene Domains, ...), jeweils erreichbar über IMAP/SMTP.
Jedes MCP-Tool akzeptiert einen optionalen Parameter account, um festzulegen,
auf welches Postfach zugegriffen wird.
Änderungen gegenüber dem Upstream
OAuth 2.1 eingebaut (src/oauth.ts):
/register(DCR),/authorize(PKCE + Login-Formular für Einzelnutzer),/token. Kein separater OAuth-Shim-Prozess mehr – das Upstream-Projekt erwähnt zwar einen, hat ihn aber nicht veröffentlicht. Dieser Fork setzt OAuth daher direkt in derselben Express-App um.Bewusst zustandslos: Access- und Refresh-Tokens sind signierte JWTs (ohne Datenbank); registrierte OAuth-Clients und labstende Autorisierungscodes werden im Speicher vorgehalten. Ein Neustart führt ledlich dazu, dass Claude.ai stillschweigend erneut registriert wird – was sein MCP-Client bereits abdeckt.
Konten über eine Umgebungsvariable:
ACCOUNTS_JSONstatt einer Datei auf der Platte, da das Dateisystem von Render nicht dauerhaft ist. Die dateibasierteACCOUNTS_FILEfunktioniert weiterhin für den lokalen/VPS-Einsatz.CalDAV-/Kalender-Tools entfernt – für dieses Deployment nicht nötig, reduziert die Abhängigkeiten (
tsdav,ical.js).
Related MCP server: IMAP MCP Server
Architektur
Claude.ai (web)
│ HTTPS + OAuth 2.1 (DCR, PKCE, JWT)
▼
Render (TLS terminated automatically, custom domain mcp-mail.<domain>)
▼
this process (single Node service)
├── /.well-known/oauth-authorization-server, /register, /authorize, /token (src/oauth.ts)
├── /mcp (Bearer-gated MCP Streamable HTTP transport)
│ ├── ImapClient ──▶ imapflow ──▶ IMAP server (993/143) per account
│ └── SmtpClient ──▶ nodemailer ──▶ SMTP server (465/587) per account
└── /healthLokale Einrichtung
npm install
cp .env.example .env
# fill in PUBLIC_URL, ACCOUNTS_JSON (see docs/ACCOUNTS.md), OAUTH_USER,
# OAUTH_PASS, and JWT_SECRET (openssl rand -hex 32)
npm run devBereitstellung auf Render
Siehe docs/DEPLOY_RENDER.md für die vollständige Schritt-für-Schritt-Anleitung (GitHub-Push, Render-Webservice, eigene Domain, Netcup-DNS, Verbindung von Claude.ai).
Konten
Siehe docs/ACCOUNTS.md für das accounts.json-Schema und
die Einrichtung der jeweiligen Anbieter (App-Passwörter bei Gmail,
Netcup Webhosting IMAP/SMTP und warum Hotmail/Outlook.com einen separaten
OAuth2-Flow benötigt).
Claude verfügbare Tools
Tool | Zweck |
| Konfigurierte Postfächer auflisten (id, label, default, From) – niemals Zugangsdaten |
| IMAP-Ordner auflisten |
| Die neuesten N Nachrichten in einem Ordner |
| Serverseitige IMAP-Suche |
| Vollständiger E-Mail-Text + Header + Metadaten zu Anhängen |
| Über SMTP senden (optional eine Kopie nach „Sent") |
| RFC-822-Nachricht erzeigen und in an |
|
|
| Nachrichten zwischen Ordnern verschieben |
| Löschen (zerstörend – stattdessen lieber in den Papierkorb verschieben) |
License
MIT – siehe LICENSE. Original von Markus Wanner (masonr25/claude-mail-mcp).
Related MCP Connectors
Connect any IMAP/SMTP mailbox to Claude & ChatGPT: search, read, sort, draft. Sends only with OK.
Email infrastructure for AI agents — send, receive, search, and reply to email over MCP.
Connect any mailbox to Claude, ChatGPT & AI: read, send, reply, schedule & search emails.
Your agent needs a mailbox of its own — to receive, thread, draft and send, with attachments, without borrowing your personal inbox or your company's SMTP. **What you can ask for** • "Create an inbox for this agent and tell me its address." • "Read the new messages in this thread and draft a reply." • "Send this message with the attachment and wait for the response." • "Search this inbox for everything from that domain." • "Show delivery metrics and the events on this inbox." **How to use it** Point any MCP client at https://mcp.aisa.one/mail/mcp and sign in with OAuth — there is no key to create or paste. 49 tools: create and delete inboxes, list and read messages, raw message bodies, attachments, threads, drafts and draft attachments, send and reply, message search, inbox events, metrics, and list entries — reads and writes. **Why this rather than the source** A real inbox an agent owns, rather than an SMTP credential it borrows from a human. **It is also a door to the rest** The same login reaches 26 sources and 580+ operations. Find the contact elsewhere in the catalogue, then write to them from here — without adding a second server. **What it costs** Finding and inspecting an operation is free. Running one is billed per call at API prices, with no seat and no monthly minimum, and every call takes max_price_usd so an agent cannot overspend by accident. **Where else it reaches** https://mcp.aisa.one/sales/mcp finds the person to write to.
Related MCP Servers
- AlicenseAqualityAmaintenanceEnables Claude to interact with email accounts via IMAP and SMTP, providing tools for searching, reading, sending, and managing emails across multiple providers.401,013 npm115MIT
- 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.-
- AlicenseBqualityCmaintenanceEnables email management through IMAP/SMTP, including reading, sending, replying, starring, deleting, labeling emails, handling attachments, and filtering by Gmail smart categories. Works with MCP-compatible clients like Claude Desktop and Claude Code using App Password authentication.1943 npmMIT