Skip to main content
Glama
multimodal-imessage-mcp

multimodal-imessage-mcp

by tszaks

マルチモーダル iMessage MCP

Claude向けの最も完全なiMessage MCPサーバー。Claude DesktopやClaude Codeから、会話の全文読み取り、メッセージ検索、画像添付ファイルの表示、メッセージ送信、連絡先検索、メッセージへのリアクションが可能です。

なぜこれが存在するのか

他のiMessage MCPツールは、Appleのchat.dbにあるtextカラムをクエリします。問題は?最新のmacOS(14+)では、93%のメッセージがtextではなくattributedBodyに保存されています。 それらのツールは黙って空または不完全な会話を返します。

このサーバーは、AppleのNSAttributedStringバイナリ形式をリバースエンジニアリングして実際のメッセージ内容を抽出し、完全なメッセージ履歴にアクセスできるようにします。

Related MCP server: jons-mcp-imessage

機能

ツール

説明

read_recent_messages

すべての会話から最新メッセージを読む

search_messages

すべてのメッセージ、連絡先、グループ名を全文検索

get_conversation

任意の連絡先(名前または番号で)との完全な会話スレッドを取得

list_chats_structured

チャットID、ハンドル、最終送信者、プレビュー、グループステータスをJSONとして取得

get_conversation_by_chat_id

チャットIDで信頼性の高い構造化スレッドを取得

read_receipts リリースフラグ

送信済み1:1 iMessage/RCSメッセージに、ベストエフォートの既読確認メタデータを追加

find_outreach_followups

フォローアップレビューが必要なSMSアウトリーチスレッドを見つける

get_attachment

メッセージから画像やファイルを表示 -- Claudeが写真を見て分析可能

send_message

確認セーフティとオプションの検証済みフォールバック付きでiMessageまたはSMS/RCSを送信

detect_message_service

スレッドを検査し、送信前にiMessage、SMS/RCS、または自動を推奨

send_message_batch

承認トークン付きでレビュー済みバッチをプレビューおよび送信

list_delivery_failures

赤い吹き出しの送信失敗、送信保留中、SMS/RCS復旧を一覧表示

delete_messages

バックアップ優先のDBクリーンアップで正確なローカルメッセージ行を削除

delete_threads

1つの正確なバッチ承認トークンで完全なローカルスレッドをプレビューおよび削除

edit_message

Messages UI自動化を通じて最近の送信済みiMessageを実験的に編集

undo_send_message

Messages UI自動化を通じて最近の送信済みiMessageの送信を実験的に取り消し

list_recent_chats

最もアクティブな会話を確認

lookup_contact

連絡先から電話番号とメールアドレスを見つける

react_to_message

メッセージにタップバックリアクションを追加

マルチモーダル: Claudeが写真を見ることができる

get_attachmentを使用すると、画像はbase64コンテンツブロックとして返され、Claudeが実際に見ることができます。HEIC写真(iPhoneのデフォルト)は自動的にJPEGに変換されます。これにより、Claudeは以下が可能になります:

  • 誰かが送った写真に何が写っているか説明する

  • 画像からテキスト/スクリーンショットを読む

  • 会話内の視覚コンテンツを分析する

要件

  • macOS(これはローカルのiMessageデータベースを読み取ります)

  • Node.js >= 18 および < 26。ロックされたネイティブSQLite依存関係がNode 26と互換性がないため、Node 24 LTSが推奨されます。

  • ターミナルアプリにフルディスクアクセスが許可されていること(システム設定 > プライバシーとセキュリティ > フルディスクアクセス)。これは、連絡先名の解決に使用されるiMessageデータベースとAddressBookデータベースの両方をカバーします — Contactsアプリを実行している必要はありません。

インストール

git clone https://github.com/tszaks/imessage-mcp.git
cd imessage-mcp
npm install

設定

Claude Desktop

~/Library/Application Support/Claude/claude_desktop_config.jsonに追加:

{
  "mcpServers": {
    "imessage": {
      "command": "/opt/homebrew/bin/node",
      "args": ["/path/to/imessage-mcp/index.js"]
    }
  }
}

重要: nodeだけでなく、Node.jsバイナリのフルパス(例:/opt/homebrew/bin/node)を使用してください。macOSデスクトップアプリはシェルのPATHを継承せず、ベアのnodeコマンドはネイティブモジュールのクラッシュを引き起こす古いシステムNodeに解決されることがよくあります。

Claude Code

.mcp.jsonに追加:

