The MCP Email Server provides IMAP and SMTP email functionality through an MCP interface, enabling comprehensive email account management and operations.
Key capabilities:
Add Email Accounts: Configure new accounts with IMAP/SMTP server settings including host, port, credentials, and SSL options
List Email Accounts: View all configured accounts with their attributes
Retrieve Emails: Access and paginate emails with extensive filtering options by sender, recipient, subject, body content, and date ranges
Send Emails: Compose and send emails with support for multiple recipients, CC, BCC, subject, and body
mcp-email-server
IMAP and SMTP via MCP Server
Github repository: https://github.com/ai-zerolab/mcp-email-server/
Documentation https://ai-zerolab.github.io/mcp-email-server/
Installation
Manual Installation
We recommend using uv to manage your environment.
Try uvx mcp-email-server@latest ui to config, and use following configuration for mcp client:
This package is available on PyPI, so you can install it using pip install mcp-email-server
After that, configure your email server using the ui: mcp-email-server ui
Environment Variable Configuration
You can also configure the email server using environment variables, which is particularly useful for CI/CD environments like Jenkins. zerolib-email supports both UI configuration (via TOML file) and environment variables, with environment variables taking precedence.
Available Environment Variables
Variable | Description | Default | Required |
| Account identifier |
| No |
| Display name | Email prefix | No |
| Email address | - | Yes |
| Login username | Same as email | No |
| Email password | - | Yes |
| IMAP server host | - | Yes |
| IMAP server port |
| No |
| Enable IMAP SSL |
| No |
| SMTP server host | - | Yes |
| SMTP server port |
| No |
| Enable SMTP SSL |
| No |
| Enable STARTTLS |
| No |
| Enable attachment download |
| No |
| Save sent emails to IMAP Sent folder |
| No |
| Custom Sent folder name (auto-detect if not set) | - | No |
Enabling Attachment Downloads
By default, downloading email attachments is disabled for security reasons. To enable this feature, you can either:
Option 1: Environment Variable
Option 2: TOML Configuration
Add enable_attachment_download = true to your TOML configuration file (~/.config/zerolib/mcp_email_server/config.toml):
Once enabled, you can use the download_attachment tool to save email attachments to a specified path.
Saving Sent Emails to IMAP Sent Folder
By default, sent emails are automatically saved to your IMAP Sent folder. This ensures that emails sent via the MCP server appear in your email client (Thunderbird, webmail, etc.).
The server auto-detects common Sent folder names: Sent, INBOX.Sent, Sent Items, Sent Mail, [Gmail]/Sent Mail.
To specify a custom Sent folder name (useful for providers with non-standard folder names):
Option 1: Environment Variable
Option 2: TOML Configuration
To disable saving to Sent folder, set MCP_EMAIL_SERVER_SAVE_TO_SENT=false or save_to_sent = false in your TOML config.
For separate IMAP/SMTP credentials, you can also use:
MCP_EMAIL_SERVER_IMAP_USER_NAME/MCP_EMAIL_SERVER_IMAP_PASSWORDMCP_EMAIL_SERVER_SMTP_USER_NAME/MCP_EMAIL_SERVER_SMTP_PASSWORD
Then you can try it in Claude Desktop. If you want to intergrate it with other mcp client, run $which mcp-email-server for the path and configure it in your client like:
If docker is avaliable, you can try use docker image, but you may need to config it in your client using tools via MCP. The default config path is ~/.config/zerolib/mcp_email_server/config.toml
Installing via Smithery
To install Email Server for Claude Desktop automatically via Smithery:
Related MCP server: SMTP MCP Server
Usage
Replying to Emails
To reply to an email with proper threading (so it appears in the same conversation in email clients):
First, fetch the original email to get its
message_id:
Send your reply using
in_reply_toandreferences:
The in_reply_to parameter sets the In-Reply-To header, and references sets the References header. Both are used by email clients to thread conversations properly.
Development
This project is managed using uv.
Try make install to install the virtual environment and install the pre-commit hooks.
Use uv run mcp-email-server for local development.
Releasing a new version
Create an API Token on PyPI.
Add the API Token to your projects secrets with the name
PYPI_TOKENby visiting this page.Create a new release on Github.
Create a new tag in the form
*.*.*.
For more details, see here.