MailBridge_mcp
Provides tools to bind a Gmail account and interact with its mailbox, including listing messages, reading message content, downloading attachments, and exporting full messages.
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., "@MailBridge_mcpshow my latest emails from outlook-main"
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.
统一邮件与附件读取工具
独立运行的 Python 工具,提供命令行与本地 stdio MCP 接口。支持多账号绑定、分页列收件箱、读取正文、下载附件和整封邮件导出。
验证状态
邮箱 | 适配器实现 | 模拟测试 | 真实邮箱验证 |
Outlook 个人邮箱 | 已完成 | 已通过 | 已通过:正文、附件和文件一致性 |
Gmail | 已完成 | 已通过 | 未完成:缺少 Google OAuth 客户端配置及用户授权 |
已完成 | 已通过 | 未完成:缺少用户 IMAP 授权 | |
其他 IMAP | 通用适配已实现 | 已通过 | 未逐厂商验证 |
模拟测试不代表真实服务接入已验证。当前是本机单用户工具,不是公开部署的多租户服务。
Related MCP server: mcp-email-server
快速开始
uv sync --locked
uv run python -m mail_tool accounts
uv run python -m mail_tool list --account outlook-main --limit 5
uv run python -m mail_tool get --account outlook-main --message '邮件ID'
uv run python -m mail_tool export --account outlook-main --message '邮件ID'本机已有账号 outlook-main 可直接使用。新邮箱先绑定:
uv run python -m mail_tool bind outlook --account outlook-main --client-id '微软应用ClientID'
uv run python -m mail_tool bind gmail --account gmail-main --credentials .state/google-client.json
uv run python -m mail_tool bind qq --account qq-main --email '你的邮箱@qq.com'Gmail 使用 Desktop OAuth JSON 和浏览器授权;QQ 在终端隐藏输入客户端授权码。不要将凭据写入聊天或提交到 Git。
config.example.json 仍可复制为 config.json 保存 Microsoft Client ID。原授权缓存和历史下载文件保留,旧代码已迁入 mail_tool;不再使用旧模块入口。
MCP 和测试
uv run python -m mail_tool serve
uv run python -m unittest discover -vMCP 提供 mail_list_accounts、mail_list_messages、mail_get_message、mail_download_attachment、mail_export_message。
完整绑定步骤、MCP客户端配置、Provider扩展方法和当前边界见 邮件工具使用说明。
代码结构
mail_tool/outlook_auth.py:微软授权与令牌缓存。
mail_tool/providers.py:Provider协议和三类邮箱适配器。
mail_tool/common.py:MIME解析、文件名处理、游标及文件保存。
mail_tool/service.py:统一账号、邮件和附件服务。
mail_tool/main.py:命令行入口。
mail_tool/mcp_server.py:MCP接口。
下一步分别绑定 Gmail、QQ,用含正文和附件的测试邮件执行 list → get → export,核对正文和原附件哈希。验证前不将两家标记为已接通。
Available Tools
5 toolsmail_download_attachmentA
下载原始附件到服务所在机器的受控目录,返回路径、大小、SHA256。不解析PDF/Word、不执行附件。
| Name | Required | Description | Default |
|---|---|---|---|
| account_id | Yes | ||
| message_id | Yes | ||
| attachment_id | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations provided, the description carries the full burden and does meaningful work: it discloses the download destination (controlled directory), the returned metadata, and explicitly states that attachments are not parsed or executed. It does not cover authentication requirements, size limits, or failure modes, but the core safety and storage behavior is transparent.
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 compact sentences with no filler. It front-loads the action and output, then adds the important safety caveats. Every clause 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 simple three-parameter download tool with no output schema and no annotations, the description covers the key contract: what is downloaded, where it goes, what is returned, and what is not done. It is slightly incomplete regarding error behavior and how to obtain the required IDs, but these are minor gaps for this tool.
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 schema has 0% description coverage and the description provides no additional meaning for account_id, message_id, or attachment_id. The agent must rely on parameter names alone; the description does not compensate for the missing 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 clearly states a specific action (download raw attachment) and resource (attachment on server), plus the output contract (path, size, SHA256). It distinguishes itself from siblings like mail_get_message and mail_export_message by emphasizing raw download and non-parsing/non-execution behavior.
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, nor does it mention exclusions. The safety-related notes (no parsing/execution) imply a use case, but the tool never routes the agent to siblings like mail_export_message or mail_get_message for other scenarios.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
mail_export_messageA
将完整正文、元数据及非内嵌附件保存到本机;逐附件返回失败,complete 表示是否完整。
| Name | Required | Description | Default |
|---|---|---|---|
| account_id | Yes | ||
| message_id | Yes | ||
| include_attachments | No |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations, the description carries the full burden. It discloses the local persistence behavior, the scope of exported content, per-attachment failure reporting, and the complete flag semantics. It does not mention authentication or side effects, but the core behavioral traits are clearly communicated.
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 one dense sentence, front-loading the action and resource, then using a semicolon to add result semantics. Every word contributes meaning; there is no filler or redundant restatement.
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 core operation and result semantics are covered, but there is no output schema and the description omits parameter-level details and behavior when include_attachments is false. It is adequate for a simple tool but leaves meaningful gaps for an agent deciding exactly how to invoke it.
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 0%, and the description does not explain account_id, message_id, or include_attachments. While the names are somewhat self-explanatory, the include_attachments flag's relationship to 'non-inline attachments' is not clarified, and the description does not compensate for the missing schema 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 states a specific verb '保存' (save), a clear resource (full body, metadata, non-inline attachments), and a clear target (本机/local machine). This distinguishes it from sibling tools like mail_get_message or mail_download_attachment, which read or download rather than export a complete message locally.
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 save-to-local-machine behavior implies when to use it: when a complete message export is needed rather than just listing, reading, or downloading a single attachment. However, it does not explicitly mention alternatives or state when NOT to use it, leaving the routing decision mostly to inference.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
mail_get_messageA
获取邮件文本/HTML正文及附件ID。超长正文带 truncated 标记;需要完整落盘可调用 export。
| Name | Required | Description | Default |
|---|---|---|---|
| account_id | Yes | ||
| message_id | Yes | ||
| max_body_chars | No |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
There are no annotations, so the description carries the behavioral burden. It discloses that overly long bodies come with a truncated marker, which is useful. However, it does not describe error behavior, authentication expectations, or whether both text and HTML bodies are always returned, so coverage is adequate but not rich.
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 concise sentences with no filler. The primary return content is stated first, followed by truncation behavior and the export alternative. Every sentence adds value.
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 retrieval tool with no output schema and no annotations, the description covers the main return values, truncation behavior, and the relevant alternative for full export. It is slightly thin on how attachment IDs relate to mail_download_attachment, but the core calling context is present.
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 0%, and the description does not explain account_id, message_id, or max_body_chars. The parameter names are somewhat self-explanatory and the truncated marker hints at max_body_chars, but the description does not compensate for the complete lack of schema-level 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 clearly states the specific action: getting email text/HTML body and attachment IDs. It also differentiates from the sibling export tool by noting that full persistence is handled via export, so an agent can distinguish this from mail_export_message and mail_download_attachment.
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 a clear usage condition: if the full body needs to be saved to disk, call export instead. It does not explicitly mention when to use mail_download_attachment for attachment bytes, but the main routing decision between retrieval and export is well covered.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
mail_list_accountsA
列出本地已配置邮箱及 account_id;configured 不代表授权实时有效。
| Name | Required | Description | Default |
|---|---|---|---|
No parameters | |||
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations provided, the description carries the burden of behavioral transparency. The caveat about configured accounts not guaranteeing valid authorization is useful and non-obvious. Still, it does not mention read-only behavior, failure modes, or other side effects, though a listing action is inherently low-risk.
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, compact sentence with no filler. The caveat about authorization is valuable and earns its place, and the main purpose is front-loaded before the caveat.
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 zero-parameter listing tool, the description is largely complete: it states what is listed and adds an important semantic caveat about authorization. It does not spell out the exact return format, but the absence of an output schema lowers the burden, and the tool's simple nature makes this gap minor.
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 coverage is complete, so there is little for the description to add. It appropriately names the primary output concepts (mailboxes and account_id), satisfying the baseline for a parameterless tool.
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 ('列出' / list) and a clear resource ('本地已配置邮箱及 account_id'), stating exactly what the tool returns. Its scope of local configured accounts distinguishes it from sibling tools that operate on messages rather than account enumeration.
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 important context with the caveat that 'configured' does not imply currently valid authorization, which helps an agent interpret results. However, it does not explicitly state when to prefer this tool over alternatives or provide any exclusion criteria.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
mail_list_messagesA
分页列出指定邮箱收件箱邮件摘要;limit 1-50,使用返回的 next_cursor 继续。无全文搜索。
| Name | Required | Description | Default |
|---|---|---|---|
| limit | No | ||
| cursor | No | ||
| account_id | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations provided, the description carries the behavioral disclosure burden. It clearly discloses pagination behavior, the limit range (1-50), the use of next_cursor to continue, that it returns summaries only, and that it does not support full-text search. It does not mention auth, rate limits, or ordering, but these are less critical for a simple read listing.
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 compact sentences deliver the core action, parameter constraints, pagination rule, and a key limitation with no filler. The main purpose is front-loaded and every phrase 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 three simple parameters, no output schema, and no annotations, the description covers the main invocation details: target account, list scope, pagination, and non-search behavior. It could mention how to obtain account_id or what summary fields are returned, but the existing description is sufficient for an agent to call the tool correctly in common cases.
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 0%, so the description must compensate. It does: '指定邮箱' maps to account_id, 'limit 1-50' defines the limit parameter, and '使用返回的 next_cursor 继续' explains the cursor parameter. It omits the default limit of 10, but overall adds significant meaning beyond the bare 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?
The description states a specific verb ('列出') and resource ('指定邮箱收件箱邮件摘要'), and adds pagination context. It is clearly distinct from sibling tools like mail_get_message, mail_download_attachment, and mail_export_message, since it lists summaries rather than retrieving, downloading, or exporting messages.
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 usage context is implied: use this to page through inbox message summaries. It explicitly notes the lack of full-text search, which helps rule out search requests, but it does not explicitly point to alternatives such as mail_get_message for full message content or mail_list_accounts for resolving account IDs.
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.
5 tool updates
v0.1.0- First observed
mail_download_attachment - First observed
mail_export_message - First observed
mail_get_message - First observed
mail_list_accounts - First observed
mail_list_messages
TDQS
Scored across 5 tools
Each tool targets a distinct operation: list accounts, list messages, read one message, download one attachment, or persist a full message. get_message and export_message are related but clearly separated by in-memory reading vs disk export.
All tool names use the consistent mail_<verb>_<noun> snake_case pattern with clear verbs: list, get, download, export. The convention is uniform and predictable.
Five tools form a compact, focused set for an email bridging/export server. Each tool addresses a necessary step in the retrieval workflow without redundancy.
The read/export lifecycle is well covered: accounts, message listing, body retrieval, attachment download, and full export. Send, search, folder navigation, and authentication refresh are absent, but those appear out of scope for this bridge; their absence is a minor gap if broader email management is expected.
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.
Email inboxes for AI agents: send, receive, reply, search, and manage threaded email over MCP.
MCP server for MailTempo's public free temporary email inboxes.
Hosted email MCP for AI agents with inboxes, send/receive, memory, recovery, and credits.
Related MCP Servers
- 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.-
- AlicenseNot gradedqualityDmaintenanceEnables reading and sending emails via IMAP and SMTP through the MCP protocol. Supports multiple email accounts and configuration via UI or environment variables.BSD 3-Clause
- AlicenseBqualityBmaintenanceEnables users to manage email accounts via IMAP/SMTP, including reading, searching, sending emails with attachments and calendar invites, all through natural language interactions with MCP-compatible clients.14MIT
- AlicenseNot gradedqualityAmaintenanceExposes any IMAP mailbox and SMTP relay as MCP tools, enabling email management (read, search, send, delete) through MCP-compatible agents.MIT