mac-messages
Mac Messages Host
Mac の Apple Messages(iMessage/SMS)履歴全体を、AI エージェント向けに読み取り専用で提供します — REST/OpenAPI とストリーミング対応 HTTP MCP 上で提供される単一のバッチツールです。
単一ツール、バッチリクエスト: 単一の
messages(requests: str)ツールが、JSON リクエストの配列を受け取り、対応する JSON レスポンスの配列を返します。1 回の呼び出しで多数の独立した操作を実行できます。REST(POST /api/messages)と MCP(/mcp/)の両方で同一に提供されます。設計上読み取り専用: データベースは SQLite の
mode=roで開かれ、書き込み経路はありません。送信、編集、削除は一切できません。最新の macOS 本文デコード:
attributedBodyの typedstream ブロブ(Ventura+)に保存されたメッセージ本文と、message_summary_infoplist 内の編集履歴を透過的にデコードします。自動生成のツールプロンプト: AI 向けプロンプトは Pydantic モデルから生成され(約 615 gpt-4o トークン、
tiktokenでカウントされ、テストで保証されています)。tool_prompt.mdのスナップショットはドリフトテストで同期が維持されています。
Install
macOS 上で Python 3.11+ が必要です。
pip install . # or: pip install -e . for development
mmhost info # permission check + database status
mmhost start # serve API + MCP on http://127.0.0.1:8761macOS のアクセス権限(重要)
~/Library/Messages/chat.db は macOS TCC によって保護されています。mmhost を実行するプロセスには フルディスクアクセスが必要です。
システム設定 → プライバシーとセキュリティ → フルディスクアクセス → ターミナルアプリ(またはサーバーを起動するもの)を有効にし、再起動してください。
mmhost info を実行すると、データベースが読み取り可能かどうかがすぐにわかります。
Related MCP server: imessage-mcp
Endpoints
Endpoint | Purpose |
| バッチ処理ツール(REST) |
| OpenAPI スキーマ |
| インタラクティブなドキュメント |
| 死活プローブ |
| ストリーミング対応 HTTP MCP エンドポイント(単一 |
Auth
admin_token(永続設定、MMHOST_ADMIN_TOKEN、または --admin-token)が設定されている場合は、Authorization: Bearer <token> が必要です。トークンが設定されていない場合は、アクセスがオープンになります。デフォルトでサーバーが 127.0.0.1 にバインドされるため安全です。
Request kinds
get_info— データベースのステータス、件数、履歴の日付範囲list_chats— 最近のアクティビティ順の会話一覧(フィルタ、ページネーション)get_chat— チャットのトランスクリプト(beforeで過去の履歴をページング)get_recent— すべてのチャットにわたる最新メッセージ(sinceでポーリング)search_messages— メッセージ本文に対する大文字小文字を区別しない部分文字列検索
正確な AI 向けドキュメント(モデルから生成)については tool_prompt.md を参照してください。
Example
curl -s http://127.0.0.1:8761/api/messages \
-H 'Content-Type: application/json' \
-d '{"requests": "[{\"kind\":\"list_chats\",\"limit\":3}]"}'MCP クライアント設定
{
"mcpServers": {
"mac-messages": {
"type": "streamable-http",
"url": "http://127.0.0.1:8761/mcp/"
}
}
}Configuration
プラットフォームの設定ディレクトリ(macOS では ~/Library/Application Support/mac_messages_host/config.json)に永続化されます。場所は MMHOST_CONFIG で上書きできます。サーバーレベルの設定のみです — example.env を参照してください。
Development
pip install -e '.[dev]'
pytest
# after changing request models:
python -m tests.regenerate_tool_promptアーキテクチャは oWoHo AI Tool Server パターン(純粋なコアライブラリ + そこから派生した FastAPI/FastMCP/CLI インターフェース)に従っており、reddit_tool_server や obsidian_ai_miniserver と同様です。
License
MIT — LICENSE.md を参照してください。
This server cannot be deployed
Maintenance
Related MCP Connectors
MCP connector for iMessage & Contacts via a local Mac agent + Vercel relay
Search, read, and write your Apple Notes from ChatGPT/Claude via a local Mac agent + MCP relay.
Search your AI chat history (ChatGPT, Claude, Codex) from any MCP client. Remote, private, read-only
MCP connector that lets ChatGPT list, search, and run your Apple Shortcuts via a local Mac agent
Related MCP Servers
- AlicenseNot gradedqualityBmaintenanceEnables AI assistants to read, search, and send iMessages with features like contact name resolution, session grouping, and attachment listing. It provides intent-aligned tools to efficiently navigate conversation history and manage messages through natural language queries.6MIT
- AlicenseNot gradedqualityDmaintenanceEnables reading and sending iMessages on macOS through MCP, with tools for managing chats, messages, and attachments via AI agents.MIT
- FlicenseNot gradedqualityBmaintenanceEnables AI clients to read and search macOS Messages history through a read-only MCP interface.-
- AlicenseAqualityAmaintenanceEnables AI agents on macOS to securely read and search the local Messages database, catch up on missed messages via a persistent inbox, and send texts or files to allowlisted chats, with optional voice note transcription and text-to-speech.10353 npmMIT