Skip to main content
Glama

imessage-mcp

MacのiMessageデータをClaude Desktop / Claude Codeに公開するローカルMCPサーバーです。 2つの機能を提供します:

  1. 送信: AppleScript経由で Messages.app を操作

  2. 読み取り: ~/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 を置き換えてください。)

ツール

ツール

目的

send_imessage(recipient, body, service?)

Messages.app経由で送信します。recipient は電話番号、Apple IDメール、または既存の相手の名前です。

list_recent_chats(limit=20)

最新のチャットを、最後のメッセージのプレビューと未読数とともに表示します。

get_chat_messages(chat_id?, handle?, limit=50, since?)

チャットのメッセージを取得します。chat_id または handle を指定してください。

search_imessages(query, since?, until?, from_contact?, limit=25)

メッセージ本文に対して大文字小文字を区別しないLIKE検索を行います。

get_my_info()

自分のハンドルとDBメタデータを取得します。

日付は入出力ともにISO8601形式です。内部的には、Appleは message.date を2001年1月1日UTCからのナノ秒として保存しており、サーバーが双方向に変換します。

安全性の不変条件

  • chat.dbsqlite3.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 -q
Install Server
A
license - permissive license
A
quality
D
maintenance

Maintenance

Maintainers
Response time
Release cycle
Releases (12mo)
Commit activity

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

  • A
    license
    -
    quality
    C
    maintenance
    A 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.
    104
    1
  • A
    license
    A
    quality
    C
    maintenance
    Enables full-text search of macOS iMessages including link preview metadata. Works as an MCP server for Claude Desktop to search your messages locally.
    1
    MIT
  • F
    license
    A
    quality
    C
    maintenance
    A read-only MCP server that exposes your iMessage data to Claude Code and Claude Desktop, with automatic contact name resolution.
    3

View all related MCP servers

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.

View all MCP Connectors

Latest Blog Posts

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