Purpose
MailFathom is designed to solve the problem of the personal mailbox being the largest and least usable archive. It syncs an IMAP mailbox to a user's self-hosted PostgreSQL database, indexes the entire mail copy so that it can be searched, read, and used for cited question answering, and exposes mail as tools to AI agents through the Model Context Protocol (MCP).
Main capabilities
- Sync and index: Sync an IMAP account to a self-owned PostgreSQL database and build a retrieval index.
- Local reading: All read operations are based on the local copy, do not contact the mail server, are fast, remain available when the server is offline, and do not change remote mail state (such as the \Seen flag).
- AI agent access: Provides 21 tools through MCP, allowing AI agents to list, search, and read mail, and to perform cited question answering based on the archive.
- Semantic retrieval and question answering: Supports semantic retrieval and can answer questions across the archive.
- Controlled writes: Write operations such as flagging, drafting, and sending require explicit authorization, granted separately for each account and credential. Sending is off by default and is constrained by recipient policy and periodic limits.
- Security by design: The MCP endpoint is off by default; when enabled, it must declare whether credentials are required; credentials are not stored in configuration files, only references are kept (file paths, systemd credentials, environment variables, etc.); mail content, metadata, extracted text, and search excerpts are never logged or included in error messages.
- Deployment forms: Docker Compose installation is recommended, and Podman Quadlet, Kubernetes, and native systemd processes are also supported. The container image is minimal and has no shell, no package manager, and no HTTP client, and runs as an unprivileged user on a read-only root filesystem.
How to use
- Installation: Docker Compose is recommended; this method configures PostgreSQL for the user and publishes the port on the loopback address, and by default does not expose it to other machines. Installation guides for Podman Quadlet, Kubernetes, and native systemd are also provided.
- Quick try: Through a script, ask for the mailbox location, write the configuration, start the service stack, provide the schema step, record the user and mailbox, and generate the secret used by the chat client to connect.key. However, this script is only suitable for standalone testing, uses plaintext HTTP, stores credentials in files under checkout, and does not provide backups.
- Local development: Local Aspire orchestration can be used in checkout, automatically configuring PostgreSQL and applying the schema.
- Management: Starting with 0.8.0, users, email accounts, credentials, and role permissions are database records, managed at runtime through mfctl, supporting multi-user sharing, shared mailboxes, and multi-replica deployments.
- Upgrade: Upgrading from 0.7.0 is equivalent to a fresh installation on a backup; applying the schema discards stored mail (sync will re-fetch it), and mailboxes or credentials declared in the 0.7.0 configuration are not imported and must be re-recorded through mfctl.
- Documentation: The official documentation site provides search, API references generated from source, and a version selector. Documentation can also be given to an AI assistant to assist with installation, configuration, or use.
Applicable scenarios
- Individuals or teams managing large volumes of historical email who need to search and ask questions across the entire archive.
- Want AI agents to perform operations such as reading and drafting based on local email copies, with strict control over writes.
- Value data privacy and require email copies, databases, and deployments to be self-hosted without relying on third-party services.
- Enterprise-level scenarios that need to share mailboxes among multiple people or deploy multiple replicas.
Limitations
- The project is under active development; before 1.0.0, breaking changes may occur between any versions, including MCP tools, configuration, database schema, or deployment methods.
- Before each upgrade, read the changelog and keep a backup that can be rolled back.
- Sending is disabled by default and is only executed when the deployment is non-read-only, recipient policies and periodic limits have been configured, and permissions have been explicitly granted for credentials.
- Nightly builds are not official releases; the schema may be ahead of any released migration, there is no upgrade path, and they will be deleted as new builds accumulate.
- Development is done on Linux; other platforms have not been verified.
- The clients (Web and desktop) are alpha versions, incomplete and may change between versions; using MCP tools as the supported access method is recommended.
Technology stack and license
- A clean-architecture modular monolith based on .NET 10, with enforced boundaries, and compiler and analyzer diagnostics treated as errors.
- License: AGPL-3.0-only.
- Multi-architecture images, based on pinnedbase images, scanned before release, with signed build provenance.
- Current version: 0.8.0.