Mailindex MCP logo

Mailindex MCP

Searches and manages indexed mail, including attachments, folders, drafts, and bulk actions, through MCP.

Install Mailindex MCP

Pick your client, then add it in one click or paste the config.

Streamable HTTP (Remote)
Server URL
https://claude.ai/api/mcp/auth_callback

Remote servers are added in the app, not the config file: Customize → Connectors → Add custom connector, then paste this URL.

Overview

mailindex-mcp MCP server connects AI clients to a self-hosted PostgreSQL-backed index of mail. It synchronizes IMAP/SMTP accounts, Gmail, and Microsoft mailboxes, then supports lexical and bounded regex search across messages and extracted attachment text. Agents can inspect threads and attachments, send or draft mail, manage folders, and apply bulk mark, move, or delete operations. Reach for it when local ownership, searchable archives, and actions beyond read-only email access matter.

Use cases

  • Search years of messages and attachment text
  • Bulk-move newsletters or other matching mail
  • Draft or send replies with uploaded attachments
  • Manage folders and message flags through an AI client
  • Check mailbox indexing coverage before acting

Key features

  • Self-hosted PostgreSQL mail index
  • Lexical and bounded regex search
  • Attachment text extraction with OCR
  • Bulk mail actions and folder management
  • Gmail and Microsoft authorization flows
  • Short-lived attachment download URLs

Tools22

What Mailindex MCP lets your agent do. Expand a tool for its parameters.

Self-reported~318 tokens of context

Security & health

What it can reach and how reliably it runs — from our own checks, not the maintainer’s claims.

ActiveLast checked

Recent health check succeeded.

17/21 checks healthy over the last 111d

Adoption & maintenance

Factual signals from GitHub, npm, and our automated checks — not a rating.

Last commit29d agoMost recent push to the default branch.
Tools exposed22Callable tools this server registers over MCP.
Directory activity1 viewsConfig copies, upvotes, and views on AllMCPs.

How Mailindex MCP works

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.

Written by AllMCPs with AI assistance from the project’s README and listing data. How we build listings

Reviews

No reviews yet — be the first to share how it worked for you.

Frequently Asked Questions about Mailindex MCP

mailindex-mcp is an MCP server that connects AI clients to self-hosted indexed mailboxes through IMAP/SMTP, Gmail, and Microsoft authorization. Its main tools search messages and attachments, retrieve threads, manage folders, mark or move mail, delete messages, save drafts, and send replies. It runs over streamable HTTP.

Install it with Docker Compose by cloning the repository, copying `.env.example` to `.env`, and running `docker compose up -d`. Check `http://localhost:8002/api/v1/health`, then connect an MCP client to `http://localhost:8002/mcp` over streamable HTTP.

Connect a mailbox with the `add_mail_account` tool. Provide IMAP and SMTP settings, then use the short-lived browser password form instead of sending a password through the model. Gmail and Microsoft mailboxes can use their respective consent flows.

Yes, mailindex-mcp works with Cursor over streamable HTTP. Point Cursor at the MCP endpoint, such as `http://localhost:8002/mcp` for a local deployment, or use the HTTPS endpoint of a secured remote deployment.

Yes, mailindex-mcp indexes extracted text from PDF, DOCX, XLSX, and PPTX files, including OCR data. Attachment binaries are not stored in the index; `get_attachment` provides metadata, extracted text, and an expiring download URL.

Related MCP servers

Add a badge to your READMEShow it’s listed — live SVG, Markdown or HTML.

AllMCPs Directory Badge

Full Badge Customizer

Showcase your server listing on GitHub or your project documentation. Embed this dynamic SVG badge to highlight official listing status and live engagement.

Badge Style:
Live Dynamic SVG PreviewMailindex MCP AllMCPs Directory Badge
Markdown (GitHub README)
[![AllMCPs](https://allmcps.com/api/badge/mailindex-mcp?style=directory)](https://allmcps.com/mcp/mailindex-mcp)
HTML Embed
<a href="https://allmcps.com/mcp/mailindex-mcp"><img src="https://allmcps.com/api/badge/mailindex-mcp?style=directory" alt="Mailindex MCP on AllMCPs" /></a>