Courier 邮件日历联系人任务 MCP 服务器

Courier 是一款通过 JMAP 和 CalDAV 协议将 AI 助手连接到邮箱、联系人、日历和任务的 MCP 服务器,提供邮件收发、联系人管理、日程与待办管理能力,适用于在 Claude、ChatGPT 等 AI 客户端中直接处理个人和团队邮件与日程。

  • by anandman
  • TypeScript
  • 混合部署
  • 更新于
在 GitHub 查看 anandman/fastmail-courier

使用说明

Courier

An MCP server that connects AI assistants to your email, contacts, calendar, and tasks — over JMAP for mail and contacts, CalDAV for calendar and tasks. Tested against Fastmail; works with any JMAP provider.

Quick Install

npm install -g @anandman/courier

That provides courier (the CLI, and courier mcp to run the server) and courier-mcp (the server directly, for a client config that spawns it).

From source:

git clone https://github.com/anandman/courier.git
cd courier
npm install
npm run build

Quick Setup

  1. Get API token: Fastmail → Settings → Privacy & Security → Integrations → API tokens
  2. Set environment:
    export COURIER_API_TOKEN="fmu1-your-token"
    export COURIER_EMAIL="you@fastmail.com"
    
  3. Add to a client. Claude Code:
    claude mcp add email-courier -- node /path/to/email-courier/dist/index.js
    
    Claude Desktop (claude_desktop_config.json) and Codex (~/.codex/config.toml) take the same command and path in their own formats — see Getting Started.

Command Line

courier is also a client. It authorizes against a running Courier over OAuth, so a script or another agent can use the tools without a copy of your mail credentials:

courier auth login --server https://your-courier.example/mcp
courier search-emails --query invoice --limit 20
courier draft-reply --email-id StnZCocGyMEV --body "Sounds good." --yes

Results are JSON on stdout; a non-zero exit prints nothing there, so a failure can never be mistaken for an empty answer. See CLI.

Remote Hosting (Optional)

Courier defaults to local stdio transport. To host it remotely over Streamable HTTP:

export MCP_TRANSPORT="http"
export MCP_HTTP_HOST="0.0.0.0"
export MCP_HTTP_PORT="3333"
export MCP_HTTP_PATH="/mcp"
node dist/index.js

For multi-user remote hosting, enable OIDC and the encrypted vault:

export MCP_AUTH_MODE="oidc"
export MCP_PUBLIC_URL="https://courier.example.com"
export MCP_OIDC_ISSUER_URL="https://accounts.google.com"
export MCP_OIDC_CLIENT_ID="your-client-id"
export MCP_OIDC_CLIENT_SECRET="your-client-secret"
export MCP_ALLOWED_USERS="you@example.com,partner@example.com"
export MCP_TOKEN_SECRET="$(openssl rand -hex 32)"
export COURIER_VAULT_KEY="base64-or-hex-32-byte-key"

In this mode Courier is its own OAuth authorization server: MCP clients register with Courier and it issues its own tokens, while your identity provider only signs users in. Clients need no configuration — any client speaking MCP OAuth registers itself. Register both ${MCP_PUBLIC_URL}/auth/callback and ${MCP_PUBLIC_URL}/auth/mcp/callback as redirect URIs with your provider.

Open /ui on your server to add Fastmail credentials per user.

To connect, give any client the server URL — https://courier.example.com/mcp — and nothing else. In claude.ai, Claude Desktop and ChatGPT that's Settings → Connectors → add a custom connector; in Claude Code it's claude mcp add --transport http; in Codex it's a url entry in ~/.codex/config.toml. Each opens a browser once to sign in. See Getting Started.

See Configuration for full auth and vault options.

For calendar/tasks, you'll also need an app password. See Getting Started.

Tools

Category Tools
Accounts list_accounts, switch_account, get_current_account
Email list_mailboxes, get_mailbox_details, create_mailbox, rename_mailbox, delete_mailbox, move_mailbox, set_mailbox_role, search_emails, get_email, send_email, forward_email
Organize move_emails, delete_emails, mark_emails, tag_emails
Contacts list_address_books, search_contacts, get_contact, create_contact, update_contact, delete_contact
Calendar list_calendars, list_events, get_event, create_event, update_event, delete_event
Tasks list_tasks, get_task, create_task, update_task, complete_task, delete_task

All email, mailbox, contact, calendar, and task tools accept an optional account display name or email. Use it to target a non-default account for one stateless HTTP call without changing the persisted default.

Documentation

Security

  • Store tokens securely (environment variables or chmod 600 config)
  • Never commit credentials to git
  • Use app passwords for CalDAV (not your main password)

License

MIT - see LICENSE for details.