io.github.cyberpapiii/imessage-max

平台与服务

by cyberpapiii

面向 macOS 上 iMessage 的 AI 优化型 MCP server,可读取、搜索并发送消息。

什么是 io.github.cyberpapiii/imessage-max

面向 macOS 上 iMessage 的 AI 优化型 MCP server,可读取、搜索并发送消息。

README

<p align="center"> <img src="icon.png" alt="iMessage Max" width="128"> </p>

iMessage Max

A high-performance MCP (Model Context Protocol) server for iMessage that lets AI assistants read, search, and send your messages with proper contact resolution.

Built in Swift for native macOS integration - single binary, no runtime dependencies.

Distribution Status

The Swift binary is the primary supported distribution for current releases:

  • GitHub releases
  • Homebrew tap
  • local signed make install workflow

The Python package remains in the repository as a legacy/secondary path and should not be assumed to have feature parity with the Swift implementation.

Features

  • 12 Intent-Aligned Tools - Work the way you naturally ask questions, not raw database queries
  • Contact Resolution - See names instead of phone numbers via macOS Contacts
  • Smart Image Handling - Efficient image variants (vision/thumb/full) to avoid token bloat
  • Session Grouping - Messages grouped into conversation sessions with gap detection
  • Attachment Tracking - Know which images are available locally vs offloaded to iCloud
  • Native Performance - Swift with raw SQLite3, Core Image GPU acceleration
  • Read-Only Safe - Only reads from chat.db, send requires explicit permission

Why This Exists

Most iMessage tools expose raw database structures, requiring 3-5 tool calls per user intent. This MCP provides intent-aligned tools:

code
"What did Nick and I talk about yesterday?"
→ find_chat(participants=["Nick"]) + get_messages(since="yesterday")

"Show me photos from the group chat"
→ list_attachments(chat_id="chat123", type="image")

"Find where we discussed the trip"
→ search(query="trip")

Installation

Homebrew (Recommended)

bash
brew tap cyberpapiii/tap
brew install imessage-max

From Source

bash
git clone https://github.com/cyberpapiii/imessage-max.git
cd imessage-max/swift
swift build -c release

# Binary is at .build/release/imessage-max

Stable Dev Install Workflow

For local development, use the built-in make workflow in swift/ instead of manually rebuilding and re-granting permissions:

bash
cd swift
make setup-signing   # one-time: create persistent signing identity
make install         # build, sign, restart launchd service, verify health

Why this matters:

  • it signs the binary with a persistent local identity so Full Disk Access can persist across rebuilds
  • it replaces the release binary in place
  • it restarts the launchd-managed local.imessage-max service on port 8080
  • it verifies the service is healthy after install

Useful commands:

bash
cd swift
make status   # show process, signature, version, health
make restart  # restart the launchd service
make logs     # tail the stderr log
make clean    # remove debug artifacts and clear logs

Setup

1. Grant Full Disk Access

Required to read ~/Library/Messages/chat.db:

  1. Open System SettingsPrivacy & SecurityFull Disk Access
  2. Click + to add the binary

For Homebrew installs: The binary is at /opt/homebrew/Cellar/imessage-max/VERSION/bin/imessage-max (not the symlink at /opt/homebrew/bin/). Find it with:

bash
# Open the folder containing the actual binary
open $(dirname $(readlink -f $(which imessage-max)))

For source builds: Add .build/release/imessage-max from your clone directory.

Tip: In the file picker, press ⌘+Shift+G and paste the path to navigate directly.

2. Grant Contacts Access

Required for resolving phone numbers to names. The app will request access on first run, or add manually:

System SettingsPrivacy & SecurityContacts → add imessage-max

3. Configure Claude Desktop

Add to ~/Library/Application Support/Claude/claude_desktop_config.json:

For Homebrew:

json
{
  "mcpServers": {
    "imessage": {
      "command": "/opt/homebrew/Cellar/imessage-max/VERSION/bin/imessage-max"
    }
  }
}

For source builds:

json
{
  "mcpServers": {
    "imessage": {
      "command": "/path/to/imessage-max/swift/.build/release/imessage-max"
    }
  }
}

4. Restart Claude Desktop

The MCP should now appear in Claude's tools. You can verify with the diagnose tool.

Launchd Service

If you are running iMessage Max as a background HTTP service, the intended development path is the launchd-managed binary at:

~/Library/LaunchAgents/local.imessage-max.plist

That plist should point at:

/Users/YOU/.../imessage-max/swift/.build/release/imessage-max --http --port 8080

The make install workflow updates that binary in place and restarts the service cleanly.

Tools

find_chat

