Skip to main content
Glama
MauricioPerera

mail-mcp

mail-mcp

CI Coverage Version Node.js Version License: MIT PRs Welcome

Servicio de correo autoalojado e independiente del proveedor. Apúntalo a las credenciales IMAP/SMTP de cualquier buzón y expone:

  • API REST que refleja las operaciones comunes de buzón: listar carpetas, listar/obtener/buscar mensajes, enviar, marcar, mover, eliminar, cuota (mejor esfuerzo).

  • Webhooks (message.received) mediante un vigilante IMAP IDLE persistente: lanza un HTTP POST (con un secreto bearer por webhook) cada vez que llega un nuevo correo, reintentado con retroceso exponencial (hasta 6 intentos) si el endpoint receptor falla.

  • Servidor MCP (HTTP Streamable, POST /mcp) que expone las mismas operaciones como herramientas, para que cualquier agente compatible con MCP pueda usarlo directamente.

Multibuzón desde el inicio: añade tantas cuentas como quieras en config/accounts.json.

Los cuerpos de las solicitudes en la API REST se validan con Zod (lib/schemas.js) — las cargas útiles inválidas reciben un 422 ERR_VALIDATION_FAILED con errores a nivel de campo en lugar de llegar a la capa de correo. Las suscripciones a webhooks persisten en SQLite (config/webhooks.sqlite, mediante better-sqlite3) en lugar de un archivo JSON plano. Los mensajes mayores que MAIL_MCP_MAX_MESSAGE_SIZE (por defecto 25MB) se devuelven con bodyTruncated: true y sin cuerpo/adjuntos analizados, para evitar cargar mensajes enormes en memoria.

Configuración

npm install
cp .env.example .env   # fill in MAIL_MCP_API_TOKEN and one MAILMCP_PASS_<ID> per account

Copia config/accounts.json.example a config/accounts.json (gitignored — tampoco hay contraseñas en este archivo, esas solo viven en .env):

[
  {
    "id": "example",
    "user": "user@example.com",
    "imap": { "host": "imap.example.com", "port": 993, "secure": true },
    "smtp": { "host": "smtp.example.com", "port": 465, "secure": true }
  }
]

La contraseña para la cuenta id: "example" se lee de MAILMCP_PASS_EXAMPLE.

node index.js

Se ejecuta en 127.0.0.1:4900 por defecto (ver MAIL_MCP_PORT). Ponlo detrás de un proxy inverso con TLS si necesitas acceder desde fuera del host.

Related MCP server: Agent Email

systemd

Una unidad de ejemplo está en deploy/mail-mcp.service — cópiala a /etc/systemd/system/, ajusta las rutas, y carga los secretos desde /root/mail-mcp/.env mediante EnvironmentFile.

Autenticación

Toda solicitud REST y MCP requiere Authorization: Bearer <MAIL_MCP_API_TOKEN>.

Pruebas

npm test              # run once
npm run test:coverage # run with coverage report

La cobertura cubre los módulos puros/lógicos (lib/schemas.js, lib/accounts.js, lib/webhooks-store.js). lib/mailclient.js y lib/idle-watcher.js se comunican con servidores IMAP/SMTP reales y se ejercitan mediante pruebas manuales de extremo a extremo en lugar de pruebas unitarias — están excluidos de la insignia de cobertura para que no sea engañosa.

A
license - permissive license
-
quality - not tested
B
maintenance

Maintenance

Maintainers
Response time
Release cycle
Releases (12mo)
Commit activity

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Servers

  • A
    license
    -
    quality
    D
    maintenance
    A generic IMAP and SMTP MCP server that enables AI agents to interact with email accounts for reading, searching, and sending messages. It provides high-level tools for managing email workflows like daily digests and folder organization across any standard email provider.
    1
    MIT
  • A
    license
    -
    quality
    A
    maintenance
    An open-source MCP server that provides AI agents with secure access to read, search, and manage emails via Microsoft 365 and Gmail. It features security-first defaults like recipient allowlists and markdown content conversion to facilitate safe agent interaction with mailboxes.
    4
    Apache 2.0
  • A
    license
    A
    quality
    D
    maintenance
    Provider-agnostic email MCP server that connects any IMAP mailbox to AI assistants, enabling email management through natural language.
    8
    AGPL 3.0
  • A
    license
    -
    quality
    C
    maintenance
    An MCP server that exposes IMAP operations as tools for AI assistants, enabling email management including listing mailboxes, reading, searching, moving, flagging emails, and creating drafts.
    47
    MIT

View all related MCP servers

Related MCP Connectors

  • Hosted email MCP for AI agents with inboxes, send/receive, memory, recovery, and credits.

  • Shipmail MCP server for AI agent custom-domain email inboxes with REST API and webhooks.

  • Self-hosted multi-domain email as MCP tools - register domains, real mailboxes, send/read mail.

View all MCP Connectors

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/MauricioPerera/mail-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server