Architecture

Explore the high-performance, robust internals of the MCP Agent Mail coordination fabric.

Agent Mail Topology

CLI to Archive Dataflow

A practical flow map for how MCP requests move through server handlers into SQLite and git-auditable storage.

Loading visualization...

This map is grounded in the MCP Agent Mail Rust architecture: CLI and robot-mode commands invoke MCP tools, handlers persist/query SQLite, and storage workers coalesce archive writes into git history.

Use it as the orienting diagram before diving into message lifecycle, reservation guardrails, and Search V3 internals in the rest of this page.

Integration Layer

MCP Architecture

The Model Context Protocol standardizes communication between the agent runtime and the SQLite coordination layer.

Loading visualization...

Agent Mail exposes exactly 34 tools and over 20 read-only resources through the Model Context Protocol surface. Because the interface speaks pure JSON-RPC over `stdio`, any modern AI assistant—from Claude Code and Cursor to standalone language models—can seamlessly interoperate with the swarm.

Storage Guarantees

Dual-Write Pipeline

Achieve sub-millisecond query latency alongside immutable Git auditability.

Loading visualization...

Every message and reservation event splits down two concurrent paths. First, it hits SQLite in WAL mode, guaranteeing immediate visibility for fast FTS5 queries without blocking reads. Simultaneously, it enters a Write-Behind Queue (WBQ) bound for the filesystem.

This architecture ensures the live system is blazing fast while still producing human-readable Markdown artifacts in a Git repository.

Write Amplification

Commit Coalescer

Eliminate Git lock contention by batching concurrent agent writes.

Loading visualization...

When a swarm of 30 agents attempts to log operations simultaneously, raw Git index locks will aggressively contend and crash. The Commit Coalescer intercepts high-frequency filesystem writes and dynamically batches them.

Under extreme load, the coalescer can achieve a 9.1x reduction in Git commits, converting an overwhelming storm of isolated operations into clean, atomic filesystem transactions.

Cross-Project Federation

The Product Bus

Federate multiple repositories into a unified coordination layer without sharing a git history.

Loading visualization...

The Product Bus maps discrete `project_keys` into a unified namespace. This allows agents to seamlessly search for context, check reservations, and dispatch messages across completely distinct codebases (like a frontend and backend repo) without ever bridging their respective Git archives.

System Resilience

Reliability Internals

Independent worker loops, backpressure triggers, and robust pool exhaustion recovery.

Loading visualization...

Agent Mail is designed to survive the chaos of AI agent swarms. If the WBQ floods past a threshold of 128 items, the server safely projects backpressure to limit ingestion, giving background workers (Metrics, Integrity, Retention) time to drain buffers.

Development

Build Timeline

From Python foundations to a published Rust crate.

Phase 1

Python Foundation (1,700+ stars)

  • Built original MCP Agent Mail in Python with SQLite storage

  • Designed agent identity, messaging, and file reservation primitives

  • Achieved 1,700+ GitHub stars and broad community adoption

  • Identified scalability bottlenecks: Git lock contention, SQLite pool exhaustion

Runtime Log v0.2
Phase 2

Rust Ground-Up Rewrite

  • 12-crate modular workspace architecture with zero unsafe code

  • Built on Tokio for high-performance async concurrency

  • SQLite WAL mode with connection pooling and PRAGMA tuning

  • Git-backed archive with commit coalescing (9x reduction)

Runtime Log v0.2
Phase 3

MCP Surface & Search V3

  • Implemented 34 MCP tools across 9 clusters via fastmcp_rust

  • Added 20+ MCP resources for fast agent-discoverable lookups

  • Built hybrid search with two-tier fusion and reranking on frankensearch

  • Cross-project coordination via product bus and contact handshakes

Runtime Log v0.2
Phase 4

Operations Console & CLI

  • 15-screen TUI built on frankentui with 5 themes

  • Robot mode: 16 non-interactive subcommands for agent consumption

  • Web UI for human oversight with Overseer compose form

  • Pre-commit guard integration for reservation enforcement

Runtime Log v0.2
Phase 5

Stress Testing & Production Hardening

  • 10-scenario stress gauntlet: 30-agent pipelines, pool exhaustion, thundering herd

  • Sustained ~49 RPS with 1,494 ops in 30s mixed workloads

  • Commit coalescer achieving 9.1x write reduction

  • Cross-platform installers for Linux, macOS, and Windows

Runtime Log v0.2
Interactive DemosGet Started