Skip to main content

Intent-aligned MCP server for iMessage

Project description

iMessage Max

iMessage Max

An MCP (Model Context Protocol) server for iMessage that lets AI assistants read and search your messages with proper contact resolution.

Features

  • Contact Resolution - See names instead of phone numbers (resolves via macOS Contacts)
  • Participant Lookup - Find chats by typing names like find_chat(participants=["Nick", "Andrew"])
  • Session Grouping - Messages grouped into conversation sessions with gap detection
  • Token Efficient - Designed for AI consumption with compact responses and pagination
  • Read-Only Safe - Only reads from chat.db, never modifies your messages

Why This Exists

Most iMessage tools expose raw database structures, requiring 3-5 tool calls per user intent. This MCP provides intent-aligned tools that work the way you'd naturally ask questions:

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

"Show me recent group chats"
→ list_chats(is_group=True)

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

Installation

Desktop Extension (Recommended)

One-click install with icon support in Claude Desktop:

Prerequisites: UV must be installed first:

curl -LsSf https://astral.sh/uv/install.sh | sh
  1. Download imessage-max.mcpb
  2. Double-click to install, or drag into Claude Desktop
  3. Grant permissions when prompted (see Setup)

From PyPI

pip install imessage-max

Using UV

# Install UV if you haven't
curl -LsSf https://astral.sh/uv/install.sh | sh

# Install imessage-max
uv pip install imessage-max

From Source

pip install git+https://github.com/cyberpapiii/imessage-max.git

Setup

1. Grant Permissions

The MCP needs two macOS permissions to work properly:

Full Disk Access (Required)

Allows reading ~/Library/Messages/chat.db

  1. Open System SettingsPrivacy & SecurityFull Disk Access
  2. Click + and add your terminal app (Terminal.app, iTerm, Warp, etc.)
  3. If using Claude Desktop, add the process that runs Python:
    • For UV: Add /Users/YOU/.local/share/uv/python/ (or find it with which python)

Contacts Access (Required for name resolution)

Allows resolving phone numbers to contact names

  1. Open System SettingsPrivacy & SecurityContacts
  2. Add the same apps/processes as above
  3. Important: If using UV, you need to add UV itself (~/.cargo/bin/uv or similar)

2. Configure Claude Desktop

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

{
  "mcpServers": {
    "imessage": {
      "command": "uvx",
      "args": ["imessage-max"]
    }
  }
}

Or if installed via pip:

{
  "mcpServers": {
    "imessage": {
      "command": "imessage-max"
    }
  }
}

3. Restart Claude Desktop

The MCP will request Contacts access on first run if not already granted.

Tools

find_chat

Find chats by participants, name, or recent content.

# Find a DM by contact name
find_chat(participants=["Nick"])

# Find a group chat with multiple people
find_chat(participants=["Nick", "Andrew"])

# Find a named group chat
find_chat(name="Family")

# Find chat where you discussed something recently
find_chat(contains_recent="dinner plans")

get_messages

Retrieve messages with flexible filtering.

# Get recent messages from a chat
get_messages(chat_id="chat123", limit=50)

# Get messages from the last 24 hours
get_messages(chat_id="chat123", since="24h")

# Get only messages from a specific person
get_messages(chat_id="chat123", from_person="Nick")

# Get messages containing specific text
get_messages(chat_id="chat123", contains="flight")

list_chats

Browse recent chats with previews.

# List recent chats
list_chats(limit=20)

# List only group chats
list_chats(is_group=True)

# List chats active in the last week
list_chats(since="7d")

search

Full-text search across all messages.

# Search all messages
search(query="dinner")

# Search messages from a specific person
search(query="dinner", from_person="Nick")

# Search with time bounds
search(query="meeting", since="2024-01-01", before="2024-02-01")

# Search only in group chats
search(query="party", is_group=True)

get_context

Get messages surrounding a specific message.

# Get context around a message
get_context(message_id="msg123", before=5, after=10)

# Find message containing text and get context
get_context(chat_id="chat123", contains="that link", before=3, after=5)

get_active_conversations

Find chats with recent back-and-forth activity.

# Find active conversations in the last 24 hours
get_active_conversations(hours=24)

# Find active group conversations
get_active_conversations(is_group=True, min_exchanges=3)

list_attachments

List attachments with metadata.

# List recent attachments
list_attachments(limit=20)

# List images from a specific chat
list_attachments(chat_id="chat123", type="image")

# List attachments from a specific person
list_attachments(from_person="Nick", type="any")

get_unread

Get unread messages or summary.

# Get all unread messages
get_unread()

# Get unread summary by chat
get_unread(format="summary")

# Get unread from specific chat
get_unread(chat_id="chat123")

send

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

# Send to a contact
send(to="Nick", text="Hey, are we still on for dinner?")

# Send to a group chat
send(chat_id="chat123", text="Running 5 minutes late")

diagnose

Troubleshoot configuration and permission issues.

# Check setup
diagnose()
# Returns: pyobjc_available, contacts_authorized, contacts_loaded count

Troubleshooting

Contacts showing as phone numbers

Run the diagnose tool to check status:

{
  "pyobjc_available": true,
  "contacts_authorized": false,
  "authorization_status": "not_determined"
}

Fix: Add your Python interpreter or UV to System Settings → Privacy & Security → Contacts.

"Database not found" error

The MCP can't access ~/Library/Messages/chat.db.

Fix: Add your terminal/Python to System Settings → Privacy & Security → Full Disk Access.

Empty message previews

Some messages store text in attributedBody instead of text column. This is handled automatically as of v0.1.0.

MCP not loading in Claude Desktop

  1. Check your config file syntax is valid JSON
  2. Ensure the command path is correct
  3. Restart Claude Desktop completely (Cmd+Q, not just close window)

Development

# Clone the repo
git clone https://github.com/cyberpapiii/imessage-max.git
cd imessage-max

# Create virtual environment and install
uv venv
uv pip install -e ".[dev]"

# Run tests
pytest

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

imessage_max-0.1.7.tar.gz (346.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

imessage_max-0.1.7-py3-none-any.whl (53.3 kB view details)

Uploaded Python 3

File details

Details for the file imessage_max-0.1.7.tar.gz.

File metadata

  • Download URL: imessage_max-0.1.7.tar.gz
  • Upload date:
  • Size: 346.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for imessage_max-0.1.7.tar.gz
Algorithm Hash digest
SHA256 17402bd8e64202d9d986f9b6b71e0c4dab49cc92dec208706ac9793adf22d8c5
MD5 ae8252fadf54fa2f64a2813b9f499f3c
BLAKE2b-256 9b0f5751112d48110d8de992a9582e09c64a658342230436737b072e1492dcd4

See more details on using hashes here.

Provenance

The following attestation bundles were made for imessage_max-0.1.7.tar.gz:

Publisher: publish.yml on cyberpapiii/imessage-max

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file imessage_max-0.1.7-py3-none-any.whl.

File metadata

  • Download URL: imessage_max-0.1.7-py3-none-any.whl
  • Upload date:
  • Size: 53.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for imessage_max-0.1.7-py3-none-any.whl
Algorithm Hash digest
SHA256 dca975cf63e5efb2d55eaee48b99592f20f08e2a0621c50f89d67c129884293c
MD5 488b09666a52af02ab956b044aeba4bb
BLAKE2b-256 705aa669303c0f188d7ce163371d781e8d04ff9f4726e75e3682384bb09453c4

See more details on using hashes here.

Provenance

The following attestation bundles were made for imessage_max-0.1.7-py3-none-any.whl:

Publisher: publish.yml on cyberpapiii/imessage-max

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page