A Node.js MCP (Model Context Protocol) server for sending and reading email via SMTP and IMAP. The underlying SMTP/IMAP clients are standards-based and can be pointed at any provider by changing environment variables.
Originally based on anyrxo/protonmail-pro-mcp (MIT). Heavily modified and extended.
Disclaimer: Not affiliated with Proton.
git clone https://github.com/davidmjerry/email-mcp-server.git
cd email-mcp-server
npm install
npm run build
node dist/index.jsBy default the MCP server listens on http://127.0.0.1:3000 and exposes:
GET /ssefor the SSE streamPOST /messages?sessionId=...for client messages
- Node.js 18+
- SMTP credentials (username/password) for the mail account you want to send from
- IMAP access for the mail account you want to read from
If using ProtonMail, you must run Proton Bridge locally and point IMAP to it. Defaults:
- Host:
localhost - Port:
1143
Adjust the IMAP settings via environment variables if your Bridge uses different values.
Create a .env file in the project root:
# Required: account credentials (used for both SMTP and IMAP)
USERNAME=your-email@example.com
PASSWORD=your-password
# SMTP configuration (defaults shown)
SMTP_HOST=localhost
SMTP_PORT=587
# Optional: Force implicit TLS (true) or STARTTLS (false); defaults based on port
# SMTP_SECURE=false
# Optional: Allow self-signed certs (useful with Proton Bridge)
# SMTP_REJECT_UNAUTHORIZED=false
# IMAP configuration (defaults shown)
IMAP_HOST=localhost
IMAP_PORT=1143
# Optional: Force implicit TLS (true) or STARTTLS (false); defaults to false
# IMAP_SECURE=false
# Optional: Allow self-signed certs (useful with Proton Bridge)
# IMAP_REJECT_UNAUTHORIZED=false
# Optional: Debug logging
DEBUG=true
# Optional: MCP server configuration
MCP_HOST=127.0.0.1
MCP_PORT=3000
# MCP_ALLOWED_HOSTS=example.com,localhost
# Optional: require an MCP auth token (sent via Authorization: Bearer, X-MCP-Token, or ?token=)
# MCP_TOKEN=your-mcp-token- SMTP: Any SMTP server that supports username/password authentication.
- IMAP: Any IMAP server that supports username/password authentication.
- ProtonMail IMAP requires Proton Bridge. The server expects IMAP connectivity; without it, read-only features will fail.
This project officially works with ProtonMail. For ProtonMail:
- Use Proton Bridge for IMAP/SMTP access.
- Set SMTP_HOST to localhost, port 1025 (usually by default).
- Set IMAP_HOST to localhost, port 1143.
- Use the SMTP/IMAP credentials from Proton Bridge.
npm install
npm run buildStart the server:
node dist/index.jsClients connect via Server-Sent Events (SSE):
GET /sseto open a sessionPOST /messages?sessionId=...to send MCP messages
If you set MCP_TOKEN, clients must include it using one of:
Authorization: Bearer <token>X-MCP-Token: <token>?token=<token>query string
Create /etc/systemd/system/email-mcp.service:
[Unit]
Description=Email MCP Server
After=network.target
[Service]
Type=simple
WorkingDirectory=/path/to/email-mcp-server
ExecStart=/usr/bin/node /path/to/email-mcp-server/dist/index.js
Restart=on-failure
EnvironmentFile=/path/to/email-mcp-server/.env
[Install]
WantedBy=multi-user.targetEnable and start:
sudo systemctl daemon-reload
sudo systemctl enable email-mcp
sudo systemctl start email-mcp- SMTP send (text/HTML)
- Attachments (base64)
- Multiple recipients (to/cc/bcc)
- Reply-to
- Priority headers
- Read receipt headers
- IMAP folder listing and status
- IMAP pagination and search
- IMAP read/unread and starred flags
- Move and delete (via trash folder detection)
- Basic analytics (contact counts, volume trends)
send_email
get_emailsget_email_by_idsearch_emails
get_folderssync_folders
mark_email_readstar_emailmove_emaildelete_email
get_thread
get_email_statsget_email_analytics
get_connection_statussync_emailsclear_cacheget_logs
MIT License.