IMAP Mini MCP

IMAP Mini MCP

A lightweight MCP server for interacting with IMAP email accounts to read messages, manage folders, and compose draft replies. It supports standard providers and local bridges, providing tools for searching, fetching attachments, and organizing mailboxes without the ability to send or delete emails.

Category
Visit Server

README

IMAP Mini MCP

A lightweight MCP (Model Context Protocol) server for reading IMAP email and creating draft replies. Works with any standard IMAP server (Gmail, Outlook, Fastmail, etc.) and local bridges like ProtonMail Bridge.

All tools are read-only, except for draft creation — agents can compose and update drafts but cannot send or delete emails.

Workflow Recommendation

I highly recommend using a speech-to-text tool (e.g. SuperWhisper on Mac or Whisperflow on Windows) and connecting your AI desktop application (Claude, Codex, etc.) to this MCP server. That way you can converse with your email inbox using speech, which will dramatically speed up your workflow.

How to Use

Agent configuration

Add to your MCP client config (e.g. claude_desktop_config.json):

{
  "mcpServers": {
    "imap-mini-mcp": {
      "command": "node",
      "args": ["/path/to/imap-mini-mcp/dist/index.js"],
      "env": {
        "IMAP_HOST": "imap.example.com",
        "IMAP_USER": "you@example.com",
        "IMAP_PASS": "your-password"
      }
    }
  }
}

The args path must point to the built dist/index.js. Add any optional variables to the env block as needed.

Environment variables

Variable Required Default Description
IMAP_HOST yes IMAP server hostname (e.g. imap.gmail.com)
IMAP_USER yes Email address or username
IMAP_PASS yes Password or app-specific password
IMAP_PORT no 993 IMAP server port
IMAP_SECURE no true Use TLS for the connection
IMAP_STARTTLS no true Upgrade to TLS via STARTTLS (when IMAP_SECURE=false)
IMAP_TLS_REJECT_UNAUTHORIZED no true Reject self-signed TLS certificates

For most providers (Gmail, Outlook, Fastmail), the defaults work — just set host, user, and password.

For ProtonMail Bridge (localhost, self-signed cert, no TLS):

IMAP_HOST=127.0.0.1
IMAP_PORT=1143
IMAP_SECURE=false
IMAP_STARTTLS=false
IMAP_TLS_REJECT_UNAUTHORIZED=false

Tools

Listing emails

All list tools return {count, emails} where each email is {id, subject, from, date}, sorted newest-first. Optional mailbox parameter (default: "INBOX").

Addressing emails — Every email is identified by a composite id in the format YYYY-MM-DDTHH:mm:ss.<Message-ID> (e.g. 2026-02-12T14:30:25.<abc123@mail.example.com>). This identifier is globally unique and stable across folder moves — unlike IMAP UIDs which are folder-scoped. Use the id returned by any list_emails_* tool to fetch content, download attachments, move emails, or create reply drafts. Action tools accept an optional mailbox hint for faster lookup; if omitted, all folders are searched.

Tool Time range
list_emails_24h Last 24 hours
list_emails_7days Last 7 days
list_emails_month Last 30 days
list_emails_quarter Last 90 days
list_emails_year Last 365 days
list_emails_all All time

list_emails_from_domain

List all emails from a specific domain.

Parameter Type Required Description
domain string yes Domain to search for (e.g. "example.com")
mailbox string no Default: "INBOX"

Returns {count, emails}.

list_emails_from_sender

List all emails from a specific sender email address.

Parameter Type Required Description
sender string yes Sender email address (e.g. "alice@example.com")
mailbox string no Default: "INBOX"

Returns {count, emails}.

fetch_email_content

Fetch the full content of a single email by id.

Parameter Type Required Description
id string yes Email identifier from list results
mailbox string no Folder hint for faster lookup

Returns {id, subject, from, to, date, body, attachments}. The attachments array contains metadata only: {id, filename, contentType, size}.

fetch_email_attachment

Download a specific attachment from an email.

Parameter Type Required Description
id string yes Email identifier from list results
attachment_id string yes Attachment id from fetch_email_content
mailbox string no Folder hint for faster lookup

Returns {id, filename, contentType, size, contentBase64}.

list_folders

List all folders in the email account. Takes no parameters.

Returns {count, folders} where each folder is {path, name, delimiter}. Use the path value when specifying folders in other tools.

create_folder

Create a new folder.

Parameter Type Required Description
path string yes Full path of the folder (e.g. "INBOX/Receipts")

Returns {created} with the path of the created folder.

move_email

Move an email from one folder to another. The email is not deleted — it is atomically relocated.

Parameter Type Required Description
id string yes Email identifier
source_folder string no Folder hint for faster lookup
destination_folder string yes Folder to move the email to

Returns {id, destination}.

create_draft

Create a new email draft in the Drafts folder.

Parameter Type Required Description
to string yes Recipient email address
subject string yes Email subject line
body string yes Plain text email body
cc string no CC recipient(s)
bcc string no BCC recipient(s)
in_reply_to string no ID of email being replied to (for threading)

Returns {id, subject, to, date}. The Drafts folder is auto-detected via the \Drafts special-use attribute.

draft_reply

Create a reply draft to an existing email. Automatically derives recipient, subject, and threading headers from the original email.

Parameter Type Required Description
id string yes ID of the email to reply to
body string yes Plain text reply body
reply_all boolean no Include original To/CC as CC (default: false)
mailbox string no Folder hint for faster lookup

Returns {id, subject, to, date}.

update_draft

Replace an existing draft with new content. The id must refer to an email in the Drafts folder — this tool cannot modify emails in other folders.

Parameter Type Required Description
id string yes ID of the existing draft to replace
to string yes Recipient email address
subject string yes Email subject line
body string yes Plain text email body
cc string no CC recipient(s)
bcc string no BCC recipient(s)
in_reply_to string no ID of email being replied to (for threading)

Returns {id, subject, to, date}.

Development

Build and run

npm install
npm run build

Local development with .env

For running the server directly (outside of an MCP client), copy .env.example to .env and fill in your credentials, then:

npm start

When used through an MCP client, credentials are provided via the client config's env block instead.

Testing

Tests use vitest and mock the IMAP layer — no real server connection is needed:

npm test             # run once
npm run test:watch   # watch mode
npm run lint         # type-check only

License

MIT

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured