Simple IMAP MCP Server
This server is an MCP email assistant that lets you read, search, send, and organize email over IMAP/SMTP.
Search & list emails — search by folder, sender, recipient, subject, date, keyword, or unread status, with pagination.
Fetch email content — retrieve full emails, body-only, or headers by UID.
Manage messages — mark read/unread, move between folders, delete to Trash, and create folders.
Send email — send plain-text or HTML emails, with optional attachments, CC/BCC, and sender override.
Handle drafts — list, save, and delete draft emails.
Wait for emails — poll a mailbox until an email matching conditions arrives or a timeout is reached.
Expose MCP resources & prompts — email body/headers resources, plus prompts for searching, composing replies, and organizing the inbox.
Flexible transport — runs over stdio or Streamable HTTP.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Simple IMAP MCP Server check my inbox for unread emails from today"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
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-serverRelated 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 |
|
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_headers | Email 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:
Project Overview — Architecture, tech stack, project structure
API Reference — Complete tool and resource API docs
Source Code Index — Source file inventory
Configuration Guide — Env vars, installation, setup
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/serverv2IMAP:
imapflowv1.7SMTP:
nodemailerv9MIME Parser:
mailparserv3.9Schema:
zodv4Env:
dotenvv17
Available Tools
16 toolscreate_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
Scored across 16 tools
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.
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.
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.
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
Related MCP Connectors
Email infrastructure for AI agents — send, receive, search, and reply to email over MCP.
Email and optional phone for AI agents: send, receive, search, draft and call over MCP.
Email for AI agents: read, search and send from your Gmail, Outlook, Yahoo, iCloud or IMAP inbox.
Give AI agents their own email inboxes: list, read and send mail via scoped, revocable OAuth grants.
Related MCP Servers
- FlicenseNot gradedqualityDmaintenanceEnables AI agents to read, filter, send emails, and check unread counts via the Model Context Protocol using Gmail SMTP/IMAP.-
- AlicenseNot gradedqualityCmaintenanceEnables AI assistants to send, read, search, and organize Proton Mail email via SMTP and IMAP through the Model Context Protocol.MIT
- AlicenseNot gradedqualityDmaintenanceEnables reading, searching, sending, replying, forwarding emails, and managing labels in Gmail through the Model Context Protocol.36 npm3MIT
- FlicenseNot gradedqualityBmaintenanceEnables reading and drafting emails via IMAP, including searching and managing drafts, through natural language.-