Skip to main content
Glama
00thies-blip

mail-mcp-oauth

by 00thies-blip

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.1src/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/日历工具——此部署不需要它们,同时缩小了依赖面(tsdavical.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

list_accounts

列出已配置的邮箱(id、label、default、From)——绝不包含凭据

list_folders

枚举 IMAP 邮箱(folder)

list_messages

某个文件夹中最新的 N 封邮件

search_messages

服务端 IMAP 搜索

get_message

完整正文 + 邮件头 + 附件元数据

send_message

通过 SMTP 发送(可选地连同放入 Sent 文件夹)

create_draft

构建 RFC-822 邮件并 APPEND 到 Drafts

mark_read

切换 \Seen 标记

move_message

在文件夹之间移动邮件

delete_message

删除(破坏性操作——建议改为移动到 Trash)

许可证

MIT — 请参阅 LICENSE。原作者 Markus字典信息:Stöger (maxx3250/claude-mail-mcp)。

A
license - permissive license
Not graded
quality - not tested
B
maintenance

Maintenance

Maintainers
Response time
Release cycle
Releases (12mo)
Commit activity

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

  • A
    license
    A
    quality
    A
    maintenance
    Enables Claude to interact with email accounts via IMAP and SMTP, providing tools for searching, reading, sending, and managing emails across multiple providers.
    40
    417
    76
    MIT
  • A
    license
    Not graded
    quality
    C
    maintenance
    Enables 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.
    67
    MIT
  • A
    license
    Not graded
    quality
    D
    maintenance
    Enables searching, reading, moving, tagging, and linking emails in MailMate via MCP tools, allowing Claude to manage email without leaving the conversation.
    3
    GPL 3.0

View all related MCP servers

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.

View all MCP Connectors

Latest Blog Posts

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