# mailindex-mcp

> mailindex-mcp is an open-source MCP server for communication. Self-hosted mail index that lets an agent search, move, delete and draft email in bulk. It runs as a hosted remote server, so there is nothing to install locally.

- **Kind:** MCP server
- **Pricing:** Open source
- **Platforms:** Self-hosted, API
- **Repository:** https://github.com/alexanderkrauck/mailindex-mcp
- **MCP Registry name:** io.github.alexanderkrauck/mailindex-mcp
- **Categories:** [communication](https://ai-powered.com/categories/communication), [productivity](https://ai-powered.com/categories/productivity)
- **Listing updated:** 2026-11-23

## About

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.

## Features

- **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

## Install

### Claude Code: Add with the CLI (Terminal)

```sh
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
```

Add --scope user to use it in every project, or --scope project to share it in .mcp.json.

### Claude Code: Or share it with your project (.mcp.json)

```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>"
      }
    }
  }
}
```

### Claude Desktop (claude_desktop_config.json)

```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.

### Cursor (~/.cursor/mcp.json)

```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.

### VS Code (~/.copilot/mcp-config.json)

```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.

### Codex: Add with the CLI (Terminal)

```sh
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.3
```

### Codex: Or add to config.toml (~/.codex/config.toml)

```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>" }
```

### Gemini CLI and Antigravity: Gemini CLI (~/.gemini/settings.json)

```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

### Gemini CLI and Antigravity: Antigravity (~/.gemini/config/mcp_config.json)

```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 (~/.config/devin/mcp_config.json)

```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 (cline_mcp_settings.json)

```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 (Zed settings.json)

```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 (Settings → Tools → AI Assistant → Model Context Protocol (MCP) → Add)

```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>"
      }
    }
  }
}
```

The AI Assistant docs only show command and args. If the env block is ignored, use Junie for this server.

### JetBrains AI Assistant and Junie: Junie (~/.junie/mcp/mcp.json)

```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 (~/.kiro/settings/mcp.json)

```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.

### Other clients (your client's MCP settings (most use this shape))

```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>"
      }
    }
  }
}
```

## Tools

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_mail` (name suggests: deletes): Deletes mail matching a search in bulk.
- `add_mail_account` (name suggests: changes): Connects a mailbox.

## 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.

## Alternatives

- [TrendRadar](https://ai-powered.com/mcp/trendradar): TrendRadar is an open-source MCP server for communication.
- [Ha MCP](https://ai-powered.com/mcp/ha-mcp): Ha MCP is an open-source MCP server for productivity.
- [Concord MCP](https://ai-powered.com/mcp/concord-mcp): Concord MCP is a freemium MCP server for developer tools.
- [TryPost](https://ai-powered.com/mcp/trypost): TryPost is a paid MCP server for marketing and seo.
- [Open Sunsama](https://ai-powered.com/mcp/open-sunsama): Open Sunsama is an open-source MCP server for productivity.
- [Discord MCP](https://ai-powered.com/mcp/discord-mcp): Discord MCP is an open-source MCP server for communication.
- [Gmail MCP](https://ai-powered.com/mcp/gmail-mcp-3): Gmail MCP is an open-source MCP server for communication.
- [Dayfile.app](https://ai-powered.com/mcp/dayfile-app): Dayfile.app is an open-source MCP server for productivity.

---
Source: https://ai-powered.com/mcp/mailindex-mcp
