mcp-mail

io.github.Annseraf由 GitHub 账号 Annseraf 发布v1.1.0更新于 Nov 7, 2026

Self-hosted IMAP/SMTP email for any MCP client, with per-client permissions and audit log.

已验证STDIO仅桌面效率与工作流沟通与协作

概览

AI 生成的概览

自托管的 IMAP/SMTP 邮件 MCP 服务器,让 MCP 客户端读取、搜索、起草和发送你现有邮箱的邮件,并支持按客户端设置权限。

可以做什么
  • 列出已连接的邮箱、文件夹和最新邮件及摘要
  • 按发件人、主题、正文、日期、已读或星标状态搜索单个、多个或全部文件夹
  • 读取单封邮件的头信息、正文、附件列表和会话 ID,下载附件,读取完整会话
  • 保存带附件和回复内容的草稿,发送带附件和签名的邮件
  • 标记已读或未读、加星标、标记已回复、移动到其他文件夹,或删除到废件箱
  • 读取日历、查找空闲时间并创建日程;修改发件人显示名和签名
适用场景
适合希望让 AI 客户端直接操作自己已有邮箱、而不依赖托管邮件服务的场景,也适合需要为不同客户端分别限定权限的情况,例如给某个助手只读权限、给另一个开放发送权限。
运行要求
以本地进程通过 stdio 运行(npm 包,可用 npx),也可自托管为 HTTP 端点。需要一个 IMAP/SMTP 邮箱;Gmail、iCloud、Yahoo、Fastmail 等需使用应用专用密码。邮箱凭据保存在 accounts.json,路径由 ACCOUNTS_FILE 指定。STDIO_PRESET 变量用于选择权限预设。
安装前请注意
它会把邮箱密码保存在 accounts.json 中,可选择加密存储。具备发送或删除权限的代理可以发信并永久删除邮件,应限制预设、收件人白名单和发送频率。邮件内容属于不可信输入,可能诱导助手执行操作。README 中的一行安装命令会把远程脚本以 sudo 执行。

安装

在 SourceWeft 中

  1. 打开 控制台中的 mcp-mail,将其添加到工作区。
  2. 为需要使用其工具的对话启用该服务。

Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。

其他 MCP 客户端

参照 仓库 中的启动说明。

README

mcp-mail

mcp-mail is a self-hosted IMAP/SMTP email MCP server that lets Claude, ChatGPT, Cursor and any other MCP client read, search, draft and send email from your existing mailbox, with per-client permissions, an audit log and a one-line install.

sh
curl -fsSL https://raw.githubusercontent.com/Annseraf/mcp-mail/main/install.sh | sudo bash -s -- --auto-update

Local clients (Claude Desktop, Claude Code, Cursor, VS Code) can run it directly: npx -y @annseraf/mcp-mail stdio.

mcp-mail is a maintained continuation of claude-mail-mcp by Markus Stöger (MIT). Existing claude-mail-mcp v0.2 installs can switch with no config changes (compatibility contract).

Works with

  • AI clients: Claude.ai, Claude Desktop, Claude Code, ChatGPT (developer mode, deep research), Cursor, VS Code, Meta Muse, and any MCP client over Streamable HTTP or stdio. Setup guides: docs/clients.
  • Mail providers: any IMAP/SMTP mailbox: Fastmail, iCloud, Purelymail, Gmail and Google Workspace (app password), Yahoo, Zoho, Mailbox.org, Migadu, Mailcow, Dovecot/Postfix.
  • Calendars: any CalDAV server (Fastmail, iCloud, Nextcloud, Radicale), optional.
  • MCP protocol: 2026-07-28 (stateless) and every earlier revision since 2024-11-05, on the same endpoint.

Tools

ToolWhat it doesCapability
list_accountsList connected mailboxes, sender names and signatures (never credentials)read
list_foldersList folders with their special use (Inbox, Sent, Drafts, Trash)read
list_messagesNewest messages in a folder, with short previewsread
search_messagesSearch one folder, several, or all ("*") by sender, subject, body, date, read or flaggedread
get_messageRead one message: headers, body, attachment list, threading idsread
get_attachmentDownload one attachment (size-capped)read
get_threadRead a whole conversation across Inbox and Sent, oldest firstread
list_threadsGroup a folder's newest messages into conversationsread
create_draftSave a draft (with attachments); reply_to_uid fills in the reply for youdraft
mark_readMark a message read or unreadorganize
set_flagsStar (flag), mark answered, or add custom keywordsorganize
move_messageMove a message to another folderorganize
delete_messageMove to Trash; permanent: true deletes for goodorganize / destructive
send_messageSend an email (with attachments and signature); a copy goes to Sentsend
update_account_settingsChange the sender display name and signaturesettings
list_calendars, list_events, find_free_slotRead calendars and find free timecalendar-read
create_eventCreate a calendar eventcalendar-write
search, fetchChatGPT deep research adapters (CHATGPT_COMPAT=true)read

Comparison

