Skip to main content
Glama
batsama

email-mcp-pro

by batsama

📧 email-mcp-pro

通用邮箱 MCP 服务器 — 基于 imapflow 重写 IMAP 实现,支持 IMAP ID 命令 (RFC 2971),完美兼容网易邮箱系列。

核心改进:原版 email-mcp 使用老的 node-imap 库,不支持 IMAP ID 命令,导致网易邮箱 (163/126/yeah) 读取邮件内容时报 EXAMINE Unsafe Login 错误。本版本改用 imapflow,在连接时自动发送 ID 命令声明客户端身份,彻底解决该问题。

✨ 功能特性

  • 📤 邮件发送:支持 HTML 和纯文本邮件、多收件人、抄送、密送、附件

  • 📥 邮件列表:获取最近 N 天的邮件列表(IMAP / POP3 双协议)

  • 📖 邮件内容:读取指定邮件的完整内容(文本、HTML、附件信息)

  • 🔧 动态配置:支持运行时配置邮箱服务器,自动识别邮箱类型

  • 🔍 连接测试:内置 SMTP / IMAP 服务器连接测试

  • 🛡️ IMAP ID 命令:自动发送 RFC 2971 ID 命令,兼容网易邮箱安全策略

  • 现代 IMAP 库:基于 imapflow,Promise/async 风格 API,更稳定可靠

Related MCP server: Email MCP Server

📦 支持的邮箱服务商

邮箱类型

SMTP

IMAP

POP3

备注

QQ邮箱

网易邮箱 (163/126/yeah)

IMAP ID 命令已修复

Gmail

需应用专用密码

Outlook/Hotmail

腾讯企业邮箱

阿里云邮箱

新浪邮箱

搜狐邮箱

🚀 快速开始

方式一:npx 直接运行(推荐)

无需安装,直接通过 npx 运行:

npx email-mcp-pro

在 MCP 客户端配置中使用:

{
  "mcpServers": {
    "email": {
      "command": "npx",
      "args": ["-y", "email-mcp-pro"],
      "env": {
        "EMAIL_USER": "your-email@163.com",
        "EMAIL_PASSWORD": "your-auth-code",
        "EMAIL_TYPE": "auto"
      }
    }
  }
}

方式二:全局安装

npm install -g email-mcp-pro
email-mcp-pro

方式三:从源码运行

git clone https://github.com/batsama/email-mcp-pro.git
cd email-mcp-pro
npm install
EMAIL_USER=your-email@163.com EMAIL_PASSWORD=your-auth-code node index.js

🔧 配置说明

环境变量

变量

必需

说明

EMAIL_USER

邮箱地址

EMAIL_PASSWORD

邮箱密码或客户端授权码

EMAIL_TYPE

可选

邮箱类型:auto(默认)、qq163gmailoutlookexmailaliyunsinasohu

也可以通过 MCP 工具 setup_email_account 在运行时动态配置。

网易邮箱配置指南

  1. 登录 163 邮箱

  2. 进入「设置」→「POP3/SMTP/IMAP」

  3. 开启「IMAP/SMTP服务」和「POP3/SMTP服务」

  4. 生成客户端授权密码(注意:不是登录密码)

  5. 使用授权码作为 EMAIL_PASSWORD

🛠️ MCP 工具说明

1. send_email — 发送邮件

{
  "to": ["recipient@example.com"],
  "subject": "测试邮件",
  "text": "这是一封测试邮件",
  "html": "<h1>测试邮件</h1><p>Hello World</p>"
}

2. get_recent_emails — 获取最近邮件列表

{
  "limit": 10,
  "days": 3
}

3. get_email_content — 获取邮件详情

{
  "uid": "1623676463"
}

4. setup_email_account — 设置邮箱账号

{
  "email": "user@163.com",
  "password": "your-auth-code",
  "provider": "163"
}

5. test_email_connection — 测试连接

{
  "testType": "both"
}

6. list_supported_providers — 列出支持的邮箱

7. configure_email_server — 手动配置服务器(高级)

🔧 本地测试

# 测试 IMAP 连接(含 ID 命令验证)
EMAIL_USER=your-email@163.com EMAIL_PASSWORD=your-auth-code node test-imapflow.js

