Skip to main content
Glama
Simple IMAP MCP Server

Simple IMAP MCP Server

by gfam-git

Simple IMAP MCP Server

A Node.js IMAP/SMTP MCP server that provides email operations via the Model Context Protocol.

Quick Start

# Install and run locally
npm install @adam-gfam/imap-server

# OR run without installing
npx -y @adam-gfam/imap-server

Related MCP server: Proton Mail MCP Server

Configuration

Copy .env.example to .env and fill in your IMAP/SMTP credentials. See the full Configuration Guide for details.

Usage

Once the server is running, it exposes the following tools, resources, and prompts via the MCP protocol.

Transport Modes

Mode

Use Case

Configuration

stdio

Claude Desktop, CLI tools, local agents

Default, no config needed

Streamable HTTP

Remote LLM clients, web dashboards

MCP_TRANSPORT=http, HTTP_PORT=3000

IMAP Tools

  • list_folders — List all IMAP mailboxes/folders. Parameters: folder_pattern, include_subfolders.

  • search_emails — Search emails by criteria (folder, from, to, subject, date, keyword, unread_only). Paginated results.

  • fetch_email — Fetch full email content including headers, body, and attachments by UID.

  • get_email_body — Fast body-only fetch (text and/or HTML) for a given UID.

  • get_email_headers — Minimal-bandwidth header fetch without downloading the body.

  • mark_as_read — Toggle read/unread status via IMAP FLAGS.

  • move_email — Move an email to a different IMAP folder (creates destination if needed).

  • delete_email — Delete an email (moves to Trash).

  • create_folder — Create a new IMAP mailbox folder (supports hierarchy like "Work/Projects").

  • list_unread — Quick listing of unread messages with pagination.

SMTP Tools

  • send_email — Send an email with text or HTML body. Supports to, subject, body, html, from, cc, bcc.

  • send_email_with_attachment — Send an email with file attachments ([{ name, content (base64), content_type }]).

  • list_drafts — List draft emails in the Drafts folder.

  • save_as_draft — Save an email as a draft (plain text or HTML).

  • delete_draft — Delete a draft email by UID.

MCP Resources

Resource

Description

URI Template

email_body

Parsed email body text

email://<folder>/<uid>/body

email_headers

Email headers

email://<folder>/<uid>/headers

MCP Prompts

Prompt

Description

Arguments

search_emails

"Help me search my emails"

query, date_range, folder

compose_reply

"Draft a reply to this email"

email_uid, tone

organize_inbox

"Help me organize my inbox"

criteria, folder

Documentation

All project documentation is hosted in the Simple IMAP MCP Project collective:

Contributing

All future design and technical documents must be created directly in the Nextcloud collective, not locally. The collective is the single source of truth for all project documentation.

Tech Stack

  • MCP Server: @modelcontextprotocol/server v2

  • IMAP: imapflow v1.7

  • SMTP: nodemailer v9

  • MIME Parser: mailparser v3.9

  • Schema: zod v4

  • Env: dotenv v17

Available Tools

16 tools
create_folderCreate FolderB

Create a new IMAP mailbox folder

Inputs: folder_name (required).

delete_draftDelete DraftC

Delete a draft email

Inputs: uid (required), folder.

delete_emailDelete EmailA

Delete an email (move to Trash folder)

Inputs: uid (required), folder.

email_waitingEmail Waiting (Polling)A

Poll a mailbox repeatedly until an email matching conditions is found or timeout elapses

Inputs: folder, timeout, conditions, poll_interval.

fetch_emailFetch EmailB

Fetch full email content including headers, body, and attachments

Inputs: uid (required), folder, include_body, include_attachments.

get_email_bodyGet Email BodyB

Fetch only the body (text and/or HTML) of an email

Inputs: uid (required), folder, text_only.

get_email_headersGet Email HeadersA

Fetch only email headers - minimal bandwidth, no body download

Inputs: uid (required), folder.

list_draftsList DraftsA

List draft emails in the Drafts folder

Inputs: limit, folder.

list_foldersList IMAP FoldersC

List all IMAP mailboxes/folders in the account

Inputs: folder_pattern, include_subfolders.

list_unreadList Unread MessagesB

Quick listing of unread messages with pagination

Inputs: limit, folder, offset.

mark_as_readMark as ReadB

Mark messages as read or unread using IMAP FLAGS

Inputs: uid (required), read (required), folder.

move_emailMove EmailA

Move an email to a different IMAP folder

Inputs: uid (required), to_folder (required), from_folder.

save_as_draftSave as DraftC

Save an email as a draft

Inputs: body (required), subject (required), cc, to, +1 more.

search_emailsSearch EmailsB

Search emails by criteria, returning paginated results

Inputs: to, from, limit, folder, +6 more.

send_emailSend EmailC

Send an email with text or HTML body

Inputs: to (required), body (required), subject (required), cc, +3 more.

send_email_with_attachmentSend Email with AttachmentC

Send an email with file attachments

Inputs: to (required), body (required), subject (required), attachments (required), +2 more.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    B3.3/5.0

    Scored across 16 tools

    Disambiguation4/5

    Each tool targets a distinct operation—full fetch, body-only, headers-only, flags, folder ops, drafts—but send_email and send_email_with_attachment, plus the three retrieval variants, have close functional boundaries that require careful description reading.

    Naming Consistency3/5

    Most names follow snake_case verb_noun, but verbs are inconsistent (fetch vs get vs list), list_unread omits the object, and email_waiting reverses the expected verb-object order.

    Tool Count4/5

    Sixteen tools is on the high end but each maps to a real email workflow—retrieve, search, send, draft, folder management—so the count is only slightly above the ideal range.

    Completeness4/5

    The surface covers retrieval, search, read state, move/delete, folder listing/creation, sending with and without attachments, and draft CRUD. Missing folder deletion/rename and attachment-only retrieval are minor gaps.

    Maintenance

    ActivitySlowing
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      C
      maintenance
      Enables AI assistants to send, read, search, and organize Proton Mail email via SMTP and IMAP through the Model Context Protocol.
      MIT
    • A
      license
      Not graded
      quality
      D
      maintenance
      Enables reading, searching, sending, replying, forwarding emails, and managing labels in Gmail through the Model Context Protocol.
      36 npm
      3
      MIT
    • F
      license
      Not graded
      quality
      B
      maintenance
      Enables reading and drafting emails via IMAP, including searching and managing drafts, through natural language.
      -