mcp-mailclaude-mail-mcp v0.2
TransportStreamable HTTP (2026-07-28 + legacy) and stdioStreamable HTTP
AuthBuilt-in OAuth 2.1 (DCR, PKCE), per-client tokens, shared tokenShared token + separate OAuth shim
Per-client permissionsPresets, tool allow/deny, mailbox scope, recipient allowlist, send rate limit—
Read-only moderead-only preset (or STDIO_PRESET=read-only)—
Revoke one clientYes, others keep workingRotate the shared secret
AttachmentsSend, draft and downloadSend only
Threads, flags, multi-folder searchYes—
Audit logJSONL, no message content—
Prompt-injection hygieneUntrusted-content fencing, hidden-HTML stripping, server instructions—
Multi-tenant + admin APIOpt-in, with OpenAPI spec—
Install and updatesOne-line installer, signed releases, auto-update with rollbackManual

Other IMAP MCP servers worth a look, depending on your needs: codefuturist/email-mcp (TypeScript, IMAP/SMTP, many tools), tecnologicachile/mail-mcp (Rust, IMAP/SMTP plus Microsoft Graph and EWS) and wildsurfer/your-mail-mcp (read-only, local notmuch index). Check their READMEs for current features.

FAQ

How do I give ChatGPT read-only access to my email?

Run mcp-mail clients add chatgpt --for chatgpt (OAuth login, read-only preset), enable OAUTH=true, and add the server in ChatGPT's developer mode. ChatGPT only ever sees the read tools. See docs/clients/chatgpt.md.

Can I use this with Fastmail, iCloud, Purelymail or Gmail?

Yes. Anything that speaks IMAP and SMTP works. For Gmail, iCloud, Yahoo and Fastmail, create an app password in the provider's security settings and use it instead of your normal password.

How do I stop an AI agent from sending email?

Give the agent a preset without send (read-only, read-draft or organize). The send tool then disappears from its tool list and is rejected if called anyway. For agents that may send, restrict recipients with sendRecipientAllowlist and cap volume with sendRateLimit. See docs/CLIENTS.md.

Can an email trick the AI into doing something?

Emails are untrusted input. mcp-mail wraps every body in untrusted-content delimiters, strips hidden HTML text and tracking pixels, and tells clients to confirm sends and deletions with you. Keep sending off for agents that don't need it. See SECURITY.md.

Does deleting a message lose it forever?

No. delete_message moves the message to Trash. Permanent deletion needs permanent: true and a client with the destructive capability.

Where are my passwords stored?

In accounts.json on your server (optionally encrypted at rest with mcp-mail secrets encrypt). In multi-tenant mode, credentials are envelope-encrypted per tenant with a local key file or OCI Vault. They are never returned by any tool, API or log.

Can my agent sign emails?

Yes. Each account can have a sender display name and a signature, set in accounts.json or by the agent itself with update_account_settings. Pass include_signature: false to send without it.

I'm on claude-mail-mcp. Do I need to change anything?

No. Swap the binary; your .env, accounts.json and connected clients keep working. CI enforces this against recorded v0.2.1 behavior.

Security model

  • Binds to 127.0.0.1 by default; put nginx or Caddy in front for TLS.
  • Clients authenticate with OAuth 2.1 (PKCE, rotating refresh tokens), per-client static tokens (stored hashed), or the legacy shared token.
  • Every tool call is checked against the client's policy twice: when listing tools and when calling them.
  • The audit log records who did what, never message content.
  • Mail content is fenced as untrusted; sends and deletions should be confirmed by a human.
  • Releases are built by CI from tagged commits only, with checksums and provenance attestation.

Details: SECURITY.md, docs/CLIENTS.md, docs/PLATFORM.md.

Configuration

  • .env: transport settings (.env.example). Everything new is optional.
  • accounts.json: mailboxes (same format as claude-mail-mcp; optional fromName/signature).
  • clients.json: per-client identities and policies (docs/CLIENTS.md).
  • Multi-tenant mode and the admin API: docs/PLATFORM.md.

Upgrading

From claude-mail-mcp v0.2.x: no config changes required. Install mcp-mail pointing at the same .env, accounts.json and (if you use one) OAuth state. New features stay off until you enable them. Two approved behavior changes are listed in docs/COMPATIBILITY.md: deleting moves to Trash, and email content is fenced as untrusted (UNTRUSTED_FENCING=false restores the old output).

Development

sh
npm cinpm run check        # lint, format, typecheck, unit tests, license scan, buildnpm run test:compat  # compatibility gate + integration suites (needs GreenMail, see docs/COMPATIBILITY.md)

Adding a tool: docs/ADDING_A_TOOL.md. Contributions: CONTRIBUTING.md.

License

MIT. Copyright (c) 2026 Markus Stöger and (c) 2026 Mohith K Das and mcp-mail contributors. See LICENSE and NOTICE.

来源:README.md,提交 4e5297e

工具

0
SourceWeft 尚未在沙箱中启动过该软件包,因此其工具未知。

版本历史

2
  1. v1.1.0最新Nov 7, 2026
  2. v1.0.2Nov 3, 2026

评分

已满足适用检查项的 50%

该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。

  • 近 30 天内可连通25 分

    请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。

  • 已声明认证方式10 分

    请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。

  • 已列出工具15 分

    请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。

  • 描述必需15 分
  • 图标10 分
  • 文档15 分
  • 许可证10 分