mail-mcp-oauth
mail-mcp-oauth
用于 Claude.ai 的自托管、支持 OAuth 2.1 的 IMAP/SMTP MCP 服务器 — 是 maxx3250/clBude-mask 的 fork, 内置 OAuth 2.1 + 动态客户端注册 + PKCE 层,并且适配为在 Runder 上以单个无状态进程运行(无需 VP S,无需 nginx,无需系统 D,无需持久化存储)。
多账户:一次部署即可服务多个邮箱(Gmail、自定义域名、...),每个都可通过 IMAP/SMTP 访问。每个 MCP 工具都接受一个可选的 account 参数,用来选择要操作的邮箱。
相比上游有什么改动
内置 OAuth 2.1(src/oAuth.ts):
/register(动态注册)、/authorize(PLE+ 单用户登录表单)、/token。不再需要单独的 OAuth 桥接进程——上游提到过这样一个进程,但它未发布,因此本项目在同一个 Express 应用中直接实现。设计为无状态:access/refresh 令牌是有签名的 JWT(不需要数据库);已注册的 OAuth 客户端和进行中的授权:(usually auth code)都在内存中(重启后 Claude.ai 会静默地重新注册,其 MCP 客户端已能自动处理该过程)。
账户通过环境变量提供*:使用
ACCOUNTS\_JSON而不是磁盘上的文件,因为 Render 的文件系统是临时的。基于文件的ACCOUNTS\_FILE在本地/VPS 使用场境下仍然可用。移除 CalDAV/日历工具——此部署不需要它们,同时缩小了依赖面(
tsdav、ical.js)。
Related MCP server: IMAP MCP Server
架构
Claude.ai (web)
│ HTTPS + OAuth 2.1 (DCR, PKCE, JWT)
▼
Render (TLS terminated automatically, custom domain mcp-mail.<domain>)
▼
this process (single Node service)
├── /.well-known/oauth-authorization-server, /register, /authorize, /token (src/oauth.ts)
├── /mcp (Bearer-gated MCP Streamable HTTP transport)
│ ├── ImapClient ──▶ imapflow ──▶ IMAP server (993/143) per account
│ └── SmtpClient ──▶ nodemailer ──▶ SMTP server (465/587) per account
└── /health本地设置
npm install
cp .env.example .env
# fill in PUBLIC_URL, ACCOUNTS_JSON (see docs/ACCOUNTS.md), OAUTH_USER,
# OAUTH_PASS, and JWT_SECRET (openssl rand -hex 32)
npm run dev部署到 Render
完整的步骤请见 docs/DEPLOY_RENDER.md(CHub ** 推送、Render Web 服务、自定义域名、Netcup DNS、连 接 Claude.a.
AccountsV
accounts.json 的 schema 及各提供商设置(Gmail 应用密码、Netcup Webhosting 的 IMAP/SMTP,以及为什么 Hotmail/Outlook.com 需要单独的 OAuth2 流程)请参阅 docs/Accounts.md。
向 Claude 暴露的工具
Tool | Purpose |
| 列出已配置的邮箱(id、label、default、From)——绝不包含凭据 |
| 枚举 IMAP 邮箱(folder) |
| 某个文件夹中最新的 N 封邮件 |
| 服务端 IMAP 搜索 |
| 完整正文 + 邮件头 + 附件元数据 |
| 通过 SMTP 发送(可选地连同放入 Sent 文件夹) |
| 构建 RFC-822 邮件并 APPEND 到 Drafts |
| 切换 |
| 在文件夹之间移动邮件 |
| 删除(破坏性操作——建议改为移动到 Trash) |
许可证
MIT — 请参阅 LICENSE。原作者 Markus字典信息:Stöger (maxx3250/claude-mail-mcp)。
This server cannot be installed
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 Servers
- AlicenseAqualityDmaintenanceEnables seamless email management through natural language conversations with Claude. Supports searching, reading, and sending emails securely with Gmail and other email providers.4MIT
- AlicenseAqualityAmaintenanceEnables Claude to interact with email accounts via IMAP and SMTP, providing tools for searching, reading, sending, and managing emails across multiple providers.4041776MIT
- AlicenseNot gradedqualityCmaintenanceEnables Claude to read, search, send, label, and trash emails in any Gmail account via Google's Gmail API, using OAuth2 authentication with automatic token refresh.67MIT
- AlicenseNot gradedqualityDmaintenanceEnables searching, reading, moving, tagging, and linking emails in MailMate via MCP tools, allowing Claude to manage email without leaving the conversation.3GPL 3.0
Related MCP Connectors
Read, search, send, organize, draft and schedule email across your inboxes from any MCP client.
Manage Gmail end-to-end: search, read, send, draft, label, and organize threads. Automate workflow…
Hosted email MCP for AI agents with inboxes, send/receive, memory, recovery, and credits.
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/00thies-blip/mail-mcp-oauth'
If you have feedback or need assistance with the MCP directory API, please join our Discord server