EmailMCP
Enables unified email management across Gmail, Outlook, iCloud, and IMAP providers with tools for search, send, organize, and batch operations via natural language.
README
@marlinjai/email-mcp
A unified MCP server for email access across Gmail, Outlook, iCloud, and generic IMAP providers.
Features
- Multi-provider support -- Gmail (REST API), Outlook (Microsoft Graph), iCloud (IMAP), and generic IMAP/SMTP
- OAuth2 authentication -- Browser-based OAuth flows for Gmail and Outlook, with automatic token refresh
- Full email client -- Search, read, send, reply, forward, organize, and manage drafts
- Batch operations -- Delete, move, or mark hundreds of emails in a single call
- Lightweight search -- Compact search results by default (~20KB vs ~1.4MB) with optional full body retrieval
- Encrypted credential storage -- AES-256-GCM encryption at rest with machine-derived keys
- Provider-native APIs -- Uses Gmail API and Microsoft Graph where available for richer features, falls back to IMAP for universal compatibility
Installation
Install globally from npm:
npm install -g @marlinjai/email-mcp
Or run directly with npx (no install needed):
npx @marlinjai/email-mcp
Quick Start
- Run the interactive setup wizard to add your email accounts:
npx @marlinjai/email-mcp setup
The wizard will walk you through provider selection and authentication. After each account, it asks if you'd like to add another — so you can set up Gmail, Outlook, and iCloud all in one go.
- Add the server to your MCP configuration (
.mcp.json):
{
"mcpServers": {
"email": {
"command": "npx",
"args": ["@marlinjai/email-mcp"]
}
}
}
- Start using email tools in Claude Code — search your inbox, send emails, organize messages, and more.
Provider Setup Guides
Gmail
No configuration needed — the setup wizard handles everything using built-in OAuth credentials (PKCE):
npx @marlinjai/email-mcp setup
# Select "Gmail" when prompted
# A browser window opens for Google authorization
# Grant the requested permissions and return to the terminal
Note: If you prefer to use your own OAuth app, create a Desktop OAuth 2.0 Client in the Google Cloud Console with the Gmail API enabled.
Outlook
No configuration needed — the setup wizard handles everything using built-in OAuth credentials (PKCE):
npx @marlinjai/email-mcp setup
# Select "Outlook" when prompted
# A browser window opens for Microsoft authorization
# Sign in and grant the requested permissions
Note: If you prefer to use your own OAuth app, register one in the Azure Portal with
Mail.ReadWrite,Mail.Send, andoffline_accesspermissions.
iCloud
- Go to appleid.apple.com and sign in.
- Navigate to App-Specific Passwords and generate a new password.
- Run the setup wizard:
npx @marlinjai/email-mcp setup
# Select "iCloud" when prompted
# Enter your iCloud email address
# Enter the app-specific password you generated
Generic IMAP
Run the setup wizard with your IMAP/SMTP server details:
npx @marlinjai/email-mcp setup
# Select "Other IMAP" when prompted
# Enter your IMAP host, port, and credentials
# Optionally enter SMTP host and port for sending
Available Tools (25)
Account Management (4)
| Tool | Description |
|---|---|
email_list_accounts |
List all configured accounts with connection status |
email_add_account |
Add a new IMAP or iCloud account (Gmail/Outlook require setup wizard) |
email_remove_account |
Remove an account and its stored credentials |
email_test_account |
Test connection to an account |
Reading & Searching (5)
| Tool | Description |
|---|---|
email_list_folders |
List all folders/labels for an account |
email_search |
Search emails with filters. Returns compact results by default (returnBody=false). Set returnBody=true to include full email bodies |
email_get |
Get full email content by ID (headers, body, attachment metadata) |
email_get_thread |
Get an entire email thread/conversation |
email_get_attachment |
Download a specific attachment by ID (returns base64 data) |
Sending & Drafts (5)
| Tool | Description |
|---|---|
email_send |
Compose and send a new email (to, cc, bcc, subject, body) |
email_reply |
Reply to an email (supports reply-all, preserves threading) |
email_forward |
Forward an email to new recipients |
email_draft_create |
Save a draft without sending |
email_draft_list |
List all drafts |
Organization (8)
| Tool | Description |
|---|---|
email_move |
Move an email to a different folder. Supports sourceFolder for IMAP/iCloud |
email_transfer |
Move or copy emails between accounts, preserving the original message (sender, date, threading) via raw MIME transfer. deleteAfter=true trashes the source only after a confirmed import (safe cross-account move) |
email_delete |
Delete an email (trash or permanent). Supports sourceFolder for IMAP/iCloud |
email_mark |
Mark as read/unread, starred, or flagged. Supports sourceFolder for IMAP/iCloud |
email_label |
Add/remove labels (Gmail only) |
email_folder_create |
Create a new folder |
email_get_labels |
List all labels with counts (Gmail only) |
email_get_categories |
List all categories (Outlook only) |
Batch Operations (3)
| Tool | Description |
|---|---|
email_batch_delete |
Delete multiple emails at once (up to 1000 for Gmail, batches of 20 for Outlook, UID ranges for IMAP) |
email_batch_move |
Move multiple emails to a folder in a single call |
email_batch_mark |
Mark multiple emails read/unread, starred, or flagged at once |
All batch tools accept a sourceFolder parameter for IMAP/iCloud and include a sequential fallback for maximum compatibility.
Usage with Claude Code
Add the following to your .mcp.json file (project-level or global ~/.claude/.mcp.json):
{
"mcpServers": {
"email": {
"command": "npx",
"args": ["@marlinjai/email-mcp"]
}
}
}
Once configured, you can ask Claude to interact with your email:
- "Check my inbox for unread messages"
- "Search for emails from alice@example.com in the last week"
- "Reply to the latest email from Bob and thank him"
- "Move all newsletters to the Archive folder"
- "Delete all spam emails" (uses batch operations for speed)
- "Draft a follow-up email to the team about the meeting"
Development
# Install dependencies
pnpm install
# Build the project
pnpm build
# Run in development mode (watch for changes)
pnpm dev
# Run tests
pnpm test
# Run tests in watch mode
pnpm test:watch
# Run integration tests (requires real email accounts)
pnpm test:integration
License
MIT
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。