Skip to main content
Glama
darwinz

WorkMail MCP Server

by darwinz

WorkMail MCP 服务器

一个模型上下文协议 (MCP) 服务器,将 Claude Desktop 连接到 Amazon WorkMail,通过安全的本地 stdio 传输提供电子邮件和日历访问权限。

功能

工具

描述

list_emails

列出任何文件夹中的电子邮件(支持分页)

read_email

按 ID 读取完整的电子邮件内容

search_emails

使用 AQS 查询语法搜索电子邮件

send_email

发送电子邮件(需要明确确认)

list_calendar_events

列出指定日期范围内的日历事件

get_calendar_event

按 ID 获取完整的事件详情

create_calendar_event

创建日历事件(需要明确确认)

Related MCP server: Gmail & Calendar Multi-Account MCP Server

安全性

  • 凭据存储在 macOS 钥匙串中(在 Apple Silicon 上进行硬件加密)——绝不存储在配置文件或环境变量中

  • 传输使用 stdio(本地管道)——没有 HTTP 服务器,没有开放端口

  • 线路加密通过 HTTPS/TLS 连接到 WorkMail EWS 端点

  • 输入验证通过 Zod 模式对每个工具调用进行验证

  • 输出清理从所有响应和错误消息中屏蔽凭据值

  • 速率限制防止失控的请求循环(可配置,默认为 30 次/分钟)

  • 写入保护——send_email 和 create_calendar_event 需要 confirm: true 参数

先决条件

  • macOS(使用钥匙串进行凭据存储)

  • Node.js 20+

  • 具有用户名/密码身份验证的 Amazon WorkMail 账户

设置

1. 安装依赖

git clone https://github.com/your-username/workmail-mcp-server.git
cd workmail-mcp-server
npm install

2. 配置环境

cp .env.example .env

如果您的 WorkMail 位于不同的区域,请编辑 .env:

WORKMAIL_MCP_EWS_ENDPOINT=https://ews.mail.us-west-2.awsapps.com/EWS/Exchange.asmx

EWS 端点遵循 https://ews.mail.<region>.awsapps.com/EWS/Exchange.asmx 的模式。常见区域:us-east-1、us-west-2、eu-west-1。

3. 存储凭据

npm run setup-credentials

这将提示您输入 WorkMail 电子邮件和密码,将其存储在 macOS 钥匙串中,并验证连接。

4. 构建

npm run build

5. 在 Claude Desktop 中注册

将以下内容添加到您的 Claude Desktop 配置 (~/Library/Application Support/Claude/claude_desktop_config.json) 中:

{
  "mcpServers": {
    "workmail": {
      "command": "node",
      "args": ["/absolute/path/to/workmail-mcp-server/dist/index.js"]
    }
  }
}

重启 Claude Desktop。WorkMail 服务器应显示为已连接。

配置

所有设置均为可选,并具有合理的默认值。请在 .env 中或作为环境变量设置它们:

变量

默认值

描述

WORKMAIL_MCP_EWS_ENDPOINT

https://ews.mail.us-west-2.awsapps.com/EWS/Exchange.asmx

WorkMail EWS 端点 URL

WORKMAIL_MCP_MAX_EMAILS

25

每次请求返回的最大电子邮件数 (1-100)

WORKMAIL_MCP_MAX_CALENDAR_DAYS

30

最大日历日期范围(天数)(1-90)

WORKMAIL_MCP_RATE_LIMIT

30

每分钟最大请求数 (1-60)

WORKMAIL_MCP_LOG_LEVEL

info

日志详细程度:error、warn、info、debug

在 claude_desktop_config.json 中设置的环境变量优先于 .env。

使用方法

连接后,您可以让 Claude Desktop 与您的 WorkMail 进行交互:

  • “列出我最近的电子邮件”

  • “阅读 Sarah 关于第三季度报告的邮件”

  • “在我的收件箱中搜索关于部署的消息”

  • “我这周有哪些会议?”

  • “给 team@example.com 发送一封关于状态更新的邮件”

  • “为明天下午 2 点创建一个与 Alex 的会议”

开发

# Run directly from TypeScript (no build step)
npm run dev

# Rebuild after changes
npm run build

# Re-run credential setup
npm run setup-credentials

日志以 JSON 格式写入 stderr。要在使用 Claude Desktop 运行时查看它们,请检查 Claude Desktop 开发者工具中的 MCP 服务器日志。

架构

Claude Desktop  <──stdio──>  MCP Server (Node.js)
                                  │
                                  ▼
                            EWS Client Layer
                                  │
                                  ▼
                  Amazon WorkMail (Exchange Web Services)

该服务器使用 Exchange2010_SP2 兼容级别的 EWS 协议,这是 Amazon WorkMail 支持的版本。

许可证

MIT

Related MCP Connectors

Related MCP Servers

  • A
    license
    Not graded
    quality
    F
    maintenance
    Integrates mailbox.org email and calendar services with Claude, enabling email search, composition, management, calendar access, and Sieve email filter configuration through a secure, locally-hosted interface.
    5
    MIT
  • A
    license
    Not graded
    quality
    B
    maintenance
    Connects Claude Desktop to a local email client, enabling AI-powered email reading, searching, drafting, and organization while preventing sending or permanent deletion.
    1
    Apache 2.0
  • F
    license
    Not graded
    quality
    D
    maintenance
    A local MCP server that connects multiple Gmail accounts and Google Calendars to Claude Desktop, enabling email and calendar operations via natural language.
    -