Mailbunker_MCP

Mailbunker_MCP

Zero-trust encrypted email archiving and search MCP server with real-time IMAP IDLE ingestion, AES-256-GCM encryption, SQLite FTS5 full-text search, and Obsidian vault export, exposing tools for AI assistants to search, retrieve, and manage emails.

Category
访问服务器

README

🔒 Mailbunker_MCP

<div align="center">

Zero-Trust Encrypted Email Archive, Real-Time IMAP Push Ingestion (IDLE), Obsidian Vault Generator, and Model Context Protocol (MCP) Server.

License: MIT Python 3.10+ MCP Ready Security: Zero--Trust SQLite FTS5

English • Deutsch

</div>


📖 About Mailbunker

Mailbunker_MCP is an open-source, privacy-first email archiving and semantic search bunker designed to solve email clutter, vendor lock-in, and retrieval challenges once and for all.

It connects to any number of IMAP email accounts (Work, Personal, iCloud, Gmail, Posteo, Hetzner, Mailbox.org, custom servers), ingests incoming messages in real-time via IMAP IDLE Push, protects everything with Zero-Trust AES-256-GCM encryption derived from your master password using Argon2id, indexes all messages for sub-millisecond full-text search (SQLite FTS5), and exposes standard Model Context Protocol (MCP) tools for Claude Desktop, Cursor, and autonomous AI agents.


✨ Features

  • ⚡ Real-Time Push Ingestion (IMAP IDLE):

    • Instant zero-delay email capture as soon as an email reaches your provider (RFC 2177). No delayed cron polling required.
    • Resilient automatic keepalive refresh and exponential backoff auto-reconnect.
  • 🛡️ Zero-Trust At-Rest Encryption:

    • All email bodies (Markdown & HTML), raw headers, and binary attachments (PDFs, images, documents) are encrypted with AES-256-GCM.
    • Master key derivation via memory-hard Argon2id (VAULT_PASSWORD), highly resistant to GPU/ASIC brute-force attacks.
    • Zero plaintext leak on disk or in Docker volumes.
  • 🔍 Sub-Millisecond Full-Text Search (SQLite FTS5):

    • Search across 100,000+ emails in milliseconds.
    • Supports boolean operators (AND, OR, NOT), prefix matching (tax*), phrase search ("contract agreement"), and structured filters (by sender, date range, account, folder, attachment presence).
    • Rich contextual snippet generation with match highlights.
  • 📓 Obsidian-Ready Markdown Vault:

    • Converts complex HTML emails into clean GitHub Flavored Markdown.
    • Complete YAML frontmatter metadata (id, subject, from, to, date, account, folder, tags, attachments).
    • Native Obsidian wikilinks for email thread tracking ([[Parent Note]]).
    • Export on-demand (mailbunker export-vault) or configure live auto-export.
  • 🤖 Model Context Protocol (MCP) Server:

    • Native FastMCP server providing high-level tools: search_emails, get_email, list_accounts, list_mailboxes, sync_now, get_sync_status, export_obsidian_vault.
    • Seamlessly integrates with Claude Desktop, Cursor IDE, Antigravity, and any MCP-compliant AI assistant.
  • 🔑 Multi-Account & macOS Keychain Integration:

    • Easy setup for 1 to 5+ email accounts via .env (MAIL_1_... through MAIL_5_...).
    • Interactive macOS Keychain discovery assistant (mailbunker keychain-import).

🏗️ Architecture

graph TD
    subgraph Email_Sources [Email Sources]
        A1[Account 1: IMAP IDLE Push]
        A2[Account 2: IMAP IDLE Push]
        A3[Account 3..N: .env / Config]
        KC[macOS Keychain Helper]
    end

    subgraph Mailbunker_Core [Mailbunker Core Engine]
        SM[Sync & IDLE Manager]
        MP[MIME & HTML to Markdown Parser]
        CE[Zero-Trust Crypto Engine: AES-256-GCM + Argon2id]
        FTS[SQLite Database + FTS5 Search Index]
        OV[Obsidian Vault Generator]
    end

    subgraph Interfaces [Interfaces & Consumers]
        MCP[MCP Server: FastMCP Tools & Resources]
        CLI[Rich CLI: start, sync, search, get, export]
        OBS[Decrypted Obsidian Vault]
        AI[AI Assistants / Claude / Cursor]
    end

    A1 --> SM
    A2 --> SM
    A3 --> SM
    KC -.-> A3
    SM --> MP
    MP --> CE
    CE --> FTS
    CE --> OV
    FTS --> MCP
    FTS --> CLI
    OV --> OBS
    MCP --> AI
    CLI --> OBS

🚀 Quick Start

1. Installation

# Clone the repository
git clone https://github.com/cubetribe/Mailbunker_MCP.git
cd Mailbunker_MCP

