mcp-email-server
Click on "Install 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., "@mcp-email-serverCheck my inbox for unread emails from my boss"
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.
mcp-email-server
一个能收发邮件的 MCP 服务器。通过标准 IMAP 读信、标准 SMTP 发信,因此 Gmail、QQ、163、Outlook、企业自建邮箱都能接入,不依赖任何单一服务商的私有 API。
用 Python 编写,基于 MCP Python SDK v2。
它能做什么
读信
工具 | 作用 |
| 按发件人、主题、正文、日期、未读状态搜索,返回简要列表 |
| 读取单封邮件全文、头信息与附件清单 |
| 阻塞等待新邮件到达(例如等验证码),超时返回 |
| 列出邮箱文件夹及其特殊用途标记 |
| 把附件保存到本地目录 |
写信
工具 | 作用 |
| 发送邮件,支持抄送、密送、HTML、附件、回复原邮件 |
| 只存草稿不发送,交给人工在自己的客户端里过目 |
管理与诊断
工具 | 作用 |
| 标记已读/未读、加星/取消 |
| 移动到其他文件夹 |
| 移入垃圾箱(是移动不是彻底删除,可恢复) |
| 分别验证 IMAP 与 SMTP 是否可用,且绝不回显密码 |
此外还提供资源 email://{文件夹}/{uid}(把某封邮件当作上下文附件挂进对话),以及提示词 draft_reply(带原文引用地起草回复)。
Related MCP server: Email MCP Server
安装
需要 Python 3.10 及以上。
git clone <this-repo> && cd mcp-email-server
python3 -m venv .venv
.venv/bin/pip install -e .配置
复制 .env.example 为 .env 并填写,或者直接用环境变量。
cp .env.example .env最小可用配置:
IMAP_HOST=imap.qq.com
IMAP_USERNAME=you@qq.com
IMAP_PASSWORD=你的授权码
SMTP_HOST=smtp.qq.com
EMAIL_FROM=you@qq.com
EMAIL_ALLOW_SEND=true填完先自检,不用启动客户端:
.venv/bin/mcp-email-server --check它会分别连接 IMAP 与 SMTP 并报告结果,成功时退出码为 0。
各邮箱服务商参数
服务商 | IMAP | SMTP | 密码填什么 |
Gmail |
|
| 应用专用密码(需先开两步验证) |
QQ 邮箱 |
|
| 授权码(设置 → 账户 → 开启 IMAP/SMTP 服务) |
163 / 126 |
|
| 客户端授权密码(设置 → POP3/SMTP/IMAP) |
Outlook / M365 |
|
| 见下方说明 |
自建(Dovecot 等) |
|
| 账号密码 |
几个务必注意的点:
绝大多数服务商不接受登录密码。Gmail、QQ、163 都要求单独生成一串"授权码"或"应用专用密码",填错了会得到一条含糊的登录失败信息。
Microsoft 已停用个人 Outlook.com 与多数 M365 租户的基本认证(basic auth)。也就是说密码方式在那里多半已经行不通,需要 OAuth2 —— 本项目当前尚未实现完整的 OAuth2 授权流程(见下文"扩展 OAuth2")。
163/126 需要 IMAP
ID命令,否则登录后每条命令都会被拒绝并返回Unsafe Login。本服务器会在服务端声明支持时自动发送该命令,你不需要做任何事。SMTP_USERNAME/SMTP_PASSWORD留空时自动复用IMAP_*的值,同一个账号不必填两遍。
安全开关
默认配置是保守的:装好之后只能读信,不能发信也不能删信。这是刻意的——模型可能误解意图,而发出去的邮件收不回来。
变量 | 默认 | 作用 |
|
| 不显式打开就无法发信 |
|
| 不显式打开就无法移动或删除邮件 |
| 空(放行所有人) | 收件人白名单,可写完整地址或域名 |
|
| 附件读写只允许发生在此目录内 |
|
| 单封正文返回上限,避免撑爆模型上下文 |
|
| 发信后往"已发送"追加一份副本 |
刚接入时强烈建议先把白名单设成你自己的地址,确认整条链路行为符合预期后再放开:
EMAIL_RECIPIENT_ALLOWLIST=me@example.com白名单支持三种写法:完整地址 bob@example.com、域名 @example.com 或 example.com。匹配的是真实地址,不是显示名,所以 me@example.com <attacker@evil.com> 这类伪装会被拒绝。
关于 EMAIL_SAVE_SENT_COPY:Gmail 会在服务端自动保存通过 SMTP 发出的邮件,而 QQ、163 等大多数服务商不会——在那些邮箱上如果不打开这个开关,你发出去的信除了对方收件箱之外哪儿都不存在。
接入 Cursor
在项目里建 .cursor/mcp.json(或用户级 ~/.cursor/mcp.json):
{
"mcpServers": {
"email": {
"command": "/绝对路径/mcp-email-server/.venv/bin/mcp-email-server",
"env": {
"IMAP_HOST": "imap.qq.com",
"IMAP_USERNAME": "you@qq.com",
"IMAP_PASSWORD": "你的授权码",
"SMTP_HOST": "smtp.qq.com",
"EMAIL_FROM": "you@qq.com",
"EMAIL_ALLOW_SEND": "true",
"EMAIL_RECIPIENT_ALLOWLIST": "you@qq.com"
}
}
}
}Claude Desktop 的 claude_desktop_config.json 格式相同。
如果不想把密码写进配置文件,可以省略 env,改为在项目根目录放一个 .env——服务器启动时会自动读取。此时记得把 .env 加入 .gitignore(本仓库已经加了)。
想通过 HTTP 而不是 stdio 提供服务:
mcp-email-server --transport streamable-http --host 127.0.0.1 --port 8000注意 HTTP 模式没有内置鉴权,只应绑定在本机或可信网络内。
用起来是什么样
配好之后直接用自然语言指挥即可:
"看看我收件箱里有没有来自财务的未读邮件" →
search_emails"把第二封的完整内容念给我听" →
read_email"帮我回复她,说方案我同意,周五之前给她初稿" →
draft_reply/send_email(带reply_to_uid,回复会正确挂在原会话线程上)"等一下验证码邮件,收到告诉我" →
wait_for_new_emails"把那封带发票的附件下载下来" →
download_attachment
服务器的 instructions 里明确要求模型在调用 send_email 前先把收件人、主题、正文摆给你确认,各工具也带了 readOnlyHint / destructiveHint 标注,支持的客户端会据此决定是否弹出确认框。但这些是提示而非强制——真正的兜底是上面那几个开关和白名单。
开发
.venv/bin/pip install -e ".[dev]"
.venv/bin/python -m pytest测试不需要任何真实邮箱账号:
SMTP 发信路径用
aiosmtpd起一个本地真实 SMTP 服务(含 AUTH),断言信封收件人、MIME 结构、附件内容、中文主题的 RFC 2047 编码。IMAP 路径用真实构造的 RFC 5322 报文喂给假 mailbox,覆盖编码头解码、HTML-only 正文降级、超长截断、附件文件名消毒。
工具契约用 SDK 自带的内存客户端
Client(mcp)直连服务器对象,不起进程不占端口。安全策略单独覆盖:开关关闭时必须拒绝、白名单外必须拒绝、错误信息里绝不出现密码。
用 MCP Inspector 手动点一遍(需要本机有 Node.js):
npx @modelcontextprotocol/inspector .venv/bin/mcp-email-server这里直接把 Inspector 指向安装好的可执行文件,而不是用 mcp dev src/mcp_email/server.py——后者会按文件路径加载模块,包内的相对导入会因此失效。
代码检查:
.venv/bin/ruff check src tests代码结构
src/mcp_email/
config.py # 环境变量配置与安全策略(白名单、路径限制、密码脱敏)
auth.py # AuthProvider 抽象:PasswordAuth,以及 XOAuth2Auth 的骨架
models.py # 工具返回的 Pydantic 模型,也就是对模型暴露的契约
imap_client.py # 收信:连接、搜索、解析、标记、移动、附件、轮询新邮件
smtp_client.py # 发信:MIME 组装与投递
server.py # MCPServer:全部工具、资源与提示词
__main__.py # CLI 入口每次 IMAP 操作都是"连接 → 干活 → 登出"。IMAP 服务器会主动断开空闲连接,而一个 MCP 服务器可能几小时都没人调用,长连接放在那儿多半已经死了。
扩展 OAuth2
auth.py 里的 AuthProvider 就是为此准备的:imap_client 和 smtp_client 从不直接接触密码,只调用 authenticate_imap / authenticate_smtp。
XOAuth2Auth 已经写好了两侧的 SASL XOAUTH2 报文格式,缺的只是令牌本身——给它一个能返回 access token 的 token_provider 就能工作。还没做的是外围的授权流程:拿到 refresh token、刷新、本地缓存。这部分完成后,build_auth() 里加一个分支即可,IMAP 与 SMTP 客户端一行都不用改。
已知限制
等待新邮件用的是轮询而非 IMAP IDLE 推送。
imaplib的idle()要 Python 3.13 才有,而轮询对所有服务商都可用;代价是最长有一个轮询间隔的延迟。HTML 邮件转纯文本是基于标准库
HTMLParser的朴素实现,能保留段落和列表的换行,但复杂排版(表格布局、内联样式)会被压平。尚未实现 OAuth2 授权流程,因此接不了已停用基本认证的 Microsoft 账号。
许可
MIT
Available Tools
11 toolscheck_connectionCheck the mail connectionARead-only
Verify the IMAP and SMTP credentials and report which actions are permitted.
Run this first when a tool fails or the account setup is unknown. Credentials are never included in the result.
| Name | Required | Description | Default |
|---|---|---|---|
No parameters | |||
Output Schema
| Name | Required | Description |
|---|---|---|
| imap | Yes | |
| smtp | Yes | |
| account | No | Username the server is configured to use. |
| sending_enabled | No | |
| deleting_enabled | No | |
| recipient_allowlist | No |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
Annotations already mark it read-only, and the description adds valuable behavior: credentials are never included in the result and the tool reports permitted actions. This helps set expectations beyond the schema.
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?
Two short sentences with no filler. The core purpose is front-loaded, and the usage guidance and privacy note each earn their place.
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?
For a parameterless diagnostic tool with an output schema, the description fully covers when to use it, what it verifies, and an important behavioral caveat. Nothing essential is missing.
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?
The tool has zero parameters, so the schema carries no burden. The description appropriately focuses on behavior rather than parameter documentation.
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?
The description states a specific verb and resource: verify IMAP/SMTP credentials and report permitted actions. This clearly differentiates it from the sibling email operations, none of which are diagnostic.
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?
Explicitly instructs to run this tool first when a tool fails or account setup is unknown. This gives an agent a clear decision rule for when to invoke it.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
delete_emailDelete an emailADestructive
Move a message to Trash. Requires EMAIL_ALLOW_DELETE=true.
This is a move, not an expunge, so the user can still recover the message from their Trash folder.
| Name | Required | Description | Default |
|---|---|---|---|
| uid | Yes | IMAP UID of the message. | |
| folder | No | Folder the message is in. | INBOX |
Output Schema
| Name | Required | Description |
|---|---|---|
| uid | Yes | |
| action | Yes | What was done, e.g. 'moved' or 'marked read'. |
| detail | No | |
| folder | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
Annotations already flag destructiveHint=true, but the description adds that the operation is a move to Trash rather than an expunge, so the message remains recoverable. It also discloses the EMAIL_ALLOW_DELETE=true prerequisite. These details go beyond the annotation and clarify the actual destructive scope and conditions, providing substantial added context.
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?
The description is concise (two short paragraphs) and front-loads the core action and prerequisite in the first sentence. The second paragraph adds a single clarifying nuance about recoverability. No unnecessary words or repetition. It is well-structured and efficient.
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?
For a tool with only 2 parameters (1 required) and an output schema present, the description covers the essential behavioral aspects: the action, the recoverability, and the prerequisite. Nothing critical is missing, and the existence of an output schema means return values are already defined. The description is complete for its complexity.
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?
The input schema already describes both parameters (uid and folder) with 100% coverage. The description does not add further explanation of parameters or their usage beyond what the schema provides. It only mentions the folder implicitly through the move-to-Trash action, but that's not new information. Baseline 3 is appropriate given high schema coverage.
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?
The description states a specific action ('Move a message to Trash') with a clear resource (a message) and destination (Trash). It differentiates from the sibling move_email by specifying the Trash destination and the recoverable nature, making its purpose unambiguous. The title also aligns perfectly.
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?
The description does not explicitly state when to use this tool versus alternatives like move_email. It implies this is for deletion (to Trash) but doesn't contrast with move_email or other siblings. The only guideline is the prerequisite EMAIL_ALLOW_DELETE=true, which is a requirement rather than a selection criterion. Guidance is minimal but present.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
download_attachmentDownload an attachmentA
Save an attachment into the server's attachment directory and return its path.
Writes are confined to EMAIL_ATTACHMENT_DIR, and the sender's filename is sanitised before use.
| Name | Required | Description | Default |
|---|---|---|---|
| uid | Yes | IMAP UID of the message. | |
| folder | No | Folder the message is in. | INBOX |
| filename | No | Which attachment to save. Required when the message has several. |
Output Schema
| Name | Required | Description |
|---|---|---|
| path | Yes | Absolute path of the saved file. |
| size | No | |
| filename | Yes | |
| content_type | No |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
Annotations already indicate this is a write operation (readOnlyHint=false) and not destructive (destructiveHint=false). The description adds materially useful context: writes are confined to EMAIL_ATTACHMENT_DIR and filenames are sanitised, which clarifies side-effect scope and security behavior. This goes beyond the annotations without contradicting them.
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?
Three short sentences deliver the action, result, and key behavioral constraints with no redundancy. The most important information is front-loaded, and every sentence earns its place.
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?
For a tool with full schema coverage, an output schema, and annotations covering read/write/destructive hints, the description is sufficiently complete. It adds security and scope constraints that matter for safe invocation. Minor omissions like overwrite behavior or error handling are not critical given the available structured metadata.
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 description coverage is 100%, so the parameters are fully documented in the schema. The description does not add parameter-level meaning, but it also does not need to because the schema already explains uid, folder, and filename. The baseline of 3 applies because the description offers no supplementary parameter insight.
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?
The description states a specific action ('Save an attachment'), the destination ('server's attachment directory'), and the result ('return its path'). It clearly distinguishes itself from the sibling tools, none of which handle attachment downloading.
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?
The purpose implicitly defines when to use this tool: when a downloaded attachment is needed. However, there is no explicit guidance about when not to use it or which alternatives to prefer. The description does not mention exclusions or conditions beyond the simple action, so guidance is implied rather than stated.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
list_foldersList mail foldersARead-only
List the folders in the mailbox, with their IMAP special-use flags.
| Name | Required | Description | Default |
|---|---|---|---|
No parameters | |||
Output Schema
| Name | Required | Description |
|---|---|---|
| result | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
Annotations already declare readOnlyHint=true and openWorldHint=true, so the safety profile is covered. The description adds that the output includes IMAP special-use flags, which is useful return-value context. However, it does not disclose potential behaviors such as sorting, pagination, failure modes, or whether folder hierarchy details are included.
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?
The description is a single sentence that immediately states what the tool does and the key output detail. There is no filler, and the most important information is front-loaded.
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?
For a read-only, zero-parameter list operation with an output schema present, the description is sufficient. The agent knows what will be returned (folders with IMAP special-use flags) and that no arguments are needed. Nothing essential is missing for correct 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?
The tool has zero parameters and schema description coverage is 100%, so the schema fully defines the input contract. With no parameters to explain, the description does not need to add parameter-level detail. This warrants the baseline score of 4.
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?
The description states a specific verb and resource: 'List the folders in the mailbox'. It also adds a distinguishing detail, 'with their IMAP special-use flags', which is not present in any sibling tool description. This makes the tool's purpose clear and unique among the listed siblings.
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?
There is no explicit guidance about when to use this tool versus alternatives, nor any mention of prerequisites such as needing an existing connection. The tool name and description make the basic intent obvious, but the description does not provide usage context or exclusions.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
mark_emailFlag an emailAIdempotent
Mark a message read or unread, and flag or unflag it.
| Name | Required | Description | Default |
|---|---|---|---|
| uid | Yes | IMAP UID of the message. | |
| seen | No | True marks it read, False marks it unread. | |
| folder | No | Folder the message is in. | INBOX |
| flagged | No | True stars/flags it, False clears the flag. |
Output Schema
| Name | Required | Description |
|---|---|---|
| uid | Yes | |
| action | Yes | What was done, e.g. 'moved' or 'marked read'. |
| detail | No | |
| folder | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
Annotations already convey readOnlyHint=false, destructiveHint=false, idempotentHint=true, and openWorldHint=true. The description adds no behavioral context beyond those annotations; it restates the seen/flagged actions without disclosing additional traits such as authorization needs or side effects, so it meets the baseline but does not exceed it.
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?
A single, front-loaded sentence communicates the complete purpose with no filler or redundancy. Every word contributes to understanding the tool's scope.
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 the annotations, full parameter schemas, and an output schema, the concise description is sufficient for an agent to select and invoke the tool correctly. The only slight tension is the title, but the description resolves it, so nothing essential is missing.
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 description coverage is 100%, so every parameter (uid, seen, folder, flagged) already has a clear schema description. The tool description adds no additional parameter semantics beyond what the schema provides, matching the baseline for full schema coverage.
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?
The description uses a specific verb ('mark') and resource ('a message') and enumerates the exact operations: read/unread and flag/unflag. Although the title 'Flag an email' is narrower, the description clarifies the full scope and distinguishes this from sibling tools like read_email, move_email, and delete_email.
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?
The context is clear: use this tool when a message's seen or flagged state needs to be changed. However, the description does not explicitly state alternatives or exclusion conditions, such as 'use read_email if you only need to view the message,' so usage guidance is implied rather than stated.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
move_emailMove an emailADestructive
Move a message to another folder. Requires EMAIL_ALLOW_DELETE=true.
| Name | Required | Description | Default |
|---|---|---|---|
| uid | Yes | IMAP UID of the message. | |
| folder | No | Folder the message is currently in. | INBOX |
| destination | Yes | Folder to move the message into. |
Output Schema
| Name | Required | Description |
|---|---|---|
| uid | Yes | |
| action | Yes | What was done, e.g. 'moved' or 'marked read'. |
| detail | No | |
| folder | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
Annotations already flag this as destructive, so the description's added value is the permission requirement EMAIL_ALLOW_DELETE=true, which is useful operational context. This does not contradict the annotations.
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?
The description is two short sentences with no filler. The core action is front-loaded and the permission requirement is stated immediately after.
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?
The tool is simple, has an output schema, and benefits from annotations that indicate destructive behavior. The description adds the key precondition. A minor gap is that it does not describe failure behavior, but this is not critical given the annotations and schema coverage.
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 description coverage is 100%, so the schema already documents uid, folder, and destination. The description does not add parameter-specific meaning beyond the action, so a baseline score of 3 is appropriate.
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?
The description states a specific verb ('Move') and resource ('message to another folder'), making the operation unambiguous. It stands apart from siblings like delete_email and mark_email because the action and target are clearly named.
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?
The description gives clear context for when to use the tool: moving a message between folders. It also provides a concrete precondition, EMAIL_ALLOW_DELETE=true, which helps an agent determine whether the call is permitted. It does not explicitly exclude alternatives, but the context is sufficient given the sibling set.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
read_emailRead an emailARead-only
Open one message and return its body, headers, and attachment list.
Bodies are returned as plain text; HTML-only messages are converted, and long bodies are truncated with a marker rather than silently cut.
| Name | Required | Description | Default |
|---|---|---|---|
| uid | Yes | IMAP UID, as returned by search_emails. | |
| folder | No | Folder the message is in. | INBOX |
| mark_as_read | No | Set the Seen flag as a side effect of reading. | |
| max_body_chars | No | Override the configured body length limit. |
Output Schema
| Name | Required | Description |
|---|---|---|
| cc | No | |
| to | No | |
| uid | Yes | |
| body | No | Plain-text body. HTML-only mail is converted to text. |
| date | No | |
| seen | No | |
| size | No | |
| folder | Yes | |
| sender | No | |
| flagged | No | |
| subject | No | |
| reply_to | No | |
| truncated | No | True when the body was cut short at the configured limit. |
| message_id | No | RFC 5322 Message-ID, used for threading replies. |
| references | No | |
| attachments | No | |
| in_reply_to | No | |
| sender_name | No | |
| body_is_converted_html | No | True when the message had no plain-text part and the body was derived from HTML. |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
Beyond the readOnlyHint and openWorldHint annotations, the description discloses useful return-behavior details: HTML-only messages are converted to plain text, and long bodies are truncated with a marker rather than silently cut. This helps the agent set expectations about the content it will receive. It does not discuss error behavior or rate limits, but with read-only annotation coverage this is adequate.
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?
Two short sentences front-load the core behavior and then add the only critical output caveat about body conversion and truncation. There is no filler, repetition, or unnecessary detail.
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?
With an output schema, 100% parameter coverage, and read-only annotations, the description covers the important behavioral caveats. A minor gap is the lack of an explicit pointer to download_attachment for attachment content, but the phrase 'attachment list' already distinguishes the tool from that sibling.
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 description coverage is 100%, so the parameters are already well documented. The description adds no parameter-specific meaning beyond confirming that body, headers, and attachment list are returned; therefore the baseline score of 3 applies.
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?
The description uses a specific verb and resource: 'Open one message and return its body, headers, and attachment list.' This clearly identifies the operation and distinguishes it from sibling tools like search_emails (finding messages) and download_attachment (fetching attachment bytes).
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?
The description implies the intended flow: after search_emails returns a UID, open that message. The uid parameter description reinforces this by saying the UID comes from search_emails. However, the description itself does not explicitly list when not to use this tool or direct the agent to download_attachment for actual attachment content, so it stops short of a 5.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
save_draftSave a draftA
Write a message to the Drafts folder without sending it.
This is the safe way to prepare mail: the user opens their own mail client, reviews it, and sends it themselves. It works even when EMAIL_ALLOW_SEND is false, because nothing leaves the account.
| Name | Required | Description | Default |
|---|---|---|---|
| cc | No | Cc recipients. | |
| to | No | Intended recipients. | |
| bcc | No | Bcc recipients. | |
| body | Yes | Plain-text body. | |
| html | No | Optional HTML alternative. | |
| subject | Yes | Subject line. | |
| attachments | No | Filenames inside the server's attachment directory. | |
| reply_to_uid | No | UID of a message this draft replies to. | |
| reply_to_folder | No | Folder holding the message being replied to. | INBOX |
Output Schema
| Name | Required | Description |
|---|---|---|
| folder | Yes | Folder the draft was appended to. |
| subject | No | |
| message_id | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
Annotations indicate this is a mutating operation (readOnlyHint=false) but not destructive. The description adds substantive context beyond annotations: it writes to the Drafts folder, nothing leaves the account, and it is safe when sending is disabled. This gives the agent important behavioral expectations.
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?
Three short sentences with each one earning its place: the core action, the safety rationale, and the crucial condition about EMAIL_ALLOW_SEND. It is front-loaded with the primary purpose and contains no filler.
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 the output schema exists and annotations are present, the description covers the essential context for correct invocation: what the tool does, why it is safe, and when it works. A bit more detail about draft placement or reply_to behavior would be helpful but is not required for basic use.
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 description coverage is 100%, so the schema already documents every parameter. The description does not add parameter-specific detail, but the baseline of 3 applies because the schema carries the full burden.
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?
The description opens with a specific verb and resource: 'Write a message to the Drafts folder without sending it.' It clearly differentiates from send_email by emphasizing that the user will send it themselves, so an agent can distinguish this tool from its siblings.
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?
The description explains when to use this tool: as the safe way to prepare mail when the user wants to review it first, and it explicitly notes it works when EMAIL_ALLOW_SEND is false. It does not name send_email outright but the contrast is strong enough to guide selection.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
search_emailsSearch emailARead-only
Find messages, newest first, returning short summaries rather than full bodies.
Every filter is combined with AND, and omitting all of them returns the most recent messages in the folder. Reading a message costs a separate read_email call, using the uid from these results.
| Name | Required | Description | Default |
|---|---|---|---|
| limit | No | Maximum results. | |
| since | No | Only messages sent on or after this date. | |
| before | No | Only messages sent strictly before this date. | |
| folder | No | Folder to search. | INBOX |
| to_contains | No | Match the To header against this substring. | |
| unread_only | No | Only unread messages. | |
| flagged_only | No | Only flagged/starred messages. | |
| from_contains | No | Match the From header against this substring. | |
| text_contains | No | Match anywhere in the headers or body. | |
| subject_contains | No | Match the subject against this substring. |
Output Schema
| Name | Required | Description |
|---|---|---|
| result | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
Annotations already declare readOnlyHint and openWorldHint, and the description adds meaningful behavior: newest-first ordering, summary-only results, AND-combined filters, and empty-query behavior. It also clarifies the relationship to read_email via uid. This goes well beyond the structured annotations without contradicting them.
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?
Three sentences front-load the core purpose, then compactly convey filter behavior and the necessary next step. Every sentence earns its place, and there is no redundancy with the schema.
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?
For a 10-parameter search tool, the description plus rich schema and output schema cover the essentials: order, result shape, filter semantics, default behavior, and follow-up action. It is not fully exhaustive—e.g., it does not mention pagination beyond limit—but the available structured data fills most gaps.
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 description coverage is 100%, so the baseline is 3. The description adds value by explaining how filters combine (AND) and what happens when no filters are provided, which is not stated in individual parameter descriptions. This is a meaningful supplement to the schema.
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 names a specific verb ('Find messages') and resource, and differentiates from sibling tools by explicitly stating the result is short summaries, not full bodies. It also names the companion read_email call, so the agent understands where search ends and retrieval begins.
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?
The description provides clear usage context: filters are ANDed, omitting all filters returns recent messages, and full message bodies require a separate read_email call. It does not explicitly enumerate when not to use this tool versus siblings like wait_for_new_emails, but the context is strong enough for an agent to choose correctly.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
send_emailSend an emailA
Send an email. This is irreversible: confirm the content with the user first.
Sending only works when EMAIL_ALLOW_SEND=true, and every recipient must pass the configured allowlist. Pass reply_to_uid to answer an existing message: the reply is threaded correctly and the recipient and subject are filled in from the original.
| Name | Required | Description | Default |
|---|---|---|---|
| cc | No | Cc recipients. | |
| to | No | Recipients. Plain addresses or 'Name <a@b.com>' both work. | |
| bcc | No | Bcc recipients. | |
| body | Yes | Plain-text body. | |
| html | No | Optional HTML alternative. Always send body as well. | |
| subject | Yes | Subject line. | |
| attachments | No | Filenames inside the server's attachment directory. | |
| reply_to_uid | No | UID of a message to reply to; threads the reply and fills in To. | |
| reply_to_folder | No | Folder holding the message being replied to. | INBOX |
Output Schema
| Name | Required | Description |
|---|---|---|
| sender | Yes | |
| subject | No | |
| accepted | Yes | Recipients the server accepted. |
| rejected | No | Recipients the server refused. |
| message_id | Yes | Message-ID assigned to the outgoing mail. |
| saved_to_folder | No | Folder a copy was appended to, when the account keeps sent mail server-side. |
| attachment_count | No |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
Beyond the annotations, the description reveals that sending is irreversible, requires user confirmation, is gated by an environment flag, and enforces recipient allowlisting. It also explains reply threading/filling behavior. This is rich contextual disclosure that helps the agent anticipate real-world consequences.
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?
Three tightly written sentences. The most important safety warning is front-loaded, followed by enabling conditions and a specific usage pattern. There is no filler or repetition of schema details.
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?
For a 9-parameter tool, the description covers the key operational constraints: side-effect irreversibility, user confirmation, environment gating, allowlist enforcement, and reply behavior. The schema covers parameters, and an output schema exists, so nothing critical is missing.
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 coverage is 100%, so the baseline is 3. The description adds meaningful semantics for reply_to_uid, explaining that it threads the reply and auto-fills recipient and subject. This goes beyond the schema's simple field descriptions.
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?
The description opens with 'Send an email', a specific verb and resource. It further differentiates itself by highlighting irreversibility and the reply behavior, which separates it from sibling tools like save_draft and read_email.
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?
The description gives clear context: confirm content first, sending only works when EMAIL_ALLOW_SEND=true, allowlist requirements, and how to reply via reply_to_uid. It does not explicitly contrast with save_draft, so it misses the full 'when to use vs alternatives' guidance.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
wait_for_new_emailsWait for new emailARead-only
Block until mail arrives in the folder, then return the new messages.
Use this to wait for something expected, such as a verification code. It returns as soon as anything arrives, or empty-handed when the timeout elapses; nothing already in the folder is reported.
| Name | Required | Description | Default |
|---|---|---|---|
| limit | No | Maximum messages to return. | |
| folder | No | Folder to watch. | INBOX |
| timeout_seconds | No | How long to wait before giving up. | |
| poll_interval_seconds | No | Seconds between checks. |
Output Schema
| Name | Required | Description |
|---|---|---|
| messages | No | Messages that arrived during the wait, oldest first. |
| timed_out | Yes | True when the wait elapsed with nothing new arriving. |
| waited_seconds | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
The description discloses blocking behavior, early return upon arrival, empty results on timeout, and exclusion of pre-existing messages. These details go beyond the readOnlyHint and openWorldHint annotations and give the agent accurate expectations for a potentially long-running call.
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?
Two tight paragraphs with no filler; the main verb and resource come first, followed by a use case and edge-case behavior. Every sentence contributes useful information.
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?
For a blocking read tool, the description, annotations, full parameter schema, and output schema together fully specify when and how to invoke it. The agent knows the purpose, wait semantics, timeout behavior, and that existing messages are excluded.
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 coverage is 100%, with all four parameters documented with defaults and bounds, so the description does not need to repeat parameter details. It adds contextual framing around blocking and new messages, but no parameter-specific semantics beyond what the schema already provides.
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 opens with a clear verb ('Block') and resource ('mail arrives in the folder... return the new messages'). It distinguishes itself from reading existing mail by emphasizing only new arrivals and gives a concrete example use case (verification code).
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?
States when to use it: 'wait for something expected, such as a verification code.' It also clarifies a boundary with 'nothing already in the folder is reported,' which tells the agent not to use this for reading existing mail. It does not explicitly name sibling alternatives, but the context is clear enough.
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. Dates show when Glama detected each change.
11 tool updates
v0.1.0- First observed
check_connection - First observed
delete_email - First observed
download_attachment - First observed
list_folders - First observed
mark_email - First observed
move_email - First observed
read_email - First observed
save_draft - First observed
search_emails - First observed
send_email - First observed
wait_for_new_emails
TDQS
Each tool maps cleanly to a distinct action in the email workflow: read, search, wait, send, draft, mark, move, delete, download, list folders, and check connection. Even similar operations like move_email and delete_email are clearly separated by delete targeting Trash.
All tools use a consistent snake_case verb_noun pattern: read_email, list_folders, send_email, save_draft, etc. Multi-word verbs like wait_for_new_emails follow the same clear convention without mixing styles.
The 11 tools are well-scoped for an email server covering sending, receiving, searching, drafts, attachments, folders, and account health. Each tool has a clear purpose and none feel redundant.
Core email workflows are well covered: read, search, send, draft, move, delete, mark, and attachment download. Minor gaps exist, such as no explicit attachment support when sending and no folder creation or management, but these are not critical dead ends.
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Connectors
Email infrastructure for AI agents — send, receive, search, and reply to email over MCP.
Read, search, send, organize, draft and schedule email across your inboxes from any MCP client.
Email inboxes for AI agents: send, receive, reply, search, and manage threaded email over MCP.
Manage Gmail end-to-end: search, read, send, draft, label, and organize threads. Automate workflow…
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceEnables email management through IMAP and SMTP protocols, supporting reading, sending, replying to emails with proper threading, and downloading attachments. Supports multiple email accounts with flexible configuration options.1BSD 3-Clause
- FlicenseNot gradedqualityBmaintenanceEnables email management for a single mailbox via IMAP and SMTP protocols. Supports reading, searching, and sending emails with threading support through stdio or HTTP transports.-
- FlicenseNot gradedqualityDmaintenanceEnables email management via IMAP/SMTP, supporting list emails, read emails, send emails, and save drafts.-
- AlicenseNot gradedqualityDmaintenanceEnables AI agents to interact with email accounts via IMAP and SMTP, supporting mailbox listing, email search, retrieval, sending, and management.MIT
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/concurrent2024/mcp-email-server'
If you have feedback or need assistance with the MCP directory API, please join our Discord server