Enables email operations through POP3 and SMTP protocols, allowing users to connect to email servers (including Gmail), list messages, retrieve email content, delete messages, get message counts, and send emails with text/HTML formats, CC, and BCC support.
Runs as a Node.js application that provides email functionality through POP3 and SMTP protocols, leveraging Node.js runtime for secure email operations with environment-based configuration.
Available as an npm package that can be installed globally or run directly with npx, providing email client capabilities through a standardized package distribution system.
MCP Mail Server
Language: English | 中文
A Model Context Protocol (MCP) server that enables email operations through IMAP and SMTP protocols in Cursor AI. Features secure environment-based configuration for seamless email management.
✨ Features
📥 IMAP Features (Receive Emails)
- Connect to IMAP email servers with TLS support
- Open and manage multiple mailboxes (folders)
- Search messages using IMAP search criteria
- Retrieve messages by UID with full content
- Mark messages as seen/unseen
- Delete messages from server
- Get message counts and mailbox information
- List all available mailboxes
- Get unseen and recent messages
- Secure connection management
📤 SMTP Features (Send Emails)
- Connect to SMTP email servers
- Send emails (text and HTML formats)
- Support for CC and BCC recipients
- SSL/TLS encryption support
- Comprehensive error handling
📦 Installation
Method 1: Install via npm
Method 2: Use with npx (Recommended)
No installation required:
⚙️ Cursor Configuration
Add the following configuration to your Cursor MCP settings:
Using npx (Recommended):
Using global installation:
🛠️ Available Tools
connect_imap
Connect to IMAP email server using preconfigured settings.
open_mailbox
Open a specific mailbox (folder) for operations.
Parameters:
mailboxName
(string, optional): Name of the mailbox to open (default: "INBOX")readOnly
(boolean, optional): Open mailbox in read-only mode (default: false)
list_mailboxes
List all available mailboxes (folders) on the server.
search_messages
Search messages using IMAP search criteria.
Parameters:
criteria
(array, optional): IMAP search criteria (default: ["ALL"])- Examples:
["UNSEEN"]
,["SINCE", "2024-01-01"]
,["FROM", "sender@example.com"]
- Examples:
get_messages
Retrieve multiple messages by their UIDs.
Parameters:
uids
(array): Array of message UIDs to retrievemarkSeen
(boolean, optional): Mark messages as seen when retrieving (default: false)
get_message
Retrieve complete content of a specific email by UID.
Parameters:
uid
(number): Message UID to retrievemarkSeen
(boolean, optional): Mark message as seen when retrieving (default: false)
delete_message
Delete a specific email message by UID.
Parameters:
uid
(number): Message UID to delete
get_message_count
Get the total number of messages in current mailbox.
get_unseen_messages
Get all unseen (unread) messages in current mailbox.
get_recent_messages
Get all recent messages in current mailbox.
disconnect_imap
Disconnect from the IMAP server.
connect_smtp
Connect to SMTP email server using preconfigured settings.
send_email
Send an email via SMTP.
Parameters:
to
(string): Recipient email address(es), comma-separatedsubject
(string): Email subjecttext
(string, optional): Plain text email bodyhtml
(string, optional): HTML email bodycc
(string, optional): CC recipients, comma-separatedbcc
(string, optional): BCC recipients, comma-separated
disconnect_smtp
Disconnect from the SMTP server.
quick_connect
Connect to both IMAP and SMTP servers simultaneously using preconfigured settings.
💡 Usage Examples
Note: This project uses preconfigured email server settings via environment variables.
In Cursor, you can use natural language commands:
🚀 Quick Start
- Connect to all email servers at once:
or
📥 Receiving Emails
- Connect to IMAP server (if not using quick connect):
- Open a mailbox:
or
- Search for emails:
or
- Get specific email by UID:
- Get all unseen messages:
- List available mailboxes:
- Delete email by UID:
📤 Sending Emails
- Connect to SMTP server (if not using quick connect):
- Send simple email:
- Send HTML email:
🔧 Environment Configuration
Required Environment Variables
⚠️ All environment variables are required - no defaults provided!
Variable | Description | Example Value |
---|---|---|
IMAP_HOST | IMAP server address | your-imap-server.com |
IMAP_PORT | IMAP port number | 993 |
IMAP_SECURE | Enable TLS (true/false) | true |
SMTP_HOST | SMTP server address | your-smtp-server.com |
SMTP_PORT | SMTP port number | 465 |
SMTP_SECURE | Enable SSL (true/false) | true |
EMAIL_USER | Email username | your-email@domain.com |
EMAIL_PASS | Email password | your-password |
Configuration Validation
- Server will fail to start if any required environment variable is missing
- Boolean values must be
true
orfalse
(case-insensitive) - Port numbers must be valid integers
- Configuration summary is displayed on startup (passwords are hidden)
⚠️ Security Considerations
- Use app-specific passwords when available (Gmail, Outlook, etc.)
- Ensure secure network connections in production
- Environment variables are the recommended configuration method
- TLS/SSL encryption is strongly recommended for both protocols
🔨 Development
To modify or develop this project:
- Clone the repository:
- Install dependencies:
- Build the project:
- Local testing:
📊 Package Information
- Package Name:
mcp-mail-server
- Executable:
mcp-mail-server
- Node.js Version: >=18.0.0
- License: MIT
- Repository: GitHub
This server cannot be installed
remote-capable server
The server can be hosted and run remotely because it primarily relies on remote services or has no dependency on the local environment.
A Model Context Protocol server that enables email operations through POP3 and SMTP protocols in Cursor AI, allowing users to send, receive, list, and manage emails using natural language commands.
Related MCP Servers
- -securityFlicense-qualityA Model Context Protocol server that enables AI assistants to explore and interact with Cursor IDE's SQLite databases, providing access to project data, chat history, and composer information.Last updated -21Python
- AsecurityFlicenseAqualityA Model Context Protocol server that enhances Claude in Cursor AI with advanced reasoning capabilities including Monte Carlo Tree Search, Beam Search, R1 Transformer, and Hybrid Reasoning methods.Last updated -813TypeScript
- -securityFlicense-qualityA Model Context Protocol server that enables Cursor AI assistants to interact with Todoist tasks directly from the coding environment, supporting advanced task filtering and rich formatting.Last updated -38Python
- -securityFlicense-qualityA Model Context Protocol server that enables AI assistants to access and manage email through IMAP, supporting browsing, searching, reading, and organizing emails while learning user preferences over time.Last updated -15Python