Email MCP
This server can send emails, and according to the README it is intended to also read, search, delete, and reply to emails.
send-email(from schema): sends an email with requiredto,subject, andtextfields.read_emails(README): reads emails from a folder, optionally only unread messages.search_emails(README): searches a specified folder using text or IMAP-style queries.delete_email(README): deletes a specified email by message ID.reply_email(README): replies or replies-all using IMAP + SMTP or Gmail API.Note: the provided server schema only lists
send-email; the other four tools appear only in the README, not in the schema.
Uses .env files for configuration management, storing sensitive information like API keys and JWT credentials for email functionality.
Supports repository cloning for installation of the email MCP server.
Hosts the email MCP repository, allowing users to clone and access the codebase.
Provides JavaScript-based integration examples for sending emails through the SuperGateway API.
Manages dependencies and provides scripts for setup, development, and running the email service.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Email MCPsend an email to john@example.com about tomorrow's meeting agenda"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Email MCP Server
一个基于 MCP Streamable HTTP 的通用邮箱服务。固定提供 5 个工具,支持通过标准 IMAP/SMTP 使用 QQ、163、126、Gmail、Outlook、Yahoo、iCloud、企业邮箱和自建邮箱, 同时保留 Gmail API 模式。
解决的问题
Issue #1 的根因是旧版本只有 send_email 使用 SMTP;读取、搜索、删除和回复全部写死为
Gmail API,因此 163 等邮箱只能发信。当前实现改为:
send_email、reply_email:标准 SMTP(或 Gmail API)。read_emails、search_emails、delete_email:标准 IMAP(或 Gmail API)。工具总数仍为 5,名称保持不变。
每个工具都有可选
account参数,可在命名账号之间逐次调用切换。每个 HTTP 请求也可使用
X-Email-*Header 切换或覆盖连接配置,无需重启服务。
Related MCP server: MCP Email Server
安装与启动
要求 Node.js 18 或更高版本。
从 npm 全局安装:
npm install -g @xingyuchen/email-mcp
email-mcp-server从源码运行:
npm install
cp .env.example .env
npm run build
npm start默认仅监听本机回环地址:
http://localhost:3200/mcp健康检查:
curl http://localhost:3200/health这是原生 Streamable HTTP MCP,不再需要 SuperGateway,也不是旧的 /sse 协议。
原生 HTTPS(跨机器部署必须启用)
配置服务器证书和私钥后,服务会直接启动为 HTTPS。TLS 会加密完整 HTTP 请求,包括
Authorization、所有 X-Email-* 请求头以及 JSON-RPC 正文,服务端解密后仍按原有方式
解析和使用这些字段:
MCP_HOST=0.0.0.0
MCP_PORT=3200
MCP_TLS_KEY_PATH=/etc/email-mcp/tls/server.key
MCP_TLS_CERT_PATH=/etc/email-mcp/tls/server.crt
MCP_TLS_MIN_VERSION=TLSv1.2客户端连接:
https://mail-mcp.example.com:3200/mcp证书必须由客户端信任,并且证书域名必须与 URL 主机名匹配。只配置证书或只配置私钥会 拒绝启动。非回环地址上的明文 HTTP 也会默认拒绝启动。
MCP_API_KEY 默认不启用。部署者需要额外的客户端鉴权时,可显式设置至少 32 字节的
MCP_API_KEY;设置后客户端再通过 Bearer 或 X-MCP-API-Key 发送它。
也可以由 Nginx、Caddy 或负载均衡器终止 HTTPS,此时保持 MCP_HOST=127.0.0.1,只允许
代理通过本机回环访问后端。只有代理可信且会覆盖 X-Forwarded-Proto 时才设置
MCP_TRUST_PROXY=true。如果要求 TLS 一直终止到 Node.js 进程,请使用上述原生 HTTPS。
单邮箱配置
163 邮箱
先在 163 邮箱设置中启用 SMTP/IMAP,并使用客户端授权码而不是登录密码:
EMAIL_PROVIDER=imap-smtp
SMTP_HOST=smtp.163.com
SMTP_PORT=465
SMTP_SECURE=true
SMTP_USER=your-email@163.com
SMTP_PASS=your-authorization-code
IMAP_HOST=imap.163.com
IMAP_PORT=993
IMAP_SECURE=true
IMAP_USER=your-email@163.com
IMAP_PASS=your-authorization-code
DEFAULT_FROM_EMAIL=your-email@163.com对于常见邮箱,可只配置账号和授权码,服务器会根据邮箱域名补全主机、端口和 TLS:
EMAIL_PROVIDER=imap-smtp
SMTP_USER=your-email@qq.com
SMTP_PASS=your-authorization-code
DEFAULT_FROM_EMAIL=your-email@qq.com当 IMAP_USER/IMAP_PASS 未设置时,会复用 SMTP 凭据;反向亦然。企业邮箱或自建邮箱
只需显式填写对应的 SMTP_* 和 IMAP_* 地址即可。
Gmail API 兼容模式
EMAIL_PROVIDER=gmail-api
GMAIL_CLIENT_ID=...
GMAIL_CLIENT_SECRET=...
GMAIL_REFRESH_TOKEN=...
DEFAULT_FROM_EMAIL=your-email@gmail.com也可只传有效的 GMAIL_ACCESS_TOKEN。如果使用 Gmail 的标准 IMAP/SMTP,则将
EMAIL_PROVIDER 设为 imap-smtp 并使用应用专用密码。
多邮箱切换(不增加工具)
使用 EMAIL_ACCOUNTS_JSON 定义命名账号:
EMAIL_DEFAULT_ACCOUNT=personal
EMAIL_ACCOUNTS_JSON={"personal":{"provider":"imap-smtp","from":"me@qq.com","smtp":{"user":"me@qq.com","pass":"qq-code"},"imap":{"user":"me@qq.com","pass":"qq-code"}},"work":{"provider":"imap-smtp","from":"me@outlook.com","smtp":{"user":"me@outlook.com","pass":"work-code"},"imap":{"user":"me@outlook.com","pass":"work-code"}}}随后直接在原有工具中选择账号:
{
"account": "work",
"limit": 10,
"folder": "INBOX"
}read_emails 和 search_emails 返回的 messageId 是不包含密码的定位符,其中保留了
命名账号和 IMAP 文件夹信息。把它直接传给 reply_email 或 delete_email 时,通常无需
再次填写 account。
通过请求头配置或切换邮箱
MCP 客户端可以为 Streamable HTTP 连接设置静态 Header:
{
"mcpServers": {
"email": {
"type": "streamable-http",
"url": "https://mail-mcp.example.com:3200/mcp",
"headers": {
"X-Email-Account": "work"
}
}
}
}也可以完全通过 Header 提供连接信息:
{
"X-Email-Provider": "imap-smtp",
"X-Email-From": "me@example.com",
"X-Email-SMTP-Host": "smtp.example.com",
"X-Email-SMTP-Port": "465",
"X-Email-SMTP-Secure": "true",
"X-Email-SMTP-User": "me@example.com",
"X-Email-SMTP-Pass": "app-password",
"X-Email-IMAP-Host": "imap.example.com",
"X-Email-IMAP-Port": "993",
"X-Email-IMAP-Secure": "true",
"X-Email-IMAP-User": "me@example.com",
"X-Email-IMAP-Pass": "app-password"
}还支持 X-Email-Config,值为完整 JSON,或 base64:<base64url-json>。可用字段与
EMAIL_ACCOUNTS_JSON 内单个账号相同。Base64url 只是编码,不是加密;机密性由 HTTPS
提供。
配置优先级从高到低:
单独的
X-Email-*连接 Header。X-Email-Config。account参数或X-Email-Account选中的命名账号。普通环境变量。
账号选择优先级为:工具 account > X-Email-Account > X-Email-Config.account >
EMAIL_DEFAULT_ACCOUNT。
Header 中可能包含邮箱授权码。跨机器部署时必须使用 HTTPS;需要客户端鉴权时再设置
MCP_API_KEY。不要在日志中打印请求头。
固定的 5 个工具
工具 | 用途 | 主要协议 |
| 发送纯文本/HTML 邮件及附件 | SMTP / Gmail API |
| 读取文件夹,可只读未读邮件 | IMAP / Gmail API |
| 搜索指定文件夹 | IMAP / Gmail API |
| 删除指定邮件 | IMAP / Gmail API |
| 回复或回复全部 | IMAP + SMTP / Gmail API |
五个工具均支持可选 account 参数。
通用 IMAP 搜索支持普通文本,以及:
from:alice@example.com subject:"quarterly report" since:2026-01-01 before:2026-08-01 is:unread服务配置
环境变量 | 默认值 | 说明 |
|
| HTTP/HTTPS 监听地址 |
|
| HTTP/HTTPS 端口 |
|
| Streamable HTTP 路径 |
| 空 | 可选;设置后启用 Bearer / |
| 空 | 可选 CORS 来源,多个值用逗号分隔 |
| 空 | 原生 HTTPS 私钥文件;必须与证书同时配置 |
| 空 | 原生 HTTPS 证书链文件 |
| 空 | 可选私钥口令 |
|
| 允许 |
| 空 | 可选 mTLS 客户端 CA |
|
| 是否强制验证客户端证书 |
|
| 是否信任代理提供的 |
|
| 仅测试用;允许不使用 TLS 的 SMTP/IMAP |
|
| 仅测试用;允许关闭邮箱服务器证书校验 |
验证
npm test共 15 项自动化测试,覆盖配置优先级、163 IMAP 泛化、命名账号切换、请求头覆盖、消息 定位符、搜索语法、标准 IMAP 读/搜/删、SMTP 发/回、HTTP/HTTPS Streamable HTTP、网络部署 安全策略、证书校验保护、强制 STARTTLS 和工具数量不变约束。
Available Tools
1 toolsend-emailC
发送邮件
| Name | Required | Description | Default |
|---|---|---|---|
| to | Yes | 邮件收件人 | |
| text | Yes | 邮件内容 | |
| subject | Yes | 邮件主题 |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations and no description of behavioral aspects like side effects, authorization, or error states.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
Single phrase is concise but lacks substance; not every word earns its place as it merely restates the name.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given no output schema or annotations, the description provides insufficient context for correct tool invocation.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema descriptions cover all parameters (100%), so baseline 3 applies; description adds no extra meaning.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
Description '发送邮件' is a tautology, restating the tool name 'send-email' with no added specificity or differentiation.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
No usage guidance provided; no mention of when to use this tool versus alternatives (none exist) or caveats.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
1 tool update
- First observed
send-email
TDQS
Scored across 1 tool
Only one tool exists, so there is no risk of confusion between tools.
With a single tool, naming consistency is trivially maintained.
A single send-email tool is too few for an email MCP server, which typically requires additional capabilities like reading, listing, or managing emails.
The tool surface is severely incomplete, covering only sending emails with no support for receiving, listing, or other common email operations.
Maintenance
Related MCP Connectors
Email infrastructure for AI agents — send, receive, search, and reply to email over MCP.
Hosted email for AI agents: create inboxes, send, receive, and reply over MCP with scoped API keys
A comprehensive Model Context Protocol (MCP) server that enables AI assistants to interact with yo…
Shipmail MCP server for AI agent custom-domain email inboxes with REST API and webhooks.
Related MCP Servers
- AlicenseAqualityDmaintenanceA Model Context Protocol server that provides a seamless email management interface through Claude, allowing users to search, read, and send emails directly through natural language conversations.4114MIT
- AlicenseNot gradedqualityFmaintenanceA Model Context Protocol server that enables LLMs to compose and send emails with attachments, as well as search for files in specified directories that match given patterns.80MIT
- AlicenseNot gradedqualityDmaintenanceA Model Context Protocol server that exposes multiple AI tools over SSE transport with JWT-based secure authentication, allowing for dynamic tool registration and session management.3,9704MIT
- AlicenseNot gradedqualityNot gradedmaintenanceA Model Context Protocol server that provides email access via IMAP and SMTP, enabling AI agents to read, search, send, and manage emails. It features specialized tools for folder management, message retrieval, and replying to threads through a standardized HTTP/SSE interface.-