{
  "mcpServers": {
    "imessage": {
      "command": "node",
      "args": ["/path/to/imessage-mcp/index.js"]
    }
  }
}

Claude Codeでは、nodeはシェル環境を継承するため、通常は正しく解決されます。

使用例

"最近のメッセージを見せて" -- 最新の会話を読み取ります

"今日、ママから何がテキストで来た?" -- AddressBookを介して「ママ」を電話番号に解決し、会話を取得します

"「フライト確認」をメッセージで検索" -- すべてのメッセージの全文検索

"過去7日間に返信した、フォローアップが必要なアウトリーチ候補を見つけて" -- リスクラベル付きの構造化アウトリーチ候補を返します

"この10件のフォローアップテキストのバッチをプレビュー" -- 送信前に正確な受信者、メッセージ、警告、承認トークンを返します

"最近の配信失敗を表示" -- Messagesが失敗または保留中とマークした送信メッセージを報告し、後続のSMS/RCS送信がスレッドを復旧したかどうかも含みます

"メッセージ538516の写真を見せて" -- Claudeが表示して説明するための実際の画像を返します

"「10分遅れる」を+1234567890に送信" -- iMessageを送信します(確認が必要)

リリースフラグ

リリースフラグはMCPサーバー環境を介してオプトインします:

{
  "mcpServers": {
    "imessage": {
      "command": "node",
      "args": ["/path/to/imessage-mcp/index.js"],
      "env": {
        "IMESSAGE_MCP_RELEASES": "auto_sms_fallback,cleanup_failed_imessage_after_sms_fallback,message_mutation_tools,experimental_message_ui_actions,read_receipts"
      }
    }
  }
}

フラグ

動作

auto_sms_fallback

send_messageとsend_message_batchは、自動iMessage送信後に最近の送信行を検証します。Messagesが青い吹き出しの失敗をマークし、受信者が電話ベースの場合、MCPはSMS/RCSを介して再試行します。

cleanup_failed_imessage_after_sms_fallback

auto_sms_fallbackがSMS/RCSで正常に再試行した後、MCPはベストエフォートのUIクリーンアップパスを実行して失敗した青いiMessageの吹き出しを削除し、クリーンアップが検証されたかどうかを報告します。これはchat.dbを直接変更することはありません。

message_mutation_tools

delete_messagesとdelete_threadsを公開します。これらのツールは、直接的なローカルMessagesデータベースのクリーンアップの前に、chat.db、chat.db-wal、chat.db-shmのタイムスタンプ付きバックアップを作成します。delete_messagesは確認なしで正確なメッセージ行IDを削除します。delete_threadsは、要求されたチャットIDリスト全体に対して1つの正確なバッチ承認トークンを必要とします。

experimental_message_ui_actions

edit_messageとundo_send_messageを公開します。これらのツールはMessages UI自動化を使用し、ターゲットが最近の送信済みiMessageであることを検証し、アクション後にchat.dbに対して検証します。Messagesがメニューアクションを公開していない場合、またはメッセージがAppleの許可されたウィンドウ外にある場合、明確に失敗します。

read_receipts

構造化会話結果に既読確認フィールドを追加し、get_conversationテキスト出力に既読ステータスヒントを追加します。macOSがdate_readを同期した場合、送信済み1:1 iMessageおよびRCS行をサポートします。SMS、グループチャット、受信メッセージはサポートされていないと報告されます。date_readがないことは、未読または利用不可を意味し、既読確認が無効または同期されていない可能性もあります。

変異ツール

delete_messagesは正確なメッセージROWIDを受け入れます:

{ "message_ids": ["538516", "538517"] }

確認は必要ありません。削除されたID、見つからなかったID、バックアップ場所、検証中に見つかった残りの行を報告します。

delete_threadsは2段階の正確なバッチフローです:

{ "chat_ids": [101, 102] }

プレビューは、その順序付きリストとプレビューに表示されたスレッドメタデータに対して1つのapproval_tokenを返します。削除するには、同じ順序のchat_ids、confirm: true、およびそのトークンを送信します:

{ "chat_ids": [101, 102], "confirm": true, "approval_token": "..." }

順序、リスト、またはトークンを変更すると、リクエストは失敗します。

edit_messageとundo_send_messageは実験的です。Messagesがそれらのアクションに対して第一級のAppleScriptコマンドを公開していないためです。会話を開き、テキストスニペットで表示されている送信済み吹き出しを見つけ、コンテキストメニューを使用し、結果を検証します。これらは実際のMessagesの動作に影響を与えることを目的としており、偽のローカル専用DB編集ではありません。

オプションのチューニング:

