Skip to main content
Glama
darkroomdevs

protonmail-mcp

by darkroomdevs

@darkroomhq/protonmail-mcp

MCP 服务器,允许 AI 助手通过 Proton Bridge 完全访问您的 ProtonMail 账户。通过任何兼容 MCP 的客户端读取、发送、搜索和管理电子邮件。

要求

Related MCP server: Proton Mail MCP Server

安装

npm install -g @darkroomhq/protonmail-mcp

或者直接使用,无需安装:

npx @darkroomhq/protonmail-mcp

配置

添加到您的 MCP 客户端配置中(例如 claude_desktop_config.json):

{
  "mcpServers": {
    "protonmail": {
      "command": "protonmail-mcp",
      "env": {
        "PROTONMAIL_USERNAME": "your@protonmail.com",
        "PROTONMAIL_PASSWORD": "bridge-app-password"
      }
    }
  }
}

使用 npx(无需全局安装):

{
  "mcpServers": {
    "protonmail": {
      "command": "npx",
      "args": ["-y", "@darkroomhq/protonmail-mcp"],
      "env": {
        "PROTONMAIL_USERNAME": "your@protonmail.com",
        "PROTONMAIL_PASSWORD": "bridge-app-password"
      }
    }
  }
}

注意: PROTONMAIL_PASSWORD 是 Proton Bridge 中显示的 Bridge 应用密码,而非您的 ProtonMail 账户密码。

所有环境变量

变量

必需

默认值

描述

PROTONMAIL_USERNAME

是

—

您的 ProtonMail 电子邮件地址

PROTONMAIL_PASSWORD

是

—

Proton Bridge 应用密码

SMTP_HOST

否

127.0.0.1

Bridge SMTP 主机

SMTP_PORT

否

1025

Bridge SMTP 端口

IMAP_HOST

否

127.0.0.1

Bridge IMAP 主机

IMAP_PORT

否

1143

Bridge IMAP 端口

DEBUG

否

false

启用调试日志

工具

工具

描述

sendEmail

发送电子邮件,支持可选的抄送 (CC)、密送 (BCC)、HTML 正文、附件和优先级

replyEmail

通过 UID 回复现有邮件

listFolders

列出所有邮箱和文件夹

listEmails

分页列出邮件(基于页码或通过 beforeUid 实现的稳定游标)

readEmail

通过 UID 读取邮件(支持 headersOnly 和 maxBodyLength 以提高效率)

searchEmails

按发件人、主题、正文、日期范围、已读/标记状态进行搜索(支持游标分页)

bulkAction

按条件或 UID 批量删除、移动、标记已读/未读、标记/取消标记(默认进行预演)

markRead

将邮件标记为已读

markUnread

将邮件标记为未读

flagEmail

给邮件加星标/标记

unflagEmail

取消邮件的星标/标记

moveEmail

将邮件移动到另一个文件夹

deleteEmail

将邮件移至垃圾箱

createFolder

创建新邮件文件夹

deleteFolder

删除邮件文件夹

renameFolder

重命名邮件文件夹

createLabel

创建新邮件标签

deleteLabel

删除邮件标签

renameLabel

重命名邮件标签

connectionStatus

检查 SMTP 和 IMAP 连接状态

示例提示词

读取与总结

  • “总结我本周的未读邮件。”

  • “读取 alice 发来的最新邮件,并告诉我她想要什么。”

搜索

  • “查找过去 30 天内所有关于第二季度报告的邮件。”

  • “搜索我‘已发送’文件夹中所有已标记的邮件。”

发送与回复

  • “给 bob 发封邮件,告诉他会议改到周四下午 3 点了。”

  • “回复设计团队的上一封邮件,并索要更新后的原型图。”

批量操作

  • “删除收件箱中所有来自 IGN 的邮件。”

  • “将所有未读的新闻通讯标记为已读。”

  • “将所有来自 noreply@github.com 的邮件移动到 GitHub 文件夹。”

  • “我上个月有多少封已标记的邮件?”(使用预演模式)

整理

  • “将收件箱中所有新闻通讯移动到‘新闻通讯’文件夹。”

  • “标记我经理发来的最近三封邮件。”

  • “删除垃圾邮件文件夹中的所有邮件。”

  • “创建一个名为‘收据’的文件夹,并将所有购买确认邮件移动到那里。”

  • “为需要立即处理的邮件创建一个名为‘紧急’的标签。”

  • “将‘旧项目’文件夹重命名为‘归档’。”

状态

  • “检查 Proton Bridge 是否已连接。”

性能提示

  • 游标分页:使用 beforeUid(作为 nextCursor 返回)代替 page,以实现不受请求间新邮件到达影响的稳定分页。

  • 仅限标头:在 readEmail 上使用 headersOnly: true 以跳过下载完整邮件正文——当您只需要元数据时非常有用。

  • 正文截断:在 readEmail 上使用 maxBodyLength 来限制正文大小(例如 2000 字符),避免处理包含大量内容的邮件时产生过大的响应。

  • 批量操作:使用带有搜索 criteria 的 bulkAction,而不是循环处理单个邮件。无论有多少邮件匹配,它都只运行一次 IMAP SEARCH 和一次批量命令。

  • 预演 (Dry run):bulkAction 默认开启 dryRun: true——在执行破坏性操作之前,请先预览受影响的邮件。

开发

npm install
npm run build   # compile TypeScript
npm run dev     # watch mode

Related MCP Connectors

Related MCP Servers

  • A
    license
    A
    quality
    A
    maintenance
    Enables AI agents to send, read, search, and organize emails via ProtonMail using Proton Bridge. Supports MCP-compatible clients like Claude and Cursor.
    18
    202 npm
    4
    MIT
  • A
    license
    Not graded
    quality
    C
    maintenance
    Enables AI assistants to send, read, search, and organize email from Proton Mail accounts via SMTP and IMAP.
    85 npm
    MIT
  • A
    license
    Not graded
    quality
    C
    maintenance
    Enables AI assistants to send, read, search, and organize Proton Mail email via SMTP and IMAP through the Model Context Protocol.
    MIT
  • A
    license
    A
    quality
    A
    maintenance
    Enables AI assistants to read, organize, and send Proton Mail through the local Proton Bridge, with careful gating for sending and attachment access.
    34
    1
    Apache 2.0