ABMIC
Provides tools for managing an iCloud Mail mailbox over IMAP/SMTP: list and search messages by query, sender, date range, or read status; send email (optionally from an alias and copied to Sent Messages); move, delete, and flag messages by IMAP UID; mark as read; download attachments; apply rule-based auto-organization by sender/subject; and list, create, and delete mailboxes including nested folders.
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., "@ABMIC search my inbox for unread emails from this week"
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.
ABMIC — A Better MCP Server for iCloud Mail and IMAP
A production-hardened Model Context Protocol (MCP) server for iCloud Mail, built for real-world use with AI agents like Claude. Manage thousands of emails reliably — search, move, flag, delete, and send — without crashes or data loss.
Forked from minagishl/icloud-mail-mcp — original work by minagishl. Thank you for the solid foundation!
Why ABMIC?
The original icloud-mail-mcp is a great starting point, but when used in production with large mailboxes (30,000+ emails) and AI agents performing bulk operations, several critical issues surface. ABMIC addresses all of them:
Critical Bug Fixes
Bug | Impact | Fix |
| Used | Now uses the provided UIDs directly with |
| Same | Now uses provided UIDs directly |
| Same bug — would delete all messages in the mailbox | Now uses provided UIDs with |
| IMAP box objects contain circular parent/children references | Added |
Performance & Stability Improvements
Improvement | Before | After |
Header-only fetching |
| Fetches only |
IMAP auto-reconnection | Connection drops between MCP calls caused silent failures |
|
Proper UID tracking | Message IDs used | All methods now return IMAP UIDs via |
Sorted results | Messages returned in arbitrary IMAP fetch order | Results sorted by date (most recent first) |
New Features
Feature | Description |
Email alias support | Send from an alias (e.g., |
Sent folder copy | Sent emails are automatically copied to the "Sent Messages" IMAP folder, so they appear in all mail clients |
Robust connection lifecycle | Dedicated |
Related MCP server: better-email-mcp
Installation
git clone https://github.com/zany92/abmic.git
cd abmic
npm install # or pnpm install
npm run buildConfiguration
Claude Desktop / Claude Code
Add to your MCP server configuration (claude_desktop_config.json):
{
"mcpServers": {
"icloud-mail": {
"command": "node",
"args": ["/path/to/abmic/dist/index.js"],
"env": {
"ICLOUD_EMAIL": "you@icloud.com",
"ICLOUD_APP_PASSWORD": "xxxx-xxxx-xxxx-xxxx",
"ICLOUD_SEND_FROM": "you@yourdomain.com"
}
}
}
}Environment Variables
Variable | Required | Description |
| Yes | Your iCloud email address (e.g., |
| Yes | App-specific password (generate one here) |
| No | Email alias to use as the "From" address when sending |
Prerequisites
An iCloud account with Mail enabled
Two-factor authentication enabled
An app-specific password (not your main iCloud password)
Available Tools
Email Operations
get_messages— List recent emails from any mailbox (headers only, fast)search_messages— Search by query, sender, date range, read statussend_email— Send emails (supports alias viaICLOUD_SEND_FROM)move_messages— Move emails between folders using IMAP UIDsdelete_messages— Delete specific emails by UIDset_flags— Add/remove flags (\Seen,\Flagged,\Deleted, etc.)mark_as_read— Shortcut to mark messages as readdownload_attachment— Download a specific attachment from a messageauto_organize— Apply rule-based organization (sender/subject matching)
Mailbox Management
get_mailboxes— List all IMAP folders (with nested subfolder support)create_mailbox— Create new folders (supports paths likeParent/Child)delete_mailbox— Delete folders (with system folder protection)
System
test_connection— Verify IMAP and SMTP connectivitycheck_config— Check environment variable configuration
Architecture
src/
index.ts # MCP server entry point, tool definitions
lib/
icloud-mail-client.ts # Core IMAP/SMTP client with all fixes
types/
config.ts # TypeScript type definitionsKey design decisions:
UID-based operations throughout — all message IDs are IMAP UIDs, not sequence numbers or Message-ID headers
Headers-only for listing/searching — full body fetch only when explicitly needed (attachments)
Defensive reconnection — every IMAP method calls
ensureConnected()before operatingNo circular references —
sanitizeBoxes()ensures JSON-safe mailbox listings
iCloud Mail Server Settings
Protocol | Server | Port | Security |
IMAP | imap.mail.me.com | 993 | TLS/SSL |
SMTP | smtp.mail.me.com | 587 | STARTTLS |
Development
npm run dev # Start with inspector
npm run build # Build to dist/
npm run typecheck # TypeScript checking
npm run test # Run tests (vitest)
npm run lint # ESLint
npm run format # PrettierCredits
This project is a fork of icloud-mail-mcp by minagishl, originally built during Hack Club's Summer of Making. The original project provided the MCP server scaffold, tool definitions, IMAP/SMTP integration, and test suite.
ABMIC extends it with production-critical fixes discovered while managing a 30,000+ email iCloud mailbox with Claude as an AI agent — including the UID bugs that could silently move or delete an entire mailbox, the OOM crashes from full-body fetching, and the connection reliability issues during long-running sessions.
License
MIT License — see LICENSE for details.
Copyright (c) 2025 Minagishl (original work), 2026 Vincent Picou (ABMIC modifications)
Available Tools
14 toolsauto_organizeB
Automatically organize emails based on rules (sender, subject keywords, etc.)
Inputs: rules (required), dryRun, sourceMailbox.
check_configB
Check if environment variables are properly configured
Inputs: no named parameters.
create_mailboxC
Create a new mailbox (folder)
Inputs: name (required).
delete_mailboxC
Delete an existing mailbox (folder)
Inputs: name (required).
delete_messagesC
Delete messages from a mailbox
Inputs: messageIds (required), mailbox.
download_attachmentC
Download an attachment from a specific message
Inputs: messageId (required), mailbox, attachmentIndex.
get_mailboxesB
List all available mailboxes
Inputs: no named parameters.
get_messagesC
Get email messages from specified mailbox
Inputs: limit, mailbox, unreadOnly.
mark_as_readC
Mark email messages as read
Inputs: messageIds (required), mailbox.
move_messagesC
Move messages between mailboxes
Inputs: messageIds (required), sourceMailbox (required), destinationMailbox (required).
search_messagesC
Search for messages using various criteria
Inputs: limit, query, dateTo, mailbox, +3 more.
send_emailC
Send an email through iCloud Mail
Inputs: to (required), subject (required), html, text.
set_flagsC
Set flags on messages (read, unread, flagged, etc.)
Inputs: flags (required), messageIds (required), action, mailbox.
test_connectionB
Test the email server connection (IMAP and SMTP)
Inputs: no named parameters.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 14 tools
Most tools target distinct resource+action pairs (mailboxes, messages, attachments, connection diagnostics). The main overlap is mark_as_read versus set_flags, which can both toggle read state, but the dedicated convenience tool is reasonably explained. auto_organize is also somewhat broad relative to move_messages, though its rule-based intent differentiates it.
All names are snake_case with a clear verb_noun pattern (get_messages, delete_mailbox, download_attachment), making the set easy to scan. Minor deviations like auto_organize and test_connection lack a resource noun, but the convention is otherwise uniform.
Fourteen tools fit an email client's scope well: message operations, mailbox management, attachments, and diagnostics. Each tool covers a distinct workflow rather than padding the surface.
Core lifecycle is covered: read, search, send, move, delete, flag, mailbox create/delete, and attachment download. Gaps include no mailbox rename, no reply/forward, and no attachment upload or single-message detail fetch, but agents can work around these via send_email with attachments and get_messages.
Maintenance
Related MCP Connectors
Email for AI agents: read, search and send from your Gmail, Outlook, Yahoo, iCloud or IMAP inbox.
Gmail, Outlook, iCloud, Fastmail and any IMAP mailbox for your agent. Scoped OAuth, approved sends.
Connect Gmail, iCloud Mail, Outlook, Yahoo Mail, Fastmail and other IMAP inboxes to ChatGPT, Claude and compatible AI assistants. Find emails by meaning across languages with semantic search. Ask AI to find customer conversations, summarize deadlines and draft follow-ups. Give a sales rep access to a shared outreach inbox or bring email into a compatible CRM. Share an iCloud custom-domain inbox with teammates without their own Apple ID or iCloud+ plan. Search results may be incomplete or stale; separate permissions control mail actions.
Email inboxes and calendars for AI agents: send, receive, search, draft and schedule.
Related MCP Servers
- AlicenseAqualityDmaintenanceEnables AI assistants to read, search, compose, and send emails by connecting to any IMAP/SMTP provider. It supports comprehensive mailbox management, including draft handling and message deletion, directly through natural language.10233 npm11MIT
- AlicenseNot gradedqualityNot gradedmaintenanceIMAP/SMTP email for AI agents -- read, send, organize folders, and manage attachments across multiple accounts, with auto-discovery.MIT
- AlicenseNot gradedqualityCmaintenanceEnables AI agents to read, search, send, and manage emails via IMAP/SMTP with OAuth 2.1 authentication, supporting folders, drafts, replies, and forwarding.1MIT
- AlicenseNot gradedqualityAmaintenanceEnables AI assistants to work with multiple email accounts over IMAP and SMTP: search, read, send, reply, forward, move, mark, and bulk-delete messages, plus list folders and check unread counts. Credentials are stored with AES-256 encryption and connections are pooled, with auto-configured settings for Gmail, Outlook, Yahoo, and other providers.1,009 npmMIT