imessage-mcp
imessage-mcp
MacのiMessageデータをClaude Desktop / Claude Codeに公開するローカルMCPサーバーです。 2つの機能を提供します:
送信: AppleScript経由で
Messages.appを操作読み取り:
~/Library/Messages/chat.dbへの直接的な読み取り専用SQLiteアクセス
すべてローカルで完結します。APIキーやネットワーク通信は一切ありません。
インストール
# 1. Clone / copy into ~/mcp-servers/imessage-mcp
cd ~/mcp-servers/imessage-mcp
# 2. Create a Python 3.11+ venv and install deps
python3.12 -m venv .venv
.venv/bin/pip install -e .Related MCP server: imessage-mcp
権限(必須)
フルディスクアクセス — chat.db を読み取るために必要
システム設定 → プライバシーとセキュリティ → フルディスクアクセス → 以下をオンに切り替えます:
使用するターミナルアプリ(例: Terminal, iTerm2, Ghostty)、および
Claude.app(Claude Desktopを使用する場合)
自動化 — Messages.app を操作するために必要
システム設定 → プライバシーとセキュリティ → 自動化 → 使用するターミナル / Claude.app を展開し、
メッセージ をオンに切り替えます。
Messages.appが起動しており、iMessageにサインインしている必要があります。
権限の設定が不足している場合、サーバーは開くべき設定パスをエラーメッセージとして表示します。
Claude Desktopの設定
~/Library/Application Support/Claude/claude_desktop_config.json に以下をマージしてください:
{
"mcpServers": {
"imessage": {
"command": "/Users/YOUR_USERNAME/mcp-servers/imessage-mcp/.venv/bin/python",
"args": ["-m", "imessage_mcp.server"]
}
}
}(venvのPythonへの絶対パスを指定するのが最も安全です。PATHの曖昧さを回避できます。YOUR_USERNAME を置き換えてください。)
ツール
ツール | 目的 |
| Messages.app経由で送信します。 |
| 最新のチャットを、最後のメッセージのプレビューと未読数とともに表示します。 |
| チャットのメッセージを取得します。 |
| メッセージ本文に対して大文字小文字を区別しないLIKE検索を行います。 |
| 自分のハンドルとDBメタデータを取得します。 |
日付は入出力ともにISO8601形式です。内部的には、Appleは message.date を2001年1月1日UTCからのナノ秒として保存しており、サーバーが双方向に変換します。
安全性の不変条件
chat.dbはsqlite3.connect("file:...chat.db?mode=ro", uri=True)で開かれます。 書き込みを試みるとsqlite3.OperationalError: attempt to write a readonly databaseが発生します。send_imessageは受信者 / 本文 / サービスを 個別の osascript 引数 として渡すため、シェルインジェクションの心配はありません。添付ファイルはメタデータ(ファイル名、mime_type、合計バイト数)のみを返します。バイナリデータは読み取られません。
制限事項
予約送信や遅延送信はサポートされていません。
リッチメッセージや返信スレッドのメッセージは、テキストが
attributedBody(NSKeyedArchive) に保存されている場合があります。埋め込まれたNSStringの抽出をベストエフォートで行いますが、特殊なペイロード(画像、タップバック、Apple Payなど)を含むメッセージは、bodyが空になりますが、メタデータは正しく表示されます。到達確認:
send_imessageは osascript の終了コードに基づいて成功を報告します。メッセージが実際に送信されたかを確認するには、数秒後にsearch_imessagesまたはget_chat_messagesを呼び出してください。macOS専用であり、サンドボックス化されたApp Storeアプリでは動作しません。
ローカル開発
.venv/bin/pytest -qMaintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- AlicenseBqualityDmaintenanceA local server that enables Claude Desktop to interact with your macOS Contacts and Messages apps, allowing you to search contacts and send iMessages through natural language commands.21928MIT
- Alicense-qualityCmaintenanceA read-only MCP server for macOS that enables users to search through iMessage history and analyze conversation patterns using AI-powered tools. It provides detailed statistics on messaging habits, streaks, and contact analytics while keeping all data private and local.1041
- AlicenseAqualityCmaintenanceEnables full-text search of macOS iMessages including link preview metadata. Works as an MCP server for Claude Desktop to search your messages locally.1MIT
- FlicenseAqualityCmaintenanceA read-only MCP server that exposes your iMessage data to Claude Code and Claude Desktop, with automatic contact name resolution.3
Related MCP Connectors
MCP connector for iMessage & Contacts via a local Mac agent + Vercel relay
Let ChatGPT, Claude & Cursor use your Mac: email, calendar, iMessage, Teams, files. Local, free.
Search, read, and write your Apple Notes from ChatGPT/Claude via a local Mac agent + MCP relay.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/camfortin/imessage-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server