mailindex-mcp
Self-hosted mail index that lets an agent search, move, delete and draft email in bulk
mailindex-mcp is an open-source MCP server for communication. It runs as a hosted remote server, so there is nothing to install locally.
- Pricing
- Open source
- Platforms
- Self-hosted, API
- Runs
- Remotely
- What it can do
- Can delete data (1 tool)
- Version
- 0.3.3
- Listing updated
Similar MCP servers
Install
Add with the CLI
Run in a terminal
claude mcp add mailindex-mcp --env EMAILSERVER_DATABASE_URL='<EMAILSERVER_DATABASE_URL>' --env EMAILSERVER_API_TOKEN='<EMAILSERVER_API_TOKEN>' --env CREDENTIAL_ENCRYPTION_KEY='<CREDENTIAL_ENCRYPTION_KEY>' -- docker run -i --rm -e EMAILSERVER_DATABASE_URL -e EMAILSERVER_API_TOKEN -e CREDENTIAL_ENCRYPTION_KEY ghcr.io/alexanderkrauck/mailindex-mcp:0.3.3Add --scope user to use it in every project, or --scope project to share it in .mcp.json.
Or share it with your project
Add to .mcp.json
{
"mcpServers": {
"mailindex-mcp": {
"command": "docker",
"args": [
"run",
"-i",
"--rm",
"-e",
"EMAILSERVER_DATABASE_URL",
"-e",
"EMAILSERVER_API_TOKEN",
"-e",
"CREDENTIAL_ENCRYPTION_KEY",
"ghcr.io/alexanderkrauck/mailindex-mcp:0.3.3"
],
"env": {
"EMAILSERVER_DATABASE_URL": "<EMAILSERVER_DATABASE_URL>",
"EMAILSERVER_API_TOKEN": "<EMAILSERVER_API_TOKEN>",
"CREDENTIAL_ENCRYPTION_KEY": "<CREDENTIAL_ENCRYPTION_KEY>"
}
}
}
}Add to claude_desktop_config.json
{
"mcpServers": {
"mailindex-mcp": {
"command": "docker",
"args": [
"run",
"-i",
"--rm",
"-e",
"EMAILSERVER_DATABASE_URL",
"-e",
"EMAILSERVER_API_TOKEN",
"-e",
"CREDENTIAL_ENCRYPTION_KEY",
"ghcr.io/alexanderkrauck/mailindex-mcp:0.3.3"
],
"env": {
"EMAILSERVER_DATABASE_URL": "<EMAILSERVER_DATABASE_URL>",
"EMAILSERVER_API_TOKEN": "<EMAILSERVER_API_TOKEN>",
"CREDENTIAL_ENCRYPTION_KEY": "<CREDENTIAL_ENCRYPTION_KEY>"
}
}
}
}Settings → Developer → Edit Config, then quit and reopen Claude Desktop.
Add to ~/.cursor/mcp.json
{
"mcpServers": {
"mailindex-mcp": {
"command": "docker",
"args": [
"run",
"-i",
"--rm",
"-e",
"EMAILSERVER_DATABASE_URL",
"-e",
"EMAILSERVER_API_TOKEN",
"-e",
"CREDENTIAL_ENCRYPTION_KEY",
"ghcr.io/alexanderkrauck/mailindex-mcp:0.3.3"
],
"env": {
"EMAILSERVER_DATABASE_URL": "<EMAILSERVER_DATABASE_URL>",
"EMAILSERVER_API_TOKEN": "<EMAILSERVER_API_TOKEN>",
"CREDENTIAL_ENCRYPTION_KEY": "<CREDENTIAL_ENCRYPTION_KEY>"
}
}
}
}Use .cursor/mcp.json in a project to share it with the project.
Add to ~/.copilot/mcp-config.json
{
"mcpServers": {
"mailindex-mcp": {
"type": "stdio",
"command": "docker",
"args": [
"run",
"-i",
"--rm",
"-e",
"EMAILSERVER_DATABASE_URL",
"-e",
"EMAILSERVER_API_TOKEN",
"-e",
"CREDENTIAL_ENCRYPTION_KEY",
"ghcr.io/alexanderkrauck/mailindex-mcp:0.3.3"
],
"env": {
"EMAILSERVER_DATABASE_URL": "<EMAILSERVER_DATABASE_URL>",
"EMAILSERVER_API_TOKEN": "<EMAILSERVER_API_TOKEN>",
"CREDENTIAL_ENCRYPTION_KEY": "<CREDENTIAL_ENCRYPTION_KEY>"
}
}
}
}Or put the same entry in .mcp.json at your workspace root to share it.
Add with the CLI
Run in a terminal
codex mcp add mailindex-mcp --env EMAILSERVER_DATABASE_URL='<EMAILSERVER_DATABASE_URL>' --env EMAILSERVER_API_TOKEN='<EMAILSERVER_API_TOKEN>' --env CREDENTIAL_ENCRYPTION_KEY='<CREDENTIAL_ENCRYPTION_KEY>' -- docker run -i --rm -e EMAILSERVER_DATABASE_URL -e EMAILSERVER_API_TOKEN -e CREDENTIAL_ENCRYPTION_KEY ghcr.io/alexanderkrauck/mailindex-mcp:0.3.3Or add to config.toml
Add to ~/.codex/config.toml
[mcp_servers.mailindex-mcp]
command = "docker"
args = ["run", "-i", "--rm", "-e", "EMAILSERVER_DATABASE_URL", "-e", "EMAILSERVER_API_TOKEN", "-e", "CREDENTIAL_ENCRYPTION_KEY", "ghcr.io/alexanderkrauck/mailindex-mcp:0.3.3"]
env = { EMAILSERVER_DATABASE_URL = "<EMAILSERVER_DATABASE_URL>", EMAILSERVER_API_TOKEN = "<EMAILSERVER_API_TOKEN>", CREDENTIAL_ENCRYPTION_KEY = "<CREDENTIAL_ENCRYPTION_KEY>" }Add to your client's MCP settings (most use this shape)
{
"mcpServers": {
"mailindex-mcp": {
"command": "docker",
"args": [
"run",
"-i",
"--rm",
"-e",
"EMAILSERVER_DATABASE_URL",
"-e",
"EMAILSERVER_API_TOKEN",
"-e",
"CREDENTIAL_ENCRYPTION_KEY",
"ghcr.io/alexanderkrauck/mailindex-mcp:0.3.3"
],
"env": {
"EMAILSERVER_DATABASE_URL": "<EMAILSERVER_DATABASE_URL>",
"EMAILSERVER_API_TOKEN": "<EMAILSERVER_API_TOKEN>",
"CREDENTIAL_ENCRYPTION_KEY": "<CREDENTIAL_ENCRYPTION_KEY>"
}
}
}
}Gemini CLI and Antigravity
Gemini CLI
Add to ~/.gemini/settings.json
{ "mcpServers": { "mailindex-mcp": { "command": "docker", "args": [ "run", "-i", "--rm", "-e", "EMAILSERVER_DATABASE_URL", "-e", "EMAILSERVER_API_TOKEN", "-e", "CREDENTIAL_ENCRYPTION_KEY", "ghcr.io/alexanderkrauck/mailindex-mcp:0.3.3" ], "env": { "EMAILSERVER_DATABASE_URL": "<EMAILSERVER_DATABASE_URL>", "EMAILSERVER_API_TOKEN": "<EMAILSERVER_API_TOKEN>", "CREDENTIAL_ENCRYPTION_KEY": "<CREDENTIAL_ENCRYPTION_KEY>" } } } }Or run: gemini mcp add -s user -e EMAILSERVER_DATABASE_URL='<EMAILSERVER_DATABASE_URL>' -e EMAILSERVER_API_TOKEN='<EMAILSERVER_API_TOKEN>' -e CREDENTIAL_ENCRYPTION_KEY='<CREDENTIAL_ENCRYPTION_KEY>' mailindex-mcp docker -- run -i --rm -e EMAILSERVER_DATABASE_URL -e EMAILSERVER_API_TOKEN -e CREDENTIAL_ENCRYPTION_KEY ghcr.io/alexanderkrauck/mailindex-mcp:0.3.3
Antigravity
Add to ~/.gemini/config/mcp_config.json
{ "mcpServers": { "mailindex-mcp": { "command": "docker", "args": [ "run", "-i", "--rm", "-e", "EMAILSERVER_DATABASE_URL", "-e", "EMAILSERVER_API_TOKEN", "-e", "CREDENTIAL_ENCRYPTION_KEY", "ghcr.io/alexanderkrauck/mailindex-mcp:0.3.3" ], "env": { "EMAILSERVER_DATABASE_URL": "<EMAILSERVER_DATABASE_URL>", "EMAILSERVER_API_TOKEN": "<EMAILSERVER_API_TOKEN>", "CREDENTIAL_ENCRYPTION_KEY": "<CREDENTIAL_ENCRYPTION_KEY>" } } } }Use .agents/mcp_config.json to add it to one workspace only.
Devin Desktop (formerly Windsurf)
Add to ~/.config/devin/mcp_config.json
{ "mcpServers": { "mailindex-mcp": { "command": "docker", "args": [ "run", "-i", "--rm", "-e", "EMAILSERVER_DATABASE_URL", "-e", "EMAILSERVER_API_TOKEN", "-e", "CREDENTIAL_ENCRYPTION_KEY", "ghcr.io/alexanderkrauck/mailindex-mcp:0.3.3" ], "env": { "EMAILSERVER_DATABASE_URL": "<EMAILSERVER_DATABASE_URL>", "EMAILSERVER_API_TOKEN": "<EMAILSERVER_API_TOKEN>", "CREDENTIAL_ENCRYPTION_KEY": "<CREDENTIAL_ENCRYPTION_KEY>" } } } }On Windows the file is %APPDATA%\devin\mcp_config.json. Use .devin/mcp_config.json to share it with a project.
Cline
Add to cline_mcp_settings.json
{ "mcpServers": { "mailindex-mcp": { "command": "docker", "args": [ "run", "-i", "--rm", "-e", "EMAILSERVER_DATABASE_URL", "-e", "EMAILSERVER_API_TOKEN", "-e", "CREDENTIAL_ENCRYPTION_KEY", "ghcr.io/alexanderkrauck/mailindex-mcp:0.3.3" ], "env": { "EMAILSERVER_DATABASE_URL": "<EMAILSERVER_DATABASE_URL>", "EMAILSERVER_API_TOKEN": "<EMAILSERVER_API_TOKEN>", "CREDENTIAL_ENCRYPTION_KEY": "<CREDENTIAL_ENCRYPTION_KEY>" } } } }Open it from the MCP Servers icon → Configure → Configure MCP Servers.
Zed
Add to Zed settings.json
{ "context_servers": { "mailindex-mcp": { "command": "docker", "args": [ "run", "-i", "--rm", "-e", "EMAILSERVER_DATABASE_URL", "-e", "EMAILSERVER_API_TOKEN", "-e", "CREDENTIAL_ENCRYPTION_KEY", "ghcr.io/alexanderkrauck/mailindex-mcp:0.3.3" ], "env": { "EMAILSERVER_DATABASE_URL": "<EMAILSERVER_DATABASE_URL>", "EMAILSERVER_API_TOKEN": "<EMAILSERVER_API_TOKEN>", "CREDENTIAL_ENCRYPTION_KEY": "<CREDENTIAL_ENCRYPTION_KEY>" } } } }Open it with zed: open settings file. Merge context_servers into the settings you already have.
JetBrains AI Assistant and Junie
AI Assistant
Add to Settings → Tools → AI Assistant → Model Context Protocol (MCP) → Add
{ "mcpServers": { "mailindex-mcp": { "command": "docker", "args": [ "run", "-i", "--rm", "-e", "EMAILSERVER_DATABASE_URL", "-e", "EMAILSERVER_API_TOKEN", "-e", "CREDENTIAL_ENCRYPTION_KEY", "ghcr.io/alexanderkrauck/mailindex-mcp:0.3.3" ], "env": { "EMAILSERVER_DATABASE_URL": "<EMAILSERVER_DATABASE_URL>", "EMAILSERVER_API_TOKEN": "<EMAILSERVER_API_TOKEN>", "CREDENTIAL_ENCRYPTION_KEY": "<CREDENTIAL_ENCRYPTION_KEY>" } } } }The AI Assistant docs only show command and args. If the env block is ignored, use Junie for this server.
Junie
Add to ~/.junie/mcp/mcp.json
{ "mcpServers": { "mailindex-mcp": { "command": "docker", "args": [ "run", "-i", "--rm", "-e", "EMAILSERVER_DATABASE_URL", "-e", "EMAILSERVER_API_TOKEN", "-e", "CREDENTIAL_ENCRYPTION_KEY", "ghcr.io/alexanderkrauck/mailindex-mcp:0.3.3" ], "env": { "EMAILSERVER_DATABASE_URL": "<EMAILSERVER_DATABASE_URL>", "EMAILSERVER_API_TOKEN": "<EMAILSERVER_API_TOKEN>", "CREDENTIAL_ENCRYPTION_KEY": "<CREDENTIAL_ENCRYPTION_KEY>" } } } }Use .junie/mcp/mcp.json to share it with a project.
Kiro
Add to ~/.kiro/settings/mcp.json
{ "mcpServers": { "mailindex-mcp": { "command": "docker", "args": [ "run", "-i", "--rm", "-e", "EMAILSERVER_DATABASE_URL", "-e", "EMAILSERVER_API_TOKEN", "-e", "CREDENTIAL_ENCRYPTION_KEY", "ghcr.io/alexanderkrauck/mailindex-mcp:0.3.3" ], "env": { "EMAILSERVER_DATABASE_URL": "<EMAILSERVER_DATABASE_URL>", "EMAILSERVER_API_TOKEN": "<EMAILSERVER_API_TOKEN>", "CREDENTIAL_ENCRYPTION_KEY": "<CREDENTIAL_ENCRYPTION_KEY>" } } } }Use .kiro/settings/mcp.json to add it to one workspace only.
Using several servers? Build one config file with the MCP config generator.
Configuration
EMAILSERVER_DATABASE_URLPostgreSQL connection URL. This server keeps its own index and does not run without a database; the repository ships docker-compose files that start one for you.RequiredEMAILSERVER_AUTH_MODEHow callers are authenticated: development (no auth, loopback only), single_user (static bearer token), or google (multi-user OAuth).EMAILSERVER_API_TOKENBearer token required in single_user mode. At least 32 characters, or the server refuses to start.CREDENTIAL_ENCRYPTION_KEYKey used to encrypt stored mailbox credentials at rest. Generate with: openssl rand -base64 32
About mailindex-mcp
Most email MCP servers pass questions through to IMAP. This one keeps its own PostgreSQL copy of your mail with full-text search stemmed across languages, so a single call can act on thousands of messages. The README shows delete_mail moving 4,147 matched newsletters to the bin in one call.
Attachment text from PDF, DOCX, XLSX and PPTX files, including OCR, is indexed at sync time, while binaries are never stored and are refetched through a 5-minute signed URL. Results carry an exact total count, signed cursors and per-account coverage, so the model knows what it has not yet seen. The index costs about 28 MB per 1,000 messages and the image is 1.25 GB.
Mailboxes connect through add_mail_account. Passwords go to a browser form, not through the model; Gmail and Microsoft 365 use OAuth. The server exposes 22 annotated tools and is multi-tenant. Pre-1.0 releases run schema migrations on start, so pin a version.
Tools this server provides (2)
Taken from the project documentation; the running server may differ.
From the tool list in its README, going by the names, 1 of 2 tools deletes data and 1 changes data.
From the server's own tool labels and tool names; not verified by us.
- delete_mailName suggests: deletes
- Deletes mail matching a search in bulk.
- add_mail_accountName suggests: changes
- Connects a mailbox.
What it does
- Bulk mail actions
- Move, mark, delete and draft by search, not one message at a time.
- Own full-text index
- PostgreSQL GIN search across languages.
- Attachment search
- Indexes text from office files and scans with OCR.
- Coverage reporting
- Every search reports how much has been indexed.
- Password never to model
- Credentials go through a browser form.
- Auth modes
- Development, single-user bearer token or Google OAuth.
Good for
- Clear thousands of newsletters in one request
- Find a phrase inside an old PDF attachment
- Draft replies grounded in past messages
- Check how much of a mailbox is indexed
Pricing
Open source
Free to self-host; requires PostgreSQL and a container
mailindex-mcp FAQ
What do I need to run mailindex-mcp?
Docker and PostgreSQL; compose files are provided.
Is mailindex-mcp safe to expose?
Development mode has no auth and binds to loopback only.
How are credentials handled?
Use an app password through the browser form; keys are encrypted at rest.
Which mail providers?
IMAP and SMTP, Gmail OAuth, and Microsoft 365 or Exchange Online sign-in.
Is mailindex-mcp free?
Yes. mailindex-mcp is open source, so you can use and self-host it for free.
How do I add mailindex-mcp to Claude Code?
Run this command in your terminal: claude mcp add mailindex-mcp --env EMAILSERVER_DATABASE_URL='<EMAILSERVER_DATABASE_URL>' --env EMAILSERVER_API_TOKEN='<EMAILSERVER_API_TOKEN>' --env CREDENTIAL_ENCRYPTION_KEY='<CREDENTIAL_ENCRYPTION_KEY>' -- docker run -i --rm -e EMAILSERVER_DATABASE_URL -e EMAILSERVER_API_TOKEN -e CREDENTIAL_ENCRYPTION_KEY ghcr.io/alexanderkrauck/mailindex-mcp:0.3.3
What are the best alternatives to mailindex-mcp?
The closest alternatives to mailindex-mcp are TrendRadar, Ha MCP, Concord MCP, TryPost and Open Sunsama.
Where this comes from
- Description: written from the project's README.
- Install steps: from the official MCP Registry entry.