IMESSAGE_MCP_SEND_VERIFY_DELAY_MS=2500

これは、MCPが新しい送信行についてローカルのMessagesデータベースをチェックする前に待機する時間を制御します。

仕組み

attributedBody修正

AppleのiMessageデータベース(~/Library/Messages/chat.db)には、メッセージコンテンツ用の2つのカラムがあります:

  • text -- レガシーなプレーンテキストカラム(古いmacOSバージョンで使用)

  • attributedBody -- シリアル化されたNSAttributedString blob(macOS 14+で使用)

最新のmacOSでは、Appleはリッチテキスト、メンション、フォーマットをサポートするために、メッセージストレージを徐々にattributedBodyに移行しました。textカラムはますます単なるレガシーフォールバックになりつつあり、しばしばNULLです。

このサーバーは、textがNULLのメッセージを検出し、バイナリNSTypedStream形式を解析してattributedBodyからコンテンツを抽出します:

  1. バイナリblob内のNSStringマーカーを見つける

  2. タイプヘッダーバイト(01 94 84 01 2b)を読み飛ばす

  3. 長さプレフィックス(短いメッセージはシングルバイト、長いメッセージはマルチバイト)をデコードする

  4. UTF-8テキストペイロードを抽出する

添付ファイル処理

iMessageの添付ファイルは~/Library/Messages/Attachments/に保存され、パスはattachmentテーブルで追跡されます。get_attachmentツール:

  1. 指定されたメッセージIDの添付ファイルメタデータをクエリする

  2. ~/Library/Messages/...パスを絶対パスに解決する

  3. JPEG/PNG/GIF/WebPの場合:ファイルを読み取り、base64画像コンテンツを返す

  4. HEIC(iPhoneのデフォルト)の場合:返す前にmacOSのsipsを使用してJPEGに変換する

  5. その他のファイルの場合:メタデータとファイルパスを返す

トラブルシューティング

"Failed to open iMessage database" ターミナルアプリにフルディスクアクセスを許可する:システム設定 > プライバシーとセキュリティ > フルディスクアクセス。

連絡先検索で結果が返されない 連絡先解決は、macOSのAddressBook SQLiteデータベースを直接読み取ります(Contactsアプリは不要)。フルディスクアクセスが許可されていることを確認してください。連絡先が追加されたばかりの場合は、MCPサーバーを再起動してキャッシュを更新してください。

ネイティブモジュールのクラッシュ / "NODE_MODULE_VERSION mismatch" ネイティブ依存関係を再ビルドする:npm rebuild。これはNode.jsのバージョンが変更されたときに発生します。また、Claude Desktopの設定でnodeへのフルパスを使用していることを確認してください(上記の設定を参照)。

会話からのメッセージが欠落している これはまさにこのサーバーが修正するバグです。attributedBody抽出を含む最新バージョンを実行していることを確認してください。

ライセンス

MIT

クイックスタート要約

npm install
node index.js

次に、サーバーをMCPクライアントの設定に追加し、ターミナルアプリにフルディスクアクセスを許可します。

動作の仕組み(要約)

  • macOSのiMessage SQLiteデータベースを読み取ります

  • 最新のattributedBodyペイロードをデコードし、完全なメッセージテキストを取得します

  • MCPを介して会話/検索/添付ファイルツールを公開します

  • 明示的な確認を伴うメッセージ送信/リアクションアクションにAppleScriptを使用します

LLMクイックコピー

GitHubでこのコードブロックのコピーボタンを使用します。

Repo: imessage-mcp
Goal: Full iMessage MCP including attachments and send/reaction actions.
Setup:
1) npm install
2) Grant Full Disk Access to terminal app
3) Add MCP config entry for index.js
Use:
- read_recent_messages, search_messages, get_conversation
- list_chats_structured, get_conversation_by_chat_id, find_outreach_followups
- get_attachment for image/file analysis
- send_message/send_message_batch/react_to_message with explicit confirm flag
How it works:
- SQLite + attributedBody decoding + AppleScript actions wrapped as MCP tools

Available Tools

14 tools
detect_message_serviceA

Inspect local Messages history for a recipient and recommend iMessage, SMS/RCS, or auto before sending. This is best-effort because Apple does not expose a direct preflight availability API.

Inputs: to (required), limit.

find_outreach_followupsA

Find SMS outreach conversations that need agent review or follow-up. Returns structured candidates with status, risk labels, and evidence snippets.

Inputs: limit, hours_ago, max_results, outreach_terms.

get_attachmentA

