# mailindex-mcp [Health: Active]

**Category:** 💬 Communication  
**Repository:** https://github.com/alexanderkrauck/mailindex-mcp  
**GitHub Stars:** 0  
**Views:** 1  
**Installs:** 0  
**Upvotes:** 0  
**Directory Page:** https://allmcps.com/mcp/mailindex-mcp

## Description
Search, move, mark, delete and draft your real mail over a self-hosted index.

## Tools
Capabilities this server exposes over MCP:

- **list_mail_accounts** — accounts, non-secret settings, exact stored message counts
- **add_mail_account** — add an IMAP/SMTP mailbox
- **update_mail_account** — change one mailbox's settings
- **delete_mail_account** — remove an account and everything indexed from it; nothing at the provider
- **begin_mail_account_password_setup** — short-lived password-only browser form
- **begin_gmail_connection** — five-minute signed URL for Google consent
- **begin_microsoft_connection** — five-minute signed URL for Microsoft consent
- **search_mail** — exhaustive lexical search
- **search_mail_regex** — bounded regex search
- **get_mail** — one message, bounded body
- **get_thread** — reconstructed thread with confidence
- **get_attachment** — metadata, extracted text, expiring download URL
- **begin_attachment_upload** — signed slot for new file bytes, attached or embedded inline
- **send_mail** — send or reply, with owned attachments
- **list_mail_folders** — folders of one mailbox, with declared roles and indexed counts
- **create_mail_folder** — create and subscribe to a folder
- **rename_mail_folder** — rename a folder, keeping its mail and children
- **delete_mail_folder** — remove a folder, emptying it into Trash first
- **mark_mail** — set or clear read and flagged state, in bulk
- **move_mail** — move mail to another folder, in bulk
- **delete_mail** — move to Trash, in bulk; `permanent` only from Trash
- **save_draft** — write a draft into the mailbox's Drafts folder

## Claude Desktop Quick Installation
Remote MCP endpoint (confidence: high). Install path detected from listing signals. Add as a URL/SSE server in your client:

```json
"mcpServers": {
  "mailindex-mcp": {
    "url": "https://claude.ai/api/mcp/auth_callback"
  }
}
```

## Documentation

## What mailindex-mcp does

mailindex-mcp gives an MCP client access to a self-hosted index of mail and the mailbox operations needed to act on search results. It can register IMAP/SMTP accounts, connect Gmail through consent, and connect Microsoft mailboxes through Microsoft authorization. Synchronization runs in the background after an account is added.

The index supports message search, thread reconstruction, bounded message bodies, and extracted attachment text. Supported attachment extraction covers PDF, DOCX, XLSX, PPTX, and OCR data. Attachment binaries are retrieved through short-lived download URLs rather than stored in the index. Search responses include exact counts and account coverage so an agent can distinguish indexed mail from mail still being synchronized.

## How it works

Run the service with Docker Compose and expose its MCP endpoint over streamable HTTP at `/mcp`. A local development setup binds Docker to `127.0.0.1` and uses unauthenticated access. For a remotely reachable deployment, the single-user configuration uses a domain, TLS through Caddy, and an API token; the production configuration supports Google OAuth for separate users and mailboxes.

The quickstart uses the published container image, with amd64 and arm64 images available. Docker can also build the image locally. PostgreSQL stores the index and OCR language data is included in the image. The first synchronization downloads each message once, while search can operate on the portion already indexed.

Add mailboxes through the MCP tools. For ordinary IMAP/SMTP accounts, password setup can return a short-lived browser form so the password is entered outside the model conversation. Gmail uses a five-minute signed consent URL, and Microsoft connections use a similar short-lived authorization flow. App passwords are intended for password-based providers.

## Setup and configuration

A local installation can be started with `docker compose up -d` after copying `.env.example` to `.env`. Check availability at `http://localhost:8002/api/v1/health`, then configure the client with `http://localhost:8002/mcp` using streamable HTTP.

Production-style deployments use these settings: `EMAILSERVER_DOMAIN`, `POSTGRES_PASSWORD`, `EMAILSERVER_API_TOKEN`, `CREDENTIAL_ENCRYPTION_KEY`, and `SESSION_SECRET`. Generate secret values with `openssl rand -base64 32`; the API token must contain at least 32 characters. The `MAILINDEX_IMAGE` setting can select a container image tag in the Compose files.

## Tools and capabilities

- Inspect accounts, non-secret settings, and stored message counts.
- Add, update, or remove IMAP/SMTP accounts.
- Start browser-based password, Gmail, or Microsoft authorization flows.
- Search mail lexically or with bounded regular expressions.
- Retrieve messages, reconstructed threads, and attachment metadata or extracted text.
- Upload files for outgoing or inline attachments using signed upload slots.
- Send replies, save drafts, and manage folders.
- Mark messages read or flagged, move them in bulk, and send deleted mail to Trash.
- Create, rename, or delete folders; deleting a folder empties it into Trash first.

## Limitations and notes

The index consumes roughly 28 MB per 1,000 messages, while the container image is about 1.25 GB because it includes OCR language data. A first sync downloads the complete mailbox and may take time. The service is pre-1.0, and schema migrations run automatically when the container starts, so deployments should pin an image tag rather than rely on `latest`.

Do not expose the unauthenticated development configuration beyond the local machine. Static-token deployments do not work with web connectors that require OAuth negotiation, including the claude.ai and ChatGPT web connectors. Microsoft 365 and Exchange Online use the Microsoft authorization flow rather than password authentication.

_Full upstream README: https://allmcps.com/mcp/mailindex-mcp/readme_

