imap-mcp-server
Provides tools to read and manage a CalDAV calendar, tested with Nextcloud: list calendars and events, and create, update, and delete events.
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
imap-mcp-server
An MCP server that gives AI assistants (Claude, Grok, Gemini and any other MCP client) a real work mailbox: any IMAP/SMTP account, plus an optional CalDAV calendar. It was built for day-to-day export sales work on a regular hosted mailbox, with no Gmail or Microsoft 365 API involved, and it has been in production use every day since 2026.
It runs over stdio (local) or Streamable HTTP (self-hosted, always on), and also exposes a small REST API, so tools that don't speak MCP (Google Apps Script, n8n, cron jobs) can send mail through the same account.
Tools
Tool | What it does |
| Browse the folder tree one level at a time |
| Search by text, sender, subject, date range, unread |
| Read a message (text + HTML + attachment list) |
| Fetch an attachment (text files returned inline, up to 500 KB) |
| Send, and save a copy in the Sent folder (SMTP doesn't do that by itself) |
| Save a draft instead of sending, for human review |
| Reply in the same thread: |
| Same as reply, but as a draft, with optional attachments and an |
| Move messages between folders (fails clearly if the folder doesn't exist) |
| Read a CalDAV calendar (tested with Nextcloud) |
| Manage events |
Related MCP server: IMAP MCP Server
What makes it different
Drafts first. Agents can prepare replies in the right thread and leave them in Drafts for a human to approve. That's the safe default for anything client-facing.
Replies look like a human wrote them. Same thread, the right recipients (replying to your own last message goes to the people you wrote to, never back to you), history quoted below like Outlook.
Consistent formatting and signature. Plain-text bodies are turned into Outlook-like HTML (one
<p style="margin:0">per line) and your HTML signature is added if the caller forgot it. Signature images can be embedded inline (cid:) so Outlook doesn't block them.Meeting invites. Reply drafts can carry an
.icsinvite with Accept/Decline buttons.Sent folder kept in sync. Messages sent over SMTP are appended to Sent via IMAP.
Quick start
git clone https://github.com/kibakuryuuzaki/imap-mcp-server.git
cd imap-mcp-server
npm install
npm run build
cp .env.example .env # fill in your mailboxLocal (stdio)
{
"mcpServers": {
"email": {
"command": "node",
"args": ["/path/to/imap-mcp-server/dist/mcp-server/index.js"],
"env": {
"EMAIL_USER": "you@example.com",
"EMAIL_PASS": "your-password",
"IMAP_HOST": "imap.example.com",
"SMTP_HOST": "smtp.example.com"
}
}
}
}To keep the password out of the JSON file, start it through env_launcher.mjs instead.
Self-hosted (HTTP)
MCP_HTTP_PORT=8766 MCP_AUTH_TOKEN=long-random-string node dist/mcp-server/http-server.jsMCP endpoint:
POST /mcp?token=<MCP_AUTH_TOKEN>Health check:
GET /healthPut it behind HTTPS (Caddy, nginx, Cloudflare Tunnel) before exposing it.
REST API (optional)
Enabled when SEND_API_TOKEN is set. Every call needs Authorization: Bearer <SEND_API_TOKEN>.
Route | Body / query | Does |
|
| Sends (max 10 attachments, 20 MB) |
| same as | Saves a draft |
|
| Draft reply in the thread |
| — | Sent messages with recipients (read-only) |
Configuration
Variable | Required | Default | Meaning |
| ✅ | — | Mailbox login |
| ✅ | — | Mail servers |
|
| TLS ports | |
|
| Exact folder paths on your server (e.g. | |
| — | Sender display name | |
|
| How the "Sent:" date is written in quoted replies | |
|
| Font for generated HTML bodies | |
| — | HTML signature added to drafts and replies | |
| first 60 chars of the signature | Text that shows the signature is already in the body | |
| — | Sign-off lines to drop before adding the signature, regex alternatives (e.g. | |
| — | Signature images under this URL are embedded inline from | |
|
| Folder with the signature images | |
|
| Offset for meeting-invite times | |
| for calendar tools | — | e.g. |
| the email login | CalDAV login | |
| first calendar | Default calendar name | |
|
| Calendar time zone (fixed offset; DST zones not supported yet) | |
| for HTTP | — | Port of the HTTP server |
| — | Token required on | |
| — | Turns on the REST API |
Safety notes
Ask your agent to draft, not send, for anything that goes to customers.
Use an app password if your provider supports one.
Never commit
.env; it's in.gitignore.
License
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
Email infrastructure for AI agents — send, receive, search, and reply to email over MCP.
Email inboxes for AI agents: read, search, send, reply, calendar invites. Hosted MCP with OAuth.
Email and optional phone for AI agents: send, receive, search, draft and call over MCP.
Hosted email MCP for your own Gmail, Outlook.com, Microsoft 365, iCloud or IMAP inbox: read, search, draft, reply in thread, forward and file mail. It moves or flags up to 500 messages in one call, and a send leaves exactly one copy in Sent. A calendar is a separate connection, and connecting one adds diary and scheduling tools.
Related MCP Servers
- AlicenseNot gradedqualityCmaintenanceConnects MCP-compatible AI assistants to any IMAP/SMTP mailbox, enabling email search, reading, folder management, and sending with automatic saving to Sent.1MIT
- AlicenseNot gradedqualityAmaintenanceEnables AI assistants to search, read, send, reply to, forward, organize, and bulk-delete email across multiple IMAP/SMTP mailboxes, with AES-256-encrypted credential storage, connection pooling, and folder management. Supports 15+ pre-configured providers and simultaneous multi-account access from any MCP client.796 npmMIT
- AlicenseNot gradedqualityAmaintenanceEnables AI assistants to read, search, send, manage, schedule, and analyze email across multiple IMAP/SMTP accounts through a single MCP server. Also supports drafts and templates, provider-aware labels and bulk operations, calendar extraction, real-time mailbox watching, and OAuth2 sign-in for Gmail and Microsoft 365.31 npmISC
- AlicenseNot gradedqualityBmaintenanceEnables AI agents to work with existing IMAP/SMTP mailboxes through a native MCP endpoint, with granular token scopes for reading, searching, organizing, drafting, sending, and managing folders plus optional AI-assisted summaries and replies. Drafts are saved to real IMAP Drafts folders, and permissions are enforced by the shared mail engine.AGPL 3.0