Get an attachment (image, file) from a message. Returns images directly so Claude can view and analyze them. Use message IDs from get_conversation results.

Inputs: message_id (required).

get_conversationA

Get full conversation thread with a specific contact or phone number, optionally filtered by time. Shows text content and indicates attachments.

Inputs: limit, contact, hours_ago, phone_number.

get_conversation_by_chat_idA

Get a conversation by iMessage chat_id as structured JSON. Use chat_id from list_chats_structured or find_outreach_followups.

Inputs: chat_id (required), limit, hours_ago.

list_chats_structuredB

List recent chats as structured JSON with chat IDs, handles, last sender, last message preview, group status, and message counts.

Inputs: limit, hours_ago.

list_delivery_failuresA

List recent outgoing messages that Messages marked failed, pending, or potentially recovered by SMS/RCS fallback. Use this to find red Not Delivered bubbles.

Inputs: limit, hours_ago, include_pending.

list_recent_chatsB

List recent active conversations, sorted by most recent activity

Inputs: limit, hours_ago.

lookup_contactA

Look up a contact name in macOS Contacts to find their phone number or email

Inputs: name (required).

react_to_messageA

React to a message with an emoji (❤️, 👍, 👎, 😂, ‼️, ❓). IMPORTANT: Always show the user which message and reaction before sending, and get explicit confirmation.

Inputs: confirm (required), reaction (required), message_id (required).

read_recent_messagesB

Read recent iMessages from your Messages app

Inputs: limit, include_group_chats.

search_messagesA

Search for messages by contact name, phone number, or message content

Inputs: query (required), limit.

send_messageA

Send an iMessage or SMS/RCS to a contact (uses AppleScript). Supports iMessage (blue bubble), SMS/RCS (green bubble), or auto-detection with verified fallback when the auto_sms_fallback release flag is enabled. IMPORTANT: Always show the user the message content and recipient before sending, and get explicit confirmation.

Inputs: to (required), confirm (required), message (required), service.

send_message_batchA

Preview or send a reviewed SMS/iMessage batch. Preview returns an approval token. Sending requires the same exact batch, confirm=true, and the token.

Inputs: items (required), confirm, service, approval_token.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    B3.4/5.0

    Scored across 14 tools

    Disambiguation2/5

    Several tools overlap significantly: read_recent_messages, list_chats_structured, and list_recent_chats all list conversations with varying formats. get_conversation and get_conversation_by_chat_id retrieve threads but differ only in ID type, which could confuse agents. send_message and send_message_batch have overlapping purposes (sending messages) with subtle differences in batching.

    Naming Consistency3/5

    Most tools follow a verb_noun pattern (read_recent_messages, search_messages, send_message, list_delivery_failures), but there are inconsistencies: get_conversation vs get_conversation_by_chat_id (one is specific, one generic), and list_chats_structured vs list_recent_chats (both list chats but with different modifiers). The style is consistent snake_case, but the verbs (read, search, get, list, send, detect, find, lookup, react) vary without a clear hierarchy.

    Tool Count4/5

    14 tools is within the well-scoped range for a messaging server. The count is slightly high but justified by the need to handle message reading, searching, sending, attachments, and delivery status. Each tool serves a distinct function (though some overlap), so the count is reasonable.

    Completeness3/5

    The server covers core iMessage workflows: listing, searching, reading conversations, sending (including batch), reactions, attachments, and delivery failures. However, it lacks obvious lifecycle operations like deleting messages, marking as read/unread, or editing sent messages. There's also no tool to create a new conversation with a new contact, only sending to existing/known contacts. These gaps are not fatal as most agents would work around them, but they are notable for a comprehensive messaging tool.

    Maintenance

    ActivityNo data
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      D
      maintenance
      Enables reading, searching, and sending iMessages directly from MCP-compatible clients by accessing the local macOS iMessage database, supporting conversations, attachments, and both individual and group chats.
      10
      MIT
    • A
      license
      A
      quality
      D
      maintenance
      Enables AI assistants to read iMessage history and send messages on macOS. Supports conversation listing, message search with keyword and semantic modes, contact lookup, and sending messages to existing conversations.
      13
      11
      MIT
    • F
      license
      A
      quality
      D
      maintenance
      Enables reading, searching, and sending iMessages on macOS by accessing the local messages database and utilizing AppleScript. Users can list conversations, search message history, and send messages to individuals or group chats directly through the Model Context Protocol.
      6
      -
    • A
      license
      Not graded
      quality
      C
      maintenance
      Enables reading, sending, and managing iMessage conversations on macOS through MCP.
      1
      MIT