Skip to content

Post 🏀 β€” Local mail daemon, MCP server, and CLI built in Swift

License

Notifications You must be signed in to change notification settings

Cocoanetics/Post

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

55 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Post 🏀

A local mail daemon, MCP server, and CLI β€” built entirely in Swift.

Post pulls together SwiftMail, SwiftMCP, and SwiftText to give you a persistent, local-first email system that keeps tabs on multiple mailboxes across multiple IMAP servers.

Architecture

Post is three things in one package:

postd β€” The Daemon

A lightweight Launch Agent that maintains persistent IMAP connections to all your configured mail servers. Optionally, it can use IMAP IDLE on any mailbox (INBOX, Sent, a custom folder, etc.) to get instant push notifications when messages arrive or change. When a change is detected, it can trigger a custom command β€” a shell script, a webhook call, whatever you need.

MCP Server

The daemon doubles as an MCP (Model Context Protocol) server, exposing your email to AI agents. Agents can list servers, search messages, fetch content, download attachments, move/copy/flag messages, and more β€” all through a standardized tool interface.

post β€” The CLI

A fast command-line client for searching, reading, downloading, and managing email. Communicates with the running daemon via local Bonjour + HTTP β€” no separate IMAP connections needed.

post list --server work --limit 10
post fetch 12199 --server work
post fetch 12198,12199 --eml --out ./backup
post search --from "amazon" --since 2025-01-01
post move 12345 Archive
post attachment 12199 --out ./downloads

πŸ“– Full CLI User Guide β†’

How It Works

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”                         β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  post CLI   │◄── Bonjour + HTTP ─────►│                  β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜                         β”‚                  │──── IMAP IDLE ──► Mail Server 1
                                        β”‚  postd daemon    │──── IMAP IDLE ──► Mail Server 2
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”                         β”‚                  │──── IMAP IDLE ──► Mail Server 3
β”‚  AI Agents  │◄── MCP (TCP) ──────────►│                  β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜                         β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

The daemon holds all IMAP connections. Both the CLI and AI agents talk to the daemon β€” never directly to mail servers. This means:

  • Single connection pool β€” no duplicate IMAP sessions
  • Instant discovery β€” CLI finds the daemon via Bonjour, zero config
  • Always up-to-date β€” IDLE keeps mailbox state fresh
  • Trigger scripts β€” run custom commands when new mail arrives

Getting Started

Requirements

  • macOS 14.0+
  • Swift 6.0+

Build & Run

# Build
swift build

# Configure a server
post credential set --server work --host imap.company.com --port 993 --username you@company.com

# Create config
echo '{ "servers": { "work": {} } }' > ~/.post.json

# Start the daemon
postd start

πŸ“– Daemon Setup & Configuration β†’ β€” configuration options, IMAP IDLE, Launch Agent setup, credential management

Dependencies

Package Purpose
SwiftMail IMAP/SMTP client library
SwiftMCP Model Context Protocol server framework
SwiftText HTML-to-markdown conversion
swift-argument-parser CLI argument parsing
swift-log Structured logging

Roadmap

  • Identity-based access control β€” assign different identities to different agents, restricting which mailboxes and servers each agent can see
  • Permission levels β€” fine-grained access tiers:
    • Read-only
    • Archive-only
    • Allow trash/delete
    • Allow creating drafts
    • Allow sending
  • Multi-agent isolation β€” ensure agents only see what they're supposed to see

License

MIT β€” see LICENSE for details.

About

Post 🏀 β€” Local mail daemon, MCP server, and CLI built in Swift

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published