📝 与原版 email-mcp 的区别

特性

原版 email-mcp

email-mcp-pro

IMAP 库

node-imap (已停止维护)

imapflow (活跃维护)

IMAP ID 命令 (RFC 2971)

❌ 不支持

✅ 自动发送

网易邮箱 IMAP 读取邮件

Unsafe Login 错误

✅ 正常工作

网易邮箱默认协议

POP3 (规避方案)

IMAP (原生支持)

API 风格

事件驱动 (Callback)

Promise/async

代码可维护性

较低

较高

📄 License

MIT License

Available Tools

7 tools
configure_email_serverB

手动配置邮箱服务器设置(高级用户使用)

ParametersJSON Schema
NameRequiredDescriptionDefault
userYes邮箱账号
imapHostNoIMAP服务器地址
imapPortNoIMAP端口
passwordYes邮箱密码或授权码
smtpHostNoSMTP服务器地址
smtpPortNoSMTP端口
imapSecureNo是否使用SSL
smtpSecureNo是否使用SSL

TDQS

B3.1/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description bears the full burden of disclosing behavior. It only says 'configure', which implies mutation, but does not describe side effects, whether existing settings are overwritten, whether credentials are stored, or whether a connection test occurs.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single compact sentence with the core operation front-loaded and the audience note at the end. It has no wasted words, though it is arguably so short that it under-informs.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

This is an 8-parameter mutating tool with no annotations and no output schema. The description is too thin to make clear the tool's effects, prerequisites, required permissions, or relationship to setup_email_account, leaving an agent under-equipped to invoke it confidently.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema already documents every parameter. The description adds no additional parameter-level meaning beyond labeling the configuration as manual and advanced.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states a verb and resource: manually configure email server settings. The word '手动' (manual) hints at a distinction from automated setup such as setup_email_account, but it does not explicitly name the sibling alternative.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

It implies the tool is for advanced users who need manual control rather than automatic setup, giving some context. However, it does not explicitly state when to use this instead of setup_email_account or when not to use it.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

get_email_contentA

获取指定邮件的详细内容

ParametersJSON Schema
NameRequiredDescriptionDefault
uidYes邮件唯一标识符

TDQS

A3.5/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

There are no annotations, so the description must communicate behavioral traits. '获取' implies read-only, but the description does not state that it has no side effects, what fields are returned, how errors/not-found are handled, or whether the content is plain text/HTML. This is a significant gap for a tool with no annotation support.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The entire description is one short, front-loaded sentence without filler or redundancy. Every word contributes to conveying the core operation.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a one-parameter getter, the core invocation is clear. However, with no output schema and no annotations, the description should state what '详细内容' includes (e.g., headers, body, attachments) or clarify the return behavior. It is minimally adequate but leaves the agent to assume the result shape.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100% and the uid parameter is already described as '邮件唯一标识符'. The tool description adds only that the target is '指定邮件', which does not meaningfully change the agent's understanding of the parameter beyond the schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description '获取指定邮件的详细内容' clearly identifies a specific action (retrieve) and resource (detailed content of a specified email). The word '指定' distinguishes it from get_recent_emails, and the sibling set makes this the obvious getter for a single pre-identified email.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The use case is implied rather than explicit: call this when you have a specific email uid and need its full contents. However, the description does not name alternatives such as get_recent_emails or state conditions when one should be preferred.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

get_recent_emailsC

获取最近三天的邮件列表

ParametersJSON Schema
NameRequiredDescriptionDefault
daysNo获取最近几天的邮件(默认3天)
limitNo返回邮件数量限制(默认20)

TDQS

