Content
# @fuyouai/email-mcp
Read and write emails through **MCP**: receive emails using **IMAP**, send emails using **SMTP**. Default parameters are adapted for Tencent Enterprise Email (`exmail.qq.com`).
## Tool List
| Tool | Description |
|------|-------------|
| `list_folders` | List folders |
| `list_messages` | List email summaries |
| `search_messages` | Search by conditions |
| `get_message` | Read a single email body and attachment information |
| `send_message` | Send an email (not registered when environment variable `SMTP_ENABLED=false`) |
## Requirements
- Node.js 18+
- Email IMAP is enabled; SMTP is required for sending emails
- When Tencent Enterprise Email has secure login enabled, use **client-specific password** ([IMAP instructions](http://service.rtxmail.net/help/234.html))
## Usage in Cursor
```bash
npx -y @fuyouai/email-mcp
```
Example `mcp.json` (replace account and password with your own; do not submit password to the repository):
```json
{
"mcpServers": {
"email": {
"command": "npx",
"args": ["-y", "@fuyouai/email-mcp"],
"env": {
"IMAP": "imap.exmail.qq.com:993",
"MAIL_USER": "you@yourcompany.com",
"MAIL_PASSWORD": "client-specific password",
"IMAP_SECURE": "true",
"SMTP": "smtp.exmail.qq.com:465",
"SMTP_SECURE": "true",
"SMTP_ENABLED": "true"
}
}
}
}
```
After global installation, execute CLI: `email-mcp`.
## Environment Variables
| Variable | Description | Default |
|----------|-------------|---------|
| `IMAP` | Receive email `host:port` | `imap.exmail.qq.com:993` |
| `MAIL_USER` | Login email (shared for receiving and sending) | Required |
| `MAIL_PASSWORD` | Password or client-specific password | Required |
| `IMAP_SECURE` | IMAP uses TLS | `true` |
| `MAX_BODY_CHARS` | Maximum length of email body when reading | `8000` |
| `SMTP` | Send email `host:port` | `smtp.exmail.qq.com:465` |
| `SMTP_SECURE` | SMTP uses TLS | `true` |
| `SMTP_ENABLED` | Whether to register the sending tool | `true` |
| `SMTP_USER` / `SMTP_PASSWORD` | Fill in when the sending account is different from the receiving account | Default same as `MAIL_*` |
| `SMTP_FROM` | Sender's display address | Default same as the sending login account |
For overseas data centers, you can change `IMAP` / `SMTP` to `hwimap.exmail.qq.com:993`, `hwsmtp.exmail.qq.com:465`.
## `send_message` Parameter Example
```json
{
"to": "colleague@company.com",
"subject": "Meeting Reminder",
"text": "Meeting at 3 PM tomorrow."
}
```
Multiple recipients: `"to": "a@x.com, b@x.com"` or `"to": ["a@x.com", "b@x.com"]`. At least one of `text` and `html` must be filled.