Find chats by participants, name, or recent content.

python
find_chat(participants=["Nick"])           # Find DM with Nick
find_chat(participants=["Nick", "Andrew"]) # Find group with both
find_chat(name="Family")                   # Find by chat name
find_chat(contains_recent="dinner plans")  # Find by recent content

get_messages

Retrieve messages with flexible filtering. Returns metadata for media.

python
get_messages(chat_id="chat123", limit=50)      # Recent messages
get_messages(chat_id="chat123", since="24h")   # Last 24 hours
get_messages(chat_id="chat123", from_person="Nick")  # From specific person

get_attachment

Retrieve image content by attachment ID with resolution variants.

python
get_attachment(attachment_id="att123")                 # Default: vision (1568px)
get_attachment(attachment_id="att123", variant="thumb") # Quick preview (400px)
get_attachment(attachment_id="att123", variant="full")  # Original resolution
VariantResolutionUse CaseToken Cost
vision (default)1568pxAI analysis, OCR~1,600 tokens
thumb400pxQuick preview~200 tokens
fullOriginalMaximum detailVaries

list_chats

Browse recent chats with previews.

python
list_chats(limit=20)          # Recent chats
list_chats(is_group=True)     # Only group chats
list_chats(since="7d")        # Active in last week

search

Full-text search across messages.

python
search(query="dinner")                    # Search all messages
search(query="meeting", from_person="Nick")  # From specific person
search(query="party", is_group=True)      # Only in group chats

get_context

Get messages surrounding a specific message.

python
get_context(message_id="msg_123", before=5, after=10)

get_active_conversations

Find chats with recent back-and-forth activity.

python
get_active_conversations(hours=24)
get_active_conversations(is_group=True, min_exchanges=3)

list_attachments

List attachments with metadata. Includes available field showing if file is on disk.

python
list_attachments(type="image", since="7d")
list_attachments(chat_id="chat123", type="any")

get_unread

Get unread messages or summary.

python
get_unread()                  # Unread from last 7 days
get_unread(since="24h")       # Last 24 hours
get_unread(mode="summary")    # Summary by chat

send

Send a message or file attachment (requires Automation permission for Messages.app).

python
send(to="Nick", text="Hey!")
send(chat_id="chat123", text="Running late")
send(chat_id="chat123", file_paths=["/path/save-the-date.jpg"])
send(to="Nick", file_paths=["/path/invite.png"], text="Save the date")

Rules:

  • Exactly one of to or chat_id
  • At least one of text or file_paths
  • If both are provided, files are sent first and text is sent last
  • reply_to is currently unsupported

Send result semantics:

  • status: "sent" means the message or attachment was confirmed successfully
  • status: "pending_confirmation" means Messages accepted an attachment send, but it was not confirmed as finished within the polling window
  • status: "failed" means the send failed
  • status: "ambiguous" means the target could not be resolved safely

Notes:

  • pending_confirmation is a normal non-fatal attachment state, not the same as a hard failure
  • exact chat sends target the existing conversation identified by chat_id

Examples:

  • {"status":"sent","success":true,...} means delivery was confirmed within the polling window
  • {"status":"pending_confirmation","success":false,...} means Messages accepted the attachment, but the MCP could not yet confirm final completion

diagnose

Troubleshoot configuration and permission issues.

python
diagnose()  # Returns: database status, contacts count, permissions, capabilities

HTTP Mode

For MCP Router, MCP Inspector, or other HTTP-based integrations:

bash
imessage-max --http --port 8080

Running as a Service (Recommended)

Create a launchd plist at ~/Library/LaunchAgents/local.imessage-max.plist:

xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>Label</key>
    <string>local.imessage-max</string>
    <key>ProgramArguments</key>
    <array>
        <string>/path/to/imessage-max</string>
        <string>--http</string>
        <string>--port</string>
        <string>8080</string>
    </array>
    <key>RunAtLoad</key>
    <true/>
    <key>KeepAlive</key>
    <true/>
    <key>StandardOutPath</key>
    <string>/Users/YOU/Library/Logs/imessage-max.stdout.log</string>
    <key>StandardErrorPath</key>
    <string>/Users/YOU/Library/Logs/imessage-max.stderr.log</string>
</dict>
</plist>

Then load it:

bash
launchctl load ~/Library/LaunchAgents/local.imessage-max.plist

MCP Router Integration

Add to MCP Router as a remote-streamable server:

sql
INSERT INTO servers (id, name, server_type, remote_url, auto_start, disabled, created_at, updated_at)
VALUES ('imessage', 'imessage', 'remote-streamable', 'http://127.0.0.1:8080', 1, 0, strftime('%s','now'), strftime('%s','now'));

