Enables programmatic interaction with Apple Mail on macOS, allowing for listing accounts and mailboxes, fetching recent, unread, or flagged emails, and searching for messages by sender or subject.
Allows for managing and retrieving email content from iCloud accounts configured within the Apple Mail application.
Click on "Install 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., "@JXA Mail MCPShow me my 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.
JXA Mail MCP
A fast MCP (Model Context Protocol) server for Apple Mail, using optimized JXA (JavaScript for Automation) scripts with batch property fetching for 87x faster performance.
Features
list_accounts - List all configured email accounts
list_mailboxes - List mailboxes for an account
get_emails - Fetch emails from any mailbox with pagination
get_todays_emails - Fetch all emails received today
get_unread_emails - Fetch unread emails
get_flagged_emails - Fetch flagged emails
search_emails - Search emails by subject or sender
Installation
With pipx (recommended)
From source
Requires Python 3.13+ and uv:
Usage
Add to Claude Code
After installing with pipx:
Or from source:
Run directly
Configuration
Set default account and mailbox via environment variables:
Or in Claude Code config:
Test in Python
Architecture
Design Principles
Separation of concerns: Python handles logic/types, JavaScript handles Mail.app interaction
Builder pattern:
QueryBuilderconstructs optimized JXA scripts programmaticallyShared JS library:
mail_core.jsprovides reusable utilities injected into all scriptsType safety: Python type hints ensure correct usage
Performance
The Problem
Naive AppleScript/JXA iteration is extremely slow:
Each property access triggers a separate Apple Event IPC round-trip.
The Solution: Batch Property Fetching
JXA supports fetching a property from all elements at once:
Benchmark Results
Method | Time | Speedup |
AppleScript (per-message) | 54.1s | 1x |
JXA (per-message) | 53.9s | 1x |
JXA (batch fetching) | 0.62s | 87x |
Development
License
GPL-3.0-or-later