mailroom

mailroom

Enables AI agents to manage project email by listing, describing, and running bounded mailbox operations such as reading messages, searching, and sending drafts.

Category
访问服务器

README

Mailroom

Read and reply to project email from your terminal or an AI agent.

Mailroom receives email through Cloudflare, keeps the original MIME in R2, stores mailbox state in D1, and exposes the same bounded operations through a CLI, TypeScript API, private HTTP API, and three-tool MCP server. There is no web inbox.

npx @iannuttall/mailroom auth login
npx @iannuttall/mailroom messages
npx @iannuttall/mailroom search "sponsorship"

The npm package is not published until the first tagged release. Clone the repository and use node dist/cli.js during development.

What Mailroom does

Cloudflare Email Routing can receive mail for many domains without maintaining a conventional mailbox. Mailroom gives that mail one private home and makes it useful to local agents without handing them an unlimited inbox or a send button.

  • Exact routes by default, with deliberate catch-all support.
  • Raw .eml files and attachments in R2.
  • Threads, messages, drafts, approvals, and delivery history in D1.
  • Hybrid AI Search with D1 full-text fallback.
  • Markdown prompts and structured offers.
  • Human approval before send.
  • A small signed relay for domains on another Cloudflare account.
  • Optional Gmail forwarding and Sent-mail synchronization.

Shape

Cloudflare Email Routing
          |
          v
central Worker --> R2 raw mail + pending recovery job
       |
       +--> verified Gmail destination
       |
       +--> Queue --> D1 messages, routes, drafts, audit trail
                    R2 attachments
                    AI Search compact semantic retrieval
             ^
             |
       five-minute pending-job sweep
       |
       +--> private operations API
                 |
                 +--> mailroom CLI
                 +--> stdio MCP: list, describe, run

For a domain in another Cloudflare account, deploy apps/ingress in that account. It signs inbound MIME to the central Worker and sends outbound mail locally through that account's Email Service binding. It stores no inbox state.

Requirements

  • Node.js 22.19 or newer
  • pnpm 11
  • a paid Cloudflare Workers account
  • Cloudflare Email Routing and Email Service for each sending account
  • D1, R2, Workers AI, and AI Search on the central account

Cloudflare currently requires Workers Paid for Email Sending to arbitrary recipients. Email Routing is available on Free and Paid. Check current Email Service pricing because Email Sending is still a beta service.

Develop

pnpm install
pnpm build
pnpm typecheck
pnpm test
pnpm lint

The repository enforces an 800 non-blank line limit through Biome. Generated Wrangler types are tracked but excluded from linting.

Validate the central migration locally:

pnpm --filter @mailroom/worker exec wrangler d1 migrations apply mailroom --local

Neither Worker configuration contains a real account id, database id, domain, sender, route, or secret. Follow the deployment guide before deploying.

Use Gmail as the human inbox without POP. Mailroom can forward stored inbound mail to a verified Gmail destination, while the included Apps Script returns manual Gmail Sent messages to the correct Mailroom thread.

Documentation

The documentation index gives the complete setup order.

Guide Covers
Deploy Mailroom Cloudflare resources, secrets, Worker deployment, CLI, and first route
Configure Mailroom Bindings, variables, secrets, tokens, and local state
Use Gmail Forwarding, Cloudflare SMTP, Send As, Apps Script, and mobile behavior
Test the installation Storage, search, routing, threading, Gmail, drafts, and failure tests
Move a mail domain Safe MX cutover, monitoring, and rollback
Fix setup failures Worker, routing, SMTP, and Apps Script errors
Use an installation agent Terminal and authenticated-browser handoff rules

CLI

mailroom status
mailroom messages [--status unread]
mailroom read <message-id>
mailroom search <query>
mailroom drafts [--status pending]

mailroom operations list
mailroom operations describe <operation-id>
mailroom operations run <operation-id> --params '<json>'

mailroom mcp config
mailroom mcp serve

Credentials are stored in the macOS Keychain. The local config contains only the Worker URL and profile name. MAILROOM_API_URL and MAILROOM_API_TOKEN are available for non-interactive environments.

MCP

Mailroom exposes three tools:

  • mailroom_list_operations
  • mailroom_describe_operation
  • mailroom_run_operation

Agents discover compact operation ids, inspect one schema and its safety metadata, then run it. Full bodies, threads, attachment metadata, and prompt bodies are opt-in.

Run mailroom mcp config to print a stdio client configuration. The packaged mailroom skill teaches the same workflow.

Safety

Email bodies and attachments are untrusted input. Automation is disabled in the shipped configuration. Classification tests do not store drafts or send mail.

Creating a draft, approving it, and sending it are separate operations. Outbound attempts are recorded before delivery and require an idempotency key. Quoted prices and links are checked against config/offers.yaml.

Secrets belong in Wrangler secrets or the macOS Keychain. Do not put them in Worker variables, configuration, fixtures, logs, issues, or prompts.

See SECURITY.md and PRIVACY.md.

Repository

  • packages/core: schemas, operation registry, client, validation, signing
  • packages/cli: global command and Keychain auth
  • packages/mcp: local stdio MCP wrapper
  • apps/worker: central mailbox Worker
  • apps/ingress: cross-account email relay
  • integrations/gmail-sent-sync: user-owned Apps Script for manual replies
  • migrations: D1 schema
  • prompts: versioned Markdown instructions
  • config: safe automation, offer, and search metadata examples
  • skills/mailroom: compact router skill

The architecture notes explain the v1 boundaries and the v2 note describes where the Cloudflare Agents SDK can fit without duplicating mailbox logic.

Contributing

Read CONTRIBUTING.md. Bugs and proposals belong in GitHub Issues. Report security problems through private vulnerability reporting.

Source code is licensed under Apache-2.0. The Mailroom name and branding are covered separately by TRADEMARKS.md.

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选