C2.9/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description carries the full burden of behavior disclosure, but it only restates the basic retrieve action. It does not disclose whether emails are marked as read, whether an account must already be configured, what the returned list contains, or any error/rate-limit behavior.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, front-loaded sentence with no wasted words. It is appropriately sized for a simple list-retrieval tool, though it could include one phrase distinguishing it from get_email_content without becoming verbose.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given no output schema, no annotations, and a sibling setup_email_account that hints at prerequisites, the description is incomplete. It does not state what the returned email list looks like, that an account setup may be required, or how the days/limit parameters affect results beyond schema defaults.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the baseline is 3. The description adds no real parameter-level meaning beyond the schema; it only implies the default window, which the days parameter already documents with '默认3天'.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description '获取最近三天的邮件列表' clearly states the action (get) and resource (email list), which distinguishes it from siblings like send_email (sends) and get_email_content (retrieves one email's content). It loses a point because it hard-codes 'three days' while the days parameter allows customization, making the stated scope slightly narrower than actual behavior.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance is provided about when to use this tool versus alternatives. There is no mention that get_email_content is for reading a specific email's details, or that setup_email_account is a prerequisite. The agent must infer usage from sibling names alone.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

list_supported_providersA

列出支持的邮箱提供商

ParametersJSON Schema
NameRequiredDescriptionDefault

No parameters

TDQS

A4.2/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

There are no annotations, so the description carries the behavioral burden. The verb 'list' signals a read-only operation, but the description does not add context about whether authentication is required, whether the list is static or dynamic, or what the output structure looks like. It is minimally transparent but lacks depth.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, short, front-loaded sentence that names the action and the resource with no wasted words. It is appropriately sized for such a simple tool.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's simplicity—zero parameters, no output schema, and a narrow purpose—the description is sufficiently complete for an agent to select and invoke it correctly. It clearly states what will be returned conceptually (the list of supported email providers), though a bit more detail about the result format would have pushed it to a 5.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The tool has zero parameters and the schema coverage is effectively complete, so the description does not need to explain parameter behavior. The baseline for no parameters is 4, and the description correctly avoids inventing unnecessary parameter details.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description uses the specific verb 'list' with a clear resource ('supported email providers'), which exactly matches the tool name and distinguishes it from the sibling tools that send, fetch, set up, configure, or test. An agent can immediately understand what this tool does and why it exists.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description clearly implies this is the tool to call when an agent needs to know which email providers are available. It does not explicitly mention when not to use it or name alternatives, but none of the sibling tools perform this listing function, so the context is clear enough with no real exclusions needed.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

send_emailC

发送邮件

ParametersJSON Schema
NameRequiredDescriptionDefault
ccNo抄送邮箱地址列表(可选)
toYes收件人邮箱地址列表
bccNo密送邮箱地址列表(可选)
htmlNoHTML格式邮件内容(可选)
textYes纯文本邮件内容
subjectYes邮件主题
attachmentsNo邮件附件列表(可选)

TDQS

C2.1/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of disclosing behavioral traits. It only states 'send email' and does not mention side effects (e.g., email is irrevocably sent), required prior configuration, authentication needs, or handling of failures. The mutation-like nature of sending is implied by the name, but no additional behavioral context is provided.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness2/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is extremely short—only four Chinese characters—which is under-specification rather than effective conciseness. It does not earn its place because it adds negligible value over the tool name. A useful description would include at least one sentence on purpose or usage, so the brevity is a deficiency.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness1/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

The tool has 7 parameters, no output schema, and no annotations, yet the description provides no context about prerequisites, expected return values, or when to use it. An agent cannot determine whether an email account must be set up first, what happens on success or failure, or how html relates to text. This is completely inadequate for a tool of this complexity.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so all seven parameters have meaningful Chinese descriptions in the input schema. The description itself adds no parameter information, but the schema already documents each field (to, cc, subject, html, text, attachments, etc.). Baseline 3 is appropriate since the schema carries the semantic weight.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose2/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description '发送邮件' is a direct translation of the tool name 'send_email' and adds no new semantic information. It restates the name rather than specifying what the tool actually does, which is a tautology. While it conveys the general action of sending email, it fails to clarify scope or distinguish behavior beyond the name itself.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance is provided about when to use this tool versus alternatives like setup_email_account or configure_email_server. The description does not mention prerequisites, such as having a configured email account, nor does it exclude cases where other tools are more appropriate. There is no context or comparison to siblings.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

setup_email_accountC

设置邮箱账号(自动识别邮箱类型并配置服务器)

ParametersJSON Schema
NameRequiredDescriptionDefault
emailYes邮箱地址(如 user@qq.com)
passwordYes邮箱密码或授权码
providerNo邮箱提供商(可选,不填写则自动识别)

TDQS

C2.9/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

没有任何 annotations,描述需承担全部行为披露责任。它只透露了自动识别和配置服务器,但未说明操作是否有副作用、会写入哪些账号配置、密码如何被使用或存储、自动识别失败时会发生什么。对这些关键行为完全沉默。

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

整句仅一句话,信息密度高且先给出主行为再说明自动配置能力,没有冗余内容。但过于简短导致行为细节缺失,所以未给5分。

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

该工具涉及账号配置和凭据处理,且没有 output schema 说明调用结果,也没有 annotations 覆盖安全性。描述缺少返回/结果形式、配置生效范围、与 configure_email_server 的分工等关键上下文,代理难以判断调用后的状态。

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

input schema 对 3 个参数均有 description,覆盖率为 100%,因此基础分为 3。描述中的“自动识别邮箱类型并配置服务器”与 schema 中 provider 的“不填写则自动识别”语义一致,但未额外补充参数格式、约束或交互关系。

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

描述使用明确动词“设置”和宾语“邮箱账号”,并补充了“自动识别邮箱类型并配置服务器”这一核心行为,代理能知道该工具做什么。但与兄弟工具 configure_email_server 存在语义重叠,未做区分,因此不到5分。

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

描述没有说明何时该用本工具而不是 configure_email_server、list_supported_providers 或 test_email_connection。也没有给出前提条件(如是否需要授权码、是否必须先列出支持提供商)。代理只能靠猜测选择工具。

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

test_email_connectionC

测试邮箱服务器连接

ParametersJSON Schema
NameRequiredDescriptionDefault
testTypeNo测试类型:smtp(发送)、imap(接收)或both(全部)

TDQS

C2.9/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden of behavioral disclosure. It only says 'test email server connection' and does not state whether it sends a probe email, checks authentication, modifies any state, or how results/errors are returned.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single concise sentence with no wasted words, and the core purpose is front-loaded. It is somewhat under-specified, but as a concise statement it is clean and scannable.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

The tool is simple, but there is no output schema or annotations, and the description does not explain what a successful test looks like, what happens when testType is omitted, or what underlying behavior is being verified. An agent would need more context to interpret the result correctly.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, and the testType parameter already has a clear description and enum values, so the baseline is 3. The description itself adds no additional parameter semantics, but the schema adequately covers the meaning of smtp, imap, and both.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states a specific verb ('test') and resource ('email server connection'), and the name aligns with that. It is distinguishable from siblings like send_email, get_recent_emails, and configure_email_server, though it does not mention the SMTP/IMAP scope until the schema is read.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

There is no guidance on when to use this tool versus the sibling tools, such as configure_email_server or setup_email_account. It also does not explain prerequisites, such as whether an email account must already be configured before testing.

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. 7 tool updatesv1.0.0
    • First observedconfigure_email_server
    • First observedget_email_content
    • First observedget_recent_emails
    • First observedlist_supported_providers
    • First observedsend_email
    • First observedsetup_email_account
    • First observedtest_email_connection

TDQS

B3.2/5.0

Scored across 7 tools

Disambiguation4/5

Most tools target distinct actions like sending, retrieving, listing, and testing. setup_email_account and configure_email_server have some overlap, but their automatic vs manual distinction in the descriptions helps clarify their boundaries.

Naming Consistency5/5

All tool names follow a consistent verb_noun snake_case pattern, such as send_email, get_recent_emails, and list_supported_providers. This makes the tool set predictable and easy to navigate.

Tool Count5/5

Seven tools is a well-scoped size for an email MCP server, covering account setup, connection testing, sending, and retrieval. Each tool serves a clear functional role without unnecessary bloat.

Completeness4/5

The set covers the core email workflows: account configuration, connectivity testing, sending, and reading recent messages. Minor gaps exist such as no search, attachment handling, or message deletion, but they are workarounds rather than critical dead ends.

Maintenance

ActivityMaintained
ResponsivenessNo issues

Related MCP Connectors

Related MCP Servers