SuperAPIAI Directory

mail-mcp-server

github.com · AI developer platforms

mail-mcp-server is a read-only email MCP server (stdio) for AI agents, supporting on-premises Microsoft Exchange (via EWS and NTLM) and any IMAP mailbox (tested with Mail.ru and Gmail). It downloads emails to local storage in one go, converts message bodies and attachments (PDF, Office, ZIP, attached emails, .msg, winmail.dat) to Markdown, and builds a Lucene search index so agents can search text inside attachments, with support for Russian and English word forms. Read-only is enforced at the protocol level: write commands are rejected, and downloading emails does not mark them as read. Tools read only the local copy and do not connect to the mail server, so they can be used offline; synchronization runs only when the user requests it. Passwords can be stored in Windows Credential Manager, a password manager, or environment variables. Requires JDK 25 and pandoc 3.x; can also be launched using a Docker image or JBang. Version 0.1.1, developed and tested on Windows, licensed under Apache 2.0.

Open website Alternatives
PricingOpen source开源项目(可免费自部署)
PlatformsLinux

About this tool

Purpose

mail-mcp-server is an MCP (Model Context Protocol) server that connects to AI clients via stdio and provides AI agents with read-only access to mailboxes. It targets two types of mailboxes: on-premises Microsoft Exchange (via EWS and NTLM, using a regular domain password, with no Microsoft Graph required) and any IMAP mailbox that supports password login (tested with Mail.ru and Gmail).

Main capabilities

  • Read-only access: Read-only is enforced at the protocol level; write commands are rejected before being sent; downloading emails does not mark them as read.
  • Searchable attachments: Extracts and indexes text from PDF, Word, Excel, PowerPoint, ZIP archives, attached emails, Outlook .msg, and winmail.dat, so agents can find contract content inside attachments, not just the email that carries it.
  • Word-form-aware search: Supports Russian and English, covering subject, body, addresses, and attachments; duplicates of the same email appear only once, and conversations can be tracked across folders.
  • Local copy and offline use: During synchronization, emails are downloaded in one go, converted to Markdown on the local machine, and indexed with Lucene; tools read only the local copy and do not connect to the mail server, so answers do not depend on the mail server and can be used offline. Synchronization runs only when the user requests it.
  • Multiple mailbox support: One server can be configured with multiple mailboxes; passwords can be stored in Windows Credential Manager, a password manager, or environment variables, and literal passwords can also be used.
  • Account protection: Each synchronization logs in only once and does not retry; after a password is rejected, attempts stop until the user corrects it, reducing the risk of domain account lockout.
  • Privacy: There is no proprietary cloud service; conversion and indexing are done locally; the local copy is unfiltered, and the AI client will still see the content returned by tools; an optional secret filter can mask passwords and verification codes in responses.

Usage

  1. Install JDK 25 and pandoc 3.x (pandoc is required and must be in PATH).
  2. Get the jar: download mail-mcp-server.jar from the latest release, or build it yourself. If there is no local JDK or pandoc, you can use a Docker image ghcr.io/igorolv/mail-mcp-server (with fewer password storage options); it can also be launched with JBang:jbang --quiet mail-mcp-server@igorolv/mail-mcp-server(pandoc is still required).
  3. In %USERPROFILE%\.mail-mcp-server\connections.json(on other platforms it is ~/.mail-mcp-server/connections.json)Add one record for each mailbox in (), specifying the password source (Windows Credential Manager, a command that prints the password, an environment variable, or a literal password).
  4. Register the server in the MCP client, using the absolute path to the jar (e.g., Claude Code).
  5. Ask the agent to perform synchronization. The first sync downloads the entire mailbox, which may take a long time, so keep the client open; if interrupted, you can ask it to resume. For large mailboxes or when you need to view progress in the terminal, use mail-sync.
  6. Test by asking the agent questions, such as "Which mailboxes can you read?" or "Find the email about the supply contract in the work mailbox from last week."

Except for listConnections, every tool requires a connection parameter. Offline maintenance, login recovery, and Gmail OAuth2 authorization are performed via commands in the terminal.

Use Cases

Read-only scenarios in which an AI agent needs to retrieve content from local Exchange or IMAP mailboxes, especially where text inside attachments (contracts, reports, etc.) needs to be searched; environments that require data localization and do not want emails to pass through third-party cloud services.

Limitations

  • Version 0.1.1, developed and tested on Windows.
  • Requires JDK 25 and pandoc 3.x; the Docker approach supports fewer password storage methods.
  • Read-only; mailboxes cannot be modified.
  • The first sync must download the entire mailbox, which takes a long time.
  • The local copy is unfiltered, and AI clients can see the content returned by the tool.
  • Building requires the JDK 25 toolchain; tests do not connect to real mail servers.

Tech Stack and License

Java 25, Gradle 9, Spring Boot 4.2.0-RC1, Spring AI 2.1.0-RC1 MCP server (stdio), Apache HttpClient 5.6.5, Eclipse Angus Mail 2.0.5, Apache Lucene 10.5.2, pandoc 3.x, Apache PDFBox 3.0.5, Apache POI 5.4.1. Licensed under the Apache License 2.0.

Up/Down to navigate · Enter to open · ESC to closeBrowse all tools