航空邮件MCP
MCP服务器 航空邮件 --通过AI助手管理电子邮件、日历、联系人等。
这是一个轻量级的网桥,将AI客户端连接到Airmail的内置MCP服务器。网桥在本地连接到Mac上的Airmail。人工智能工具检索到的数据由您选择的人工智能提供商处理。
需求
- macOS 13+
- 航空邮件 安装时启用了MCP(首选项→ MCP)
- Node.js 18+
安装
已发布的npm包
npx 自动安装并运行已发布的包。用户不需要克隆此存储库或运行 npm install.
codex mcp remove airmail
codex mcp add airmail -- npx -y airmail-mcp在所需版本发布到npm后,将其用于正常安装。
地方发展建设
在发布新的npm版本之前,从本地签出测试更改时使用此选项。
git clone https://github.com/Airmail/airmail-mcp.git
cd airmail-mcp
npm install
npm run build然后将MCP客户端指向已编译的本地网桥。不要在共享文档或配置示例中提交特定于机器的路径;使用您自己的结账路径。
Codex命令行界面/Codex桌面:
codex mcp remove airmail
codex mcp add airmail -- node "$(pwd)/dist/index.js"仅限Claude桌面JSON:
{
"mcpServers": {
"airmail": {
"command": "node",
"args": ["/absolute/path/to/airmail-mcp/dist/index.js"]
}
}
}您还可以在不将其安装到客户端的情况下对本地stdio网桥进行冒烟测试:
printf '%s\n' \
'{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2025-11-05","capabilities":{},"clientInfo":{"name":"Airmail MCP Local Test","version":"1.0"}}}' \
'{"jsonrpc":"2.0","method":"notifications/initialized"}' \
'{"jsonrpc":"2.0","id":2,"method":"tools/call","params":{"name":"list_inbox","arguments":{"limit":3}}}' \
| node dist/index.js更改配置后重新启动MCP客户端。在第一次连接时,Airmail显示授权提示;点击 允许.
重要提示: npx -y airmail-mcp 安装已发布的npm包,而不是本地签出。使用本地 node "$(pwd)/dist/index.js" 命令,直到包发布。
GitHub开发安装
当您希望MCP客户端从GitHub而不是本地签出安装时,请使用此选项。此测试推送GitHub代码,而不是未提交的本地编辑。
codex mcp remove airmail
codex mcp add airmail -- npx -y github:Airmail/airmail-mcp#main替换 main 在测试特定版本时,使用分支名称、标签或提交SHA:
codex mcp add airmail -- npx -y github:Airmail/airmail-mcp#branch-name克劳德桌面(MCPB扩展)
克劳德桌面(手动)
增添 ~/Library/Application Support/Claude/claude_desktop_config.json:
{
"mcpServers": {
"airmail": {
"command": "npx",
"args": ["-y", "airmail-mcp"]
}
}
}首次使用时,Airmail会显示配对提示,并为此网桥发出每个客户端的令牌。默认情况下,该令牌仅保留在当前会话的网桥内存中。
克劳德代码
claude mcp remove airmail && claude mcp add --transport stdio airmail -- npx -y airmail-mcpGemini CLI
gemini mcp remove airmail && gemini mcp add airmail npx -- -y airmail-mcpCodex CLI
codex mcp remove airmail && codex mcp add airmail -- npx -y airmail-mcp光标
增添 .cursor/mcp.json 在您的项目(或全局设置)中:
{
"mcpServers": {
"airmail": {
"command": "npx",
"args": ["-y", "airmail-mcp"]
}
}
}帆板运动
增添 ~/.codeium/windsurf/mcp_config.json:
{
"mcpServers": {
"airmail": {
"command": "npx",
"args": ["-y", "airmail-mcp"]
}
}
}VS代码(GitHub副本)
增添 .vscode/mcp.json 在您的项目中:
{
"servers": {
"airmail": {
"command": "npx",
"args": ["-y", "airmail-mcp"]
}
}
}认证
首次使用时,网桥会要求Airmail将此MCP客户端配对。Airmail显示授权提示,然后返回每个客户端的令牌。默认情况下,网桥仅将该令牌保存在当前进程的内存中。
Airmail MCP不使用全局身份验证令牌。访问权限仅为配对,可以在Airmail的MCP权限选项卡中为每个客户端撤销。
工具(101)
电子邮件(核心)
list_accounts · list_folders · list_messages · get_message · list_inbox · list_starred · list_sent · list_trash · list_spam · search_messages · fetch_message_body · list_attachments · get_attachment · get_unread_counts · search_contacts · get_draft · delete_draft · get_message_thread · list_windows · export_eml
行动
mark_messages · archive_messages · trash_messages · move_messages · copy_messages · snooze_messages · add_to_list · delete_messages · empty_folder · refresh_inbox · enable_disable_account · share_icloud
编排
compose_email · reply_to_message · forward_message · quick_reply · send_email · save_as_draft · list_drafts
文件夹
create_folder · rename_folder · delete_folder
语义搜索
semantic_search · semantic_index_status
简介和分类
analyze_email_history · batch_triage_inbox · get_user_profile · update_user_profile · suggest_folder · get_behavior_stats
日历和提醒
list_calendars · list_events · get_event · create_event · update_event · delete_event · list_reminders · create_reminder · complete_reminder · delete_reminder
联系人
list_contacts_book · get_contact · search_contacts_book · create_contact · update_contact · delete_contact · list_contact_groups
VIP和阻止列表
list_vips · add_vip · remove_vip · list_blocked · add_blocked · remove_blocked
规则
list_rules · get_rule · create_rule · delete_rule · toggle_rule
签名
list_signatures · create_signature · update_signature · delete_signature
智能文件夹
list_smart_folders · create_smart_folder · update_smart_folder · delete_smart_folder
账户设置
get_account_settings · update_account_settings · get_vacation_settings · set_vacation_settings
别名
list_aliases · create_alias · update_alias · delete_alias
偏好
get_preferences · set_preferences
元
manage_capabilities --启用/禁用工具组以减少上下文使用
工具组
工具被组织成功能组,可以在运行时通过以下方式启用或禁用 manage_capabilities。这通过隐藏不需要的工具来减少上下文使用。
| 组 | 工具 | 默认值 |
|---|---|---|
| 邮件 | 阅读、操作、撰写 | 始终打开 |
| 配置文件 | 用户配置文件和行为 | 打开 |
| 文件夹 | 文件夹创建/重命名/删除 | 打开 |
| 语义 | 语义搜索与索引 | 开启 |
| 日历 | 日历和提醒 | 打开 |
| 联系人 | 通讯簿 | 打开 |
| 首选项 | 应用程序首选项读/写 | 打开 |
| 规则 | 电子邮件规则CRUD | 打开 |
| 列表 | VIP和阻止发件人列表 | 打开 |
| 智能文件夹 | 智能文件夹CRUD | 打开 |
| 签名 | 电子邮件签名CRUD | 打开 |
| 别名 | 电子邮件别名CRUD | 打开 |
| 帐户设置 | 每个帐户设置和假期 | 打开 |
要启用所有组,请让AI呼叫 manage_capabilities 和 enable: ["preferences", "rules", "lists", "smartfolders", "signatures", "aliases", "accountsettings"].
深层链接
MCP工具响应包括 airmailmcp:// 直接打开Airmail到相关内容的深度链接。
| 命令 | URL | 描述 |
|---|---|---|
message | airmailmcp://message?mail=...&messageid=... | 在主窗口中选择消息 |
open | airmailmcp://open?mail=...&messageid=... | 在阅读器窗口中打开消息 |
compose | airmailmcp://compose?to=...&subject=... | 带有预填充内容的开放式编辑器 |
reply | airmailmcp://reply?mail=...&messageid=... | 回复消息 |
draft | airmailmcp://draft?mail=...&messageid=... | 作曲家的开放式草稿 |
archive | airmailmcp://archive?mail=...&messageid=... | 将邮件存档 |
delete | airmailmcp://delete?mail=...&messageid=... | 将邮件移至垃圾箱 |
view | airmailmcp://view?mail=...&folder=... | 导航到帐户/文件夹 |
attachment | airmailmcp://attachment?mail=...&messageid=...&index=0 | 打开附件 |
settings | airmailmcp://settings?pref=mcp_server | 打开“首选项”窗格 |
运作原理
AI Client ←stdio→ airmail-mcp (Node.js) ←HTTP→ Airmail.app (localhost:9876)这个包裹是一座薄薄的运输桥。所有工具逻辑都在Airmail的原生Swift MCP服务器内运行。桥:
- 从stdin读取JSON-RPC消息
- 通过HTTP POST将它们转发到Airmail的本地MCP服务器
- 将响应写回stdout
如果Airmail未运行,默认情况下网桥会退出并显示一个明确的错误。集 AIRMAIL_MCP_AUTO_LAUNCH=1 如果你想让网桥自动打开Airmail。
环境变量
| 变量 | 描述 | 默认值 |
|---|---|---|
AIRMAIL_MCP_REMEMBER_CLIENT_TOKEN | 设置为 1 在Keychain服务中持久化网桥的每个客户端令牌 com.airmail.mcp.client. | — |
AIRMAIL_MCP_PORT | MCP服务器端口 | 9876 |
AIRMAIL_MCP_AUTO_LAUNCH | 设置为 1/true 当本地MCP服务器无法访问时启动Airmail | 0 |
发展
git clone https://github.com/Airmail/airmail-mcp.git
cd airmail-mcp
npm install
npm run build来自Airmail源的同步工具
npm run sync-tools # reads Swift source, updates manifest.json构建.mcpb扩展
npx @anthropic-ai/mcpb pack .许可证
麻省理工学院
