Skip to main content

High-fidelity IMAP/SMTP MCP server for iCloud, Gmail, and other mail providers

Project description

owlpost

A high-fidelity IMAP/SMTP MCP server for iCloud, Gmail, and other mail providers. Built because every other email MCP server I tried got tripped up by real-world IMAP quirks (CRLF line endings, RFC822 vs BODY.PEEK[], provider-specific Sent folders, multi-word search values).

owlpost is the one I actually use day-to-day from Claude Code to read, search, follow conversations, and send mail.

Features

  • Multi-account — configure as many mailboxes as you want, switch by name
  • iCloud and Gmail tested end-to-end, with provider-specific quirks handled:
    • iCloud's RFC822 fetch returns empty bodies → uses BODY.PEEK[]
    • iCloud's IMAP APPEND requires CRLF line endings → all outbound mail uses policy.SMTP
    • iCloud's SMTP doesn't auto-save sent mail → owlpost APPENDs to Sent for you
    • Gmail's SMTP does auto-save → owlpost skips the duplicate APPEND
    • Folder names auto-discovered via RFC 6154 SPECIAL-USE (no hardcoding Sent Messages vs [Gmail]/Sent Mail)
  • Conversation following — Gmail's X-GM-THRID extension where available, otherwise a generic Message-ID/References BFS across folders
  • Reliable connections — short-lived per-operation IMAP sessions instead of long-lived ones that drop randomly
  • MIME-aware — parses multipart messages, decodes headers, lists attachments, downloads them to disk
  • Threaded reply/forward — preserves In-Reply-To/References, quotes the original

Tools

Tool What it does
list_accounts List configured mail accounts
list_folders List folders for an account, with detected special-use roles
resolve_folder Resolve a role (sent, trash, drafts, inbox, all, archive) to a folder name
search_messages Structured IMAP search (from/to/cc/subject/body/since/before/unseen/flagged/has_attachment), newest first
read_email Read one message: headers, plaintext/HTML body, attachment list. Truncates by default to fit MCP result limits
save_attachment Download an attachment to disk by part index
get_conversation Return all messages in the same thread (Gmail X-GM-THRID or generic reference walking)
send_email Send mail. Auto-saves to Sent on providers that don't (e.g. iCloud). Supports attachments, threading headers
reply_email Reply (with optional reply-all), preserving threading and quoting
forward_email Forward, re-attaching original attachments by default
mark_read Set/unset \Seen
flag_message Set/unset \Flagged (star)
move_email Move to another folder
delete_email Move to Trash

Install

pip install owlpost
# or with uv:
uv tool install owlpost

Configure

Copy accounts.example.toml to ~/.config/owlpost/accounts.toml and fill in your credentials. Use app-specific passwords, not your real password:

[accounts.icloud]
email = "you@icloud.com"
password = "xxxx-xxxx-xxxx-xxxx"
provider = "icloud"
imap_host = "imap.mail.me.com"
imap_port = 993
smtp_host = "smtp.mail.me.com"
smtp_port = 587
auto_save_sent = true   # iCloud SMTP doesn't auto-save sent

[accounts.gmail]
email = "you@gmail.com"
password = "xxxx xxxx xxxx xxxx"
provider = "gmail"
imap_host = "imap.gmail.com"
imap_port = 993
smtp_host = "smtp.gmail.com"
smtp_port = 587
auto_save_sent = false  # Gmail SMTP auto-saves

You can override the config path with the OWLPOST_CONFIG environment variable.

Use with Claude Code

Add to ~/.claude.json under mcpServers:

{
  "mcpServers": {
    "owlpost": {
      "type": "stdio",
      "command": "owlpost",
      "args": [],
      "env": {}
    }
  }
}

Or, if you installed with uv tool install, the binary will be at ~/.local/bin/owlpost.

Restart Claude Code and the tools will appear under the owlpost namespace.

Use with Claude Desktop

Add to ~/Library/Application Support/Claude/claude_desktop_config.json:

{
  "mcpServers": {
    "owlpost": {
      "command": "owlpost"
    }
  }
}

Use with other MCP clients

owlpost speaks the standard MCP stdio transport — any MCP-compatible client can talk to it by spawning the owlpost binary.

Examples

Once registered, you can ask Claude things like:

  • "Find emails from priya about the kids' school in the last month"
  • "Show me the full thread for the latest mortgage email"
  • "Reply to the most recent message from the landlord saying I'll be in touch tomorrow"
  • "Forward the Manulife policy PDFs to Mom and Dad with Priyanka in CC"
  • "Save the attachment from the Toronto Hydro bill to ~/Downloads"

Provider notes

iCloud

  • Use an app-specific password, not your Apple ID password.
  • iCloud throttles aggressive reconnection. owlpost uses short-lived per-op sessions but doesn't pool — if you get SSLEOFError: EOF, back off for ~30 seconds.
  • Sent folder is Sent Messages, Trash is Deleted Messages. Both are auto-detected.

Gmail

Other providers

Set provider = "generic" and configure imap_host, smtp_host, ports, and smtp_security (starttls for 587 or ssl for 465). Folder roles will still be auto-detected if your provider supports SPECIAL-USE (most modern ones do).

Development

git clone https://github.com/smankoo/owlpost
cd owlpost
uv venv
uv pip install -e .

Run the server directly to verify it starts:

.venv/bin/owlpost
# (waits for MCP stdio input)

License

MIT — see LICENSE.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

owlpost-0.1.0.tar.gz (16.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

owlpost-0.1.0-py3-none-any.whl (20.1 kB view details)

Uploaded Python 3

File details

Details for the file owlpost-0.1.0.tar.gz.

File metadata

  • Download URL: owlpost-0.1.0.tar.gz
  • Upload date:
  • Size: 16.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.6.14

File hashes

Hashes for owlpost-0.1.0.tar.gz
Algorithm Hash digest
SHA256 9403b65e464029006bac6b15582fb0a6ed66011560422e43e822ff16940421be
MD5 7a1caade40a4b92b973053c12972fc43
BLAKE2b-256 50b0b245adeeadf3a361fb84a2c6fe10c06053cf269afda9c97cd8cc7e038cd9

See more details on using hashes here.

File details

Details for the file owlpost-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: owlpost-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 20.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.6.14

File hashes

Hashes for owlpost-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1d5a1b783e4b19acdf21773188da1a55e59f5551612005f2cb92a25f56cf2b1e
MD5 44a8a9d78f45795964e70d121b61e347
BLAKE2b-256 90a471fc70bcbdf33bb6d2c0b5dc66ef9339b37412c65ac7145755b25576d893

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page