mail-mcp-oauth
mail-mcp-oauth
Servidor MCP autoalojado de IMAP/SMTP para Claude.ai con OAuth 2.1 habilitado: un fork de maxx3250/claude-mail-mcp con una capa integrada de OAuth 2.1 + Dynamic Client Registration + PKCE, y adaptado para ejecutarse como un único proceso sin estado en Render (sin VPS, sin nginx, sin systemd, sin disco persistente).
Multicuenta: una sola implementación sirve varios buzones (Gmail, dominios personalizados, ...), cada uno accesible vía IMAP/SMTP. Cada herramienta MCP acepta un parámetro opcional account para elegir sobre qué buzón actuar.
Qué cambia con respecto al upstream
OAuth 2.1 integrado (src/oauth.ts):
/register(DCR),/authorize(PKCE + formulario de inicio de sesión de un solo usuario),/token. No hay un proceso de shim de OAuth separado: el upstream menciona uno, pero no está publicado, así que este fork lo implementa directamente en la misma aplicación Express.Sin estado por diseño: los tokens de acceso y de actualización son JWT firmados (sin base de datos); los clientes OAuth registrados y los códigos de autorización en curso están en memoria (un reinicio solo hace que Claude.ai se re-registre silenciosamente, algo que su cliente MCP ya controla).
Cuentas desde una variable de entorno:
ACCOUNTS_JSONen lugar de un archivo en disco, porque el sistema de archivos de Render es efímero. El archivoACCOUNTS_FILEsigue funcionando para uso local/VPS.Se eliminaron las herramientas de CalDAV/calendario: no son necesarias para este despliegue y reducen la superficie de dependencias (
tsdav,ical.js).
Related MCP server: IMAP MCP Server
Arquitectura
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
└── /healthConfiguración local
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 devDespliegue en Render
Consulta docs/DEPLOY_RENDER.md para el paso a paso completo (push a GitHub, servicio web Render, dominio personalizado, DNS de Netcup, conexión con Claude.ai).
Cuentas
Consulta docs/ACCOUNTS.md para el esquema de accounts.json y la configuración por proveedor (contraseñas de aplicación de Gmail, Netcup Webhosting IMAP/SMTP, y por qué Hotmail/Outlook.com necesita un flujo OAuth2 separado).
Herramientas expuestas a Claude
Herramienta | Finalidad |
| Lista los buzones configurados (id, label, default, From) — nunca las credenciales |
| Enumera los buzones IMAP |
| Lista los N mensajes más recientes de una carpeta |
| Búsqueda IMAP del lado del servidor |
| Cuerpo completo + encabezados + metadatos de adjuntos |
| Envía por SMTP (opcionalmente, copia en Enviados) |
| Construye RFC-822 y añade (APPEND) a Borradores |
| Controla |
| Mueve entre carpetas |
| Elimina (destructivo: prefiere mover a la Papelera) |
Licencia
MIT — consulta LICENSE. Obra original de Markus Stöger (maxx3250/claude-mail-mcp).
This server cannot be deployed
Maintenance
Related MCP Connectors
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.
Your mailboxes in ChatGPT and Claude: Gmail, iCloud, Fastmail, any IMAP. Passwords stay yours.
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