# Create virtual environment and install dependencies
uv venv
source .venv/bin/activate
uv pip install -e .

2. Configuration (.env)

Copy the provided .env.example template:

cp .env.example .env

Edit .env with your settings:

# ==============================================================================
# Zero-Trust Master Password (REQUIRED)
# ==============================================================================
VAULT_PASSWORD=your-super-secure-master-password-here

# Base storage path for encrypted database and attachments
STORAGE_PATH=./data

# ==============================================================================
# Email Accounts (Configure Mail 1 through 5, or more)
# ==============================================================================
MAIL_1_ENABLED=true
MAIL_1_NAME=Work
MAIL_1_HOST=imap.example.com
MAIL_1_PORT=993
MAIL_1_USER=user@example.com
MAIL_1_PASSWORD=your_app_specific_password
MAIL_1_SSL=true
MAIL_1_FOLDERS=INBOX,Sent

MAIL_2_ENABLED=false
MAIL_2_NAME=Personal
MAIL_2_HOST=imap.posteo.de
MAIL_2_PORT=993
MAIL_2_USER=personal@posteo.de
MAIL_2_PASSWORD=your_password
MAIL_2_SSL=true
MAIL_2_FOLDERS=INBOX

💻 CLI Commands

Mailbunker comes with a modern, colored terminal CLI:

Command Description
mailbunker start Launches the background daemon with IMAP IDLE push listeners for all active accounts.
mailbunker sync Performs an immediate one-time sync of all configured mailboxes.
mailbunker search "<query>" Searches indexed emails using full-text search (FTS5) and displays matching results.
mailbunker get <id> Decrypts and renders a full email and its formatted Markdown in the terminal.
mailbunker status Shows statistics: total emails, attachments, storage sizes, and encryption state.
mailbunker export-vault -o <dir> Decrypts and exports all emails and attachments into an organized Obsidian Vault.
mailbunker keychain-import Scans macOS Keychain for saved mail server credentials.
mailbunker mcp Runs the Model Context Protocol (MCP) server over stdio.

CLI Examples

# Sync all accounts immediately
mailbunker sync

# Search for 2026 invoices
mailbunker search "invoice 2026"

# Check bunker health and statistics
mailbunker status

# Decrypt and export into an Obsidian Vault folder
mailbunker export-vault --output ~/Documents/Obsidian/MailVault

🤖 MCP Integration (Claude Desktop / Cursor / Antigravity)

Add Mailbunker to your MCP configuration file (e.g. claude_desktop_config.json or Cursor Settings):

{
  "mcpServers": {
    "mailbunker": {
      "command": "uv",
      "args": [
        "--directory",
        "/path/to/Mailbunker_MCP",
        "run",
        "mailbunker-mcp"
      ],
      "env": {
        "VAULT_PASSWORD": "your-super-secure-master-password-here",
        "STORAGE_PATH": "/path/to/Mailbunker_MCP/data"
      }
    }
  }
}

Available MCP Tools

  • search_emails(query, account, folder, start_date, end_date, limit): Fast FTS5 email search.
  • get_email(email_id, format='markdown'|'json'|'text'): Retrieve full decrypted message.
  • list_accounts(): List configured accounts, statuses, and counts.
  • list_mailboxes(account_name): List available mailbox folders.
  • sync_now(account, folder): Trigger immediate mailbox sync.
  • get_sync_status(): Inspect real-time push listener status & database stats.
  • export_obsidian_vault(target_path, password): Decrypt and export vault.

🔒 Zero-Trust Security Architecture

[ Master Password: VAULT_PASSWORD ]
                 │
                 ▼ Argon2id KDF (16-byte Salt, 64MB RAM, 3 Iterations)
        [ 256-bit AES-GCM Key ]
                 │
  ┌──────────────┴──────────────┐
  ▼                             ▼
[ Email Payloads ]       [ Attachment Files ]
(Body, Headers, JSON)    (PDFs, Office Docs, Images)
  │                             │
  ▼ AES-256-GCM (IV + Tag)      ▼ AES-256-GCM (IV + Tag)
[ Encrypted SQLite DB ]  [ data/attachments/... ]
  • Zero-Plaintext Leak: No email body, raw header, or binary attachment is ever stored unencrypted on disk.
  • Authenticated Encryption: AES-256-GCM verification tags guarantee data integrity and detect tampering.
  • Argon2id Key Derivation: High memory-cost parameters protect against offline GPU/ASIC password cracking.

🐳 Docker Deployment

Run Mailbunker in an isolated Docker container:

docker compose up -d

🧪 Testing

Mailbunker includes a comprehensive test suite:

source .venv/bin/activate
pytest -v

📄 License

MIT License — Copyright (c) 2026 cubetribe

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选