iCloud Email MCP Server

iCloud Email MCP Server

A Model Context Protocol (MCP) server that enables Claude Desktop to interact with iCloud email accounts. This server provides full email functionality including reading, sending, and managing emails through your iCloud account.

Category
访问服务器

README

iCloud Email MCP Server

A Model Context Protocol (MCP) server that enables Claude Desktop to interact with iCloud email accounts. This server provides full email functionality including reading, sending, and managing emails through your iCloud account.

Features

  • Read emails from any folder while preserving unread status
  • Send emails with support for CC recipients and attachments
  • List email folders and navigate mailboxes
  • Create new folders for email organization
  • Move emails between folders
  • Search emails across your mailbox
  • Manage read/unread status explicitly when desired
  • Filter unread emails specifically
  • Test connections and server health

Prerequisites

  • iCloud account with App-Specific Password enabled
  • Docker installed on your system
  • Claude Desktop configured for MCP servers

Setup

1. Generate iCloud App-Specific Password

  1. Sign in to appleid.apple.com
  2. Go to Sign-In and Security > App-Specific Passwords
  3. Generate a new password for "Email MCP Server"
  4. Save this password - you'll need it for configuration

2. Clone and Configure

git clone https://github.com/Lawiak/icloud-mcp.git
cd icloud-mcp

Create your environment file:

cp .env.example .env
nano .env

Configure your credentials in .env:

ICLOUD_USERNAME=your.email@icloud.com
ICLOUD_APP_PASSWORD=your-app-specific-password

3. Build Docker Container

docker build -t icloud-mcp-server:latest .

4. Configure Claude Desktop

Edit your Claude Desktop configuration file:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%\Claude\claude_desktop_config.json

Add the MCP server configuration:

{
  "mcpServers": {
    "icloud-email": {
      "command": "docker",
      "args": [
        "run", "-i", "--rm",
        "--env-file", "/path/to/your/icloud-mcp/.env",
        "icloud-mcp-server:latest",
        "python", "server.py"
      ]
    }
  }
}

For remote deployment (e.g., Raspberry Pi), use SSH:

{
  "mcpServers": {
    "icloud-email": {
      "command": "ssh",
      "args": [
        "user@your-server-ip",
        "docker", "run", "-i", "--rm",
        "--env-file", "/path/to/icloud-mcp/.env",
        "icloud-mcp-server:latest",
        "python", "server.py"
      ]
    }
  }
}

5. Restart Claude Desktop

Close and restart Claude Desktop to load the new MCP server configuration.

Usage

Once configured, you can ask Claude Desktop to:

  • "Read my latest emails" (preserves unread status, shows preview)
  • "Read my emails with full content" (complete email bodies)
  • "Read email ID 123 in full" (complete content of specific email)
  • "Show me only my unread emails"
  • "Send an email to john@example.com with subject 'Meeting' and message 'Hello!'"
  • "Send an email with attachments" (using base64-encoded content)
  • "Send an email with files from local paths" (if files are accessible)
  • "Mark email ID 123 as read"
  • "Mark email ID 456 as unread"
  • "Show me my email folders"
  • "Move email ID 123 from INBOX to Archive"
  • "Create a new folder called 'Projects'"

Email Content Options

Preview Mode (default): Email bodies are truncated to 200 characters for quick scanning.

Full Content Mode: Get complete email content including:

  • Full text and HTML body content
  • Attachment information (filename, type, size)
  • Complete recipient details (To, CC, BCC)
  • Additional email headers
  • All content without truncation

Email Attachments

Sending Attachments: The server supports multiple methods for sending attachments:

  1. Base64-encoded content: For programmatic use or when you have file data

    • Supports all file types (PDFs, images, documents, etc.)
    • 25MB size limit per attachment
    • Automatic MIME type detection
  2. Local file paths: For files accessible to the Docker container

    • Requires files to be in mounted volumes for Docker deployment
    • Automatic file validation and encoding

Attachment formats: Text files, PDFs, images, office documents, archives, etc.

Unread Status Management

Important: This server preserves your email's unread status by default. When Claude Desktop reads emails, they remain unread in your iCloud account unless you explicitly ask to mark them as read.

Server Configuration

iCloud Email Settings

  • IMAP Server: imap.mail.me.com:993 (SSL)
  • SMTP Server: smtp.mail.me.com:587 (StartTLS)

Environment Variables

  • ICLOUD_USERNAME: Your iCloud email address
  • ICLOUD_APP_PASSWORD: App-specific password from Apple ID

Troubleshooting

Connection Issues

  1. Verify your App-Specific Password is correct
  2. Ensure two-factor authentication is enabled on your Apple ID
  3. Check that the Docker container can access the internet

Claude Desktop Issues

  1. Check Claude Desktop logs for connection errors
  2. Verify the file paths in your configuration are correct
  3. Ensure Docker is running and accessible

Testing the Server

# Test Docker container directly
docker run --rm --env-file .env icloud-mcp-server:latest python -c "
from server import test_email_connection
print('Connection test completed')
"

Security Notes

  • App-Specific Passwords are safer than your main iCloud password
  • Keep your .env file secure and never commit it to version control
  • The Docker container runs as a non-root user for security
  • All email communication uses encrypted connections (SSL/TLS)

Architecture

This MCP server uses:

  • FastMCP for Model Context Protocol implementation
  • Python imaplib/smtplib for email operations
  • Docker for containerized deployment
  • STDIO transport for Claude Desktop communication

License

This project is open source and available under the MIT License.

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选