opencodecabilloteu ef480dfd97
PR Checks / hadolint (pull_request) Successful in 28s
PR Checks / pytest (pull_request) Successful in 7m14s
PR Checks / build-test (pull_request) Successful in 5m15s
Docker Build and Push / test (pull_request) Successful in 3m40s
Docker Build and Push / integration-test (pull_request) Successful in 3m54s
Docker Build and Push / build (pull_request) Successful in 3m4s
ci(tag): dispatch Renovate on tf-depl-kubernetes once the release image is pushed
A release only reached perso_private/tf-depl-kubernetes on the next hourly
Renovate scan, so the image bump PR could lag up to an hour behind the tag.

After the image push completes, dispatch that repo's Renovate workflow through
the Gitea API (workflow_dispatch is already enabled there). It authenticates
with the RENOVATE_TOKEN org secret of this organisation — the same token the
Renovate instance itself uses, no extra credential. The job fails loudly so a
rotated token shows up instead of the trigger silently going missing.
2026-10-18 13:22:32 -04:00
2026-02-26 16:34:25 -05:00
2026-02-26 16:34:25 -05:00
2026-02-26 16:34:25 -05:00
2026-06-22 16:12:05 +00:00

mcp-maildir

mcp-maildir is an MCP (Model Context Protocol) server allowing AI agents (Claude, OpenHands, Cursor, etc.) to explore, search, and read your email archives in a 100% offline, local, and strict Read-Only (R/O) manner.

This project uses an email dump in the Maildir format (e.g., generated via offlineimap), vectorizes the content locally for semantic search, and stores everything in Qdrant to provide ultra-fast hybrid search (Semantic + Exact filtering on metadata like dates or senders).

✨ Features

  • 🔒 Strict Read-Only: The AI interacts with a Qdrant index; it has no direct access to your actual mailbox or the maildir files. Zero risk of accidental deletion or sending.
  • 🧠 Hybrid Search:
    • Semantic: Find concepts ("farewell party organization") via local sentence-transformers.
    • Factual: Filter deterministically by sender or exact date ranges (thanks to Qdrant's native payload indexes).
  • 🚀 MCP Standard: Instantly compatible with any client supporting the Model Context Protocol.

🏗️ Architecture

  1. Source: Your local Maildir folder.
  2. Indexer (indexer.py): A Python script that parses emails, extracts raw text, generates local embeddings, and pushes everything to Qdrant along with metadata.
  3. Database: Qdrant (running locally via Docker).
  4. MCP Server (server.py): Exposes search and read tools to the AI agent via FastMCP.

🛠️ Prerequisites

  • Python 3.10+
  • Docker (to run Qdrant)
  • An email folder in Maildir format

🚀 Installation & Setup

1. Clone and prepare the environment

git clone https://github.com/your-username/mcp-maildir.git
cd mcp-maildir

# Create a virtual environment
python -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate

# Install dependencies
pip install mcp fastmcp qdrant-client sentence-transformers

2. Start Qdrant (Vector Database)

Run Qdrant locally in the background using Docker:

docker run -p 6333:6333 -p 6334:6334 \
    -v $(pwd)/qdrant_storage:/qdrant/storage:z \
    qdrant/qdrant

3. Configuration

Create a .env file or modify the variables in the code to point to your Maildir folder:

MAILDIR_PATH=/path/to/your/maildir/dump
QDRANT_URL=<http://localhost:6333>
COLLECTION_NAME=my_emails

4. Initial Indexing (Ingestion)

Before the AI can search, you need to index your emails. Run the ingestion script (to be executed every time you sync new emails):

python indexer.py

Note: The indexer.py script automatically configures Qdrant payload indexes for metadata (sender as KEYWORD, date as DATETIME) to guarantee fast and deterministic static searches.

🤖 Usage with an MCP Client

Tools exposed by the server

The server.py script exposes the following tools to the AI:

  • search_emails(query: str, sender: str, start_date: str, end_date: str): Performs a hybrid search. Metadata parameters are optional.
  • read_email(message_id: str): Returns the full text content (cleaned of HTML) of a specific email.
S
Description
No description provided
Readme
281 KiB
0 Stars 4 Watchers 0 Forks
v0.0.27
Latest
2026-10-19 13:51:19 -04:00
Languages
Python 98.7%
Dockerfile 1.3%