Skip to main content
Glama
mail-mcp-oauth

mail-mcp-oauth

by 00thies-blip

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_JSON en lugar de un archivo en disco, porque el sistema de archivos de Render es efímero. El archivo ACCOUNTS_FILE sigue 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
    └── /health

Configuració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 dev

Despliegue 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

list_accounts

Lista los buzones configurados (id, label, default, From) — nunca las credenciales

list_folders

Enumera los buzones IMAP

list_messages

Lista los N mensajes más recientes de una carpeta

search_messages

Búsqueda IMAP del lado del servidor

get_message

Cuerpo completo + encabezados + metadatos de adjuntos

send_message

Envía por SMTP (opcionalmente, copia en Enviados)

create_draft

Construye RFC-822 y añade (APPEND) a Borradores

mark_read

Controla \Seen

move_message

Mueve entre carpetas

delete_message

Elimina (destructivo: prefiere mover a la Papelera)

Licencia

MIT — consulta LICENSE. Obra original de Markus Stöger (maxx3250/claude-mail-mcp).

Related MCP Connectors

  • Email infrastructure for AI agents — send, receive, search, and reply to email over MCP.

    https://www.primitive.dev/mcp
  • Connect any mailbox to Claude, ChatGPT & AI: read, send, reply, schedule & search emails.

    https://mailmcp.io/mcp
  • 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.

    https://mailmcp.ai/mcp

Related MCP Servers

  • A
    license
    A
    quality
    A
    maintenance
    Enables Claude to interact with email accounts via IMAP and SMTP, providing tools for searching, reading, sending, and managing emails across multiple providers.
    40
    1,013 npm
    115
    MIT
  • F
    license
    Not graded
    quality
    D
    maintenance
    Enables Claude to read, search, send, and manage emails across multiple IMAP/SMTP accounts via a single deployment.
    -
  • F
    license
    Not graded
    quality
    B
    maintenance
    Enables Claude to read, search, draft, send, flag, and move email across multiple IMAP/SMTP mailboxes while keeping credentials local.
    -
  • A
    license
    B
    quality
    C
    maintenance
    Enables 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.
    19
    43 npm
    MIT