lane-mac-mcp
lane-mac-mcp
macOS 向け読み取り専用 iMessage MCP サーバー + CLI。監査可能な単一ファイルで、送信機能はありません。
Claude(MCP経由)または CLI 経由のあなた自身が、会話の一覧表示、チャットの読み取り、メッセージ履歴の検索ができます。それ以外は何もできません。設計上読み取り専用: v1 には送信コードは一切含まれていません。 すべてのデータアクセスは Apple 純正の /usr/bin/sqlite3(-json -readonly フラグ付き)を ~/Library/Messages/chat.db に対して実行する形で行われ、連絡先名はローカルの AddressBook データベースへの読み取り専用クエリで取得されます。
設計上の制約
サーバー全体は server.ts(コメント込みで約600行)で構成され、エンドツーエンドで監査可能です(監査対象ファイルがそのまま実行ファイルです。Node.js ≥ 22.18 はネイティブの型ストリッピングにより TypeScript を直接実行するため、ビルドステップもコンパイル成果物もありません)。依存関係は package-lock.json で固定されたちょうど2つのみ: @modelcontextprotocol/sdk と zod です。ネットワークインポートはなく、ポートを開放もしません — stdio JSON-RPC のみで、Claude Desktop によって子プロセスとして起動されます; CLI 実行は一括終了型のプロセスです。デーモンもありません: Claude Desktop がアプリの起動と終了に合わせてサーバーを起動・停止します(コードを再読み込みするにはアプリを再起動します)。
Related MCP server: imessage-rich-search
要件
macOS で Messages が設定済みであること
Node.js ≥ 22.18
サーバーを実行するプロセスにフルディスクアクセス許可が必要です: CLI 利用では Terminal(またはターミナルアプリ)、MCP 利用では Claude Desktop。システム設定 → プライバシーとセキュリティ → フルディスクアクセスで許可し、その後アプリを再起動してください。
node server.ts doctorでこれらすべてを検査し、不足しているものを教えてくれます。
セットアップ
git clone <this repo> && cd MacMCPServer
npm install # installs the two pinned dependencies
node server.ts doctor次に、サーバーを Claude Desktop の claude_desktop_config.json(設定 → デベロッパー → 設定を編集)に追加します:
{
"mcpServers": {
"lane-mac": {
"command": "node",
"args": ["/Users/you/Desktop/MacMCPServer/server.ts"]
}
}
}Claude Desktop を再起動します。list_chats, read_chat, search_messages の3つのツールが表示されます。
CLI 利用法
node server.ts chats # recent chats, names resolved
node server.ts chats --search "mom" --limit 5
node server.ts chats --awaiting-reply-only # threads where the last word wasn't yours
node server.ts read "Martha" --limit 100 # fuzzy name; ambiguous → candidates
node server.ts read 42 --start-date 2024-01-01 --end-date 2024-06-30 --include-reactions
node server.ts search "dinner" --from "martha" # last 30 days by default
node server.ts search "dinner" --start-date 2015-01-01 --deep # older history + rich-text decode
node server.ts doctor出力は JSON です。検索は message.text を SQL LIKE で対象とします。--deep は、テキストが attributedBody ブロブにのみ存在するメッセージも追加でデコードします(範囲を限定したスキャンでより遅くなります)。Tapback リアクションは --include-reactions を指定しない限りどこからも除外されます。
対策済みの Apple の癖
タイムスタンプは 2001-01-01 からのナノ秒(ごく古い行は秒)ですが、両方変換されます。
メッセージテキストは
message.textではなくattributedBodyの typedstream ブロブにあることが多いのですが、既知のNSStringヒューリスティックで JS でデコードされます。連絡先名はすべての AddressBook ソースにわたって、正規化された末尾10桁の電話番号または小文字化されたメールアドレスで照合され、連絡先が読めない場合は生の番号にフォールバックします。
プライバシーと安全性についての姿勢
サーバーは常に読み取りのみです。sqlite3 の -readonly フラグでデータベースを開き、データベースに書き込んだりメッセージを送ったりするコードパスは一切持たず、ネットワーク接続もせず、ポートでも待ち受けません。ユーザー入力は SQL 文字列リテラル内にエスケープされ('' で二重化)、数値は検証されます。doctor は行数だけを表示し、メッセージ内容は表示しません。環境変数の上書き(CHAT_DB_PATH, SQLITE_BIN, ADDRESSBOOK_DIR)が存在し、テストが実際のデータに触れることがありません。
テスト
npm testブラックボックステストは、合成の chat.db と AddressBook フィクスチャ(attributedBody 専用メッセージ、tapback、未返信の着信スレッドを含む)を生成し、実際の CLI と実際の MCP stdio インターフェイスを子プロセスとして駆動します。開発は実際のデータに触れることは決してありません。
ロードマップ(将来、v1 ではなく)
連絡先エンリッチメントの磨き込み → osascript によるメモの読み取り → 送信は SEND_ENABLED 環境変数と各呼び出しごとの承認が必要です。
This server cannot be installed
Maintenance
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
- AlicenseAqualityDmaintenanceA local MCP server that enables reading iMessage conversations and sending new messages through Claude Desktop. It provides secure, read-only access to your Mac's iMessage database and AppleScript-based message sending capabilities.6MIT
- 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
- AlicenseNot gradedqualityCmaintenanceRead-only MCP server for local macOS Messages database, enabling querying of chats, messages, attachments, and metadata.104MIT
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/lanemiles/lane-mac-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server