Session Management

The HTTP transport supports clean reconnection:

  • Each client connection gets its own isolated session
  • Sessions auto-expire after 1 hour of inactivity
  • If MCP Router disconnects, it can reconnect seamlessly with a fresh session
  • No "Server already initialized" errors on reconnection

Troubleshooting

Contacts showing as phone numbers

Run diagnose to check status. If contacts_authorized is false:

  • Add the imessage-max binary to System Settings → Privacy & Security → Contacts

"Database not found" error

Add the imessage-max binary to System Settings → Privacy & Security → Full Disk Access

Images show "attachment_offloaded" error

Some attachments are stored in iCloud, not on disk. The list_attachments tool shows available: true/false for each attachment. To download offloaded attachments, open the conversation in Messages.app.

MCP not loading in Claude Desktop

  1. Check config file syntax is valid JSON
  2. Verify the binary path is correct
  3. Restart Claude Desktop completely (Cmd+Q)

Architecture

code
┌─────────────────┐     ┌─────────────────┐     ┌─────────────────┐
│  Claude/AI      │◄───►│  iMessage Max   │◄───►│  chat.db        │
│  Assistant      │     │  (Swift MCP)    │     │  (SQLite)       │
└─────────────────┘     └────────┬────────┘     └─────────────────┘
                                │
                                ▼
                        ┌─────────────────┐
                        │  Contacts.app   │
                        │  (CNContactStore)│
                        └─────────────────┘

Requirements

  • macOS 13+ (Ventura or later)
  • Full Disk Access permission
  • Contacts permission (for name resolution)
  • Automation permission for Messages.app (send only)

Development

bash
cd swift
swift build           # Debug build
swift build -c release  # Release build
swift test            # Run tests

License

MIT

常见问题

io.github.cyberpapiii/imessage-max 是什么?

面向 macOS 上 iMessage 的 AI 优化型 MCP server,可读取、搜索并发送消息。

相关 Skills

MCP构建

by anthropics

Universal
热门

聚焦高质量 MCP Server 开发,覆盖协议研究、工具设计、错误处理与传输选型,适合用 FastMCP 或 MCP SDK 对接外部 API、封装服务能力。

想让 LLM 稳定调用外部 API,就用 MCP构建:从 Python 到 Node 都有成熟指引,帮你更快做出高质量 MCP 服务器。

平台与服务
未扫描114.1k

Slack动图

by anthropics

Universal
热门

面向Slack的动图制作Skill,内置emoji/消息GIF的尺寸、帧率和色彩约束、校验与优化流程,适合把创意或上传图片快速做成可直接发送的Slack动画。

帮你快速做出适配 Slack 的动图,内置约束规则和校验工具,少踩上传与播放坑,做表情包和演示都更省心。

平台与服务
未扫描114.1k

MCP服务构建器

by alirezarezvani

Universal
热门

从 OpenAPI 一键生成 Python/TypeScript MCP server 脚手架,并校验 tool schema、命名规范与版本兼容性,适合把现有 REST API 快速发布成可生产演进的 MCP 服务。

帮你快速搭建 MCP 服务与后端 API,脚手架完善、扩展顺手,尤其适合想高效验证服务能力的开发者。

平台与服务
未扫描10.2k

相关 MCP Server

Slack 消息

编辑精选

by Anthropic

热门

Slack 是让 AI 助手直接读写你的 Slack 频道和消息的 MCP 服务器。

这个服务器解决了团队协作中需要 AI 实时获取 Slack 信息的痛点,特别适合开发团队让 Claude 帮忙汇总频道讨论或发送通知。不过,它目前只是参考实现,文档有限,不建议在生产环境直接使用——更适合开发者学习 MCP 如何集成第三方服务。

平台与服务
83.4k

by netdata

热门

io.github.netdata/mcp-server 是让 AI 助手实时监控服务器指标和日志的 MCP 服务器。

这个工具解决了运维人员需要手动检查系统状态的痛点,最适合 DevOps 团队让 Claude 自动分析性能数据。不过,它依赖 NetData 的现有部署,如果你没用过这个监控平台,得先花时间配置。

平台与服务
78.4k

by d4vinci

热门

Scrapling MCP Server 是专为现代网页设计的智能爬虫工具,支持绕过 Cloudflare 等反爬机制。

这个工具解决了爬取动态网页和反爬网站时的头疼问题,特别适合需要批量采集电商价格或新闻数据的开发者。不过,它依赖外部浏览器引擎,资源消耗较大,不适合轻量级任务。

平台与服务
35.4k

评论