Skip to main content
Glama
iMessage MCP

iMessage MCP

by 4ndylg

iMessage MCP

This project exposes a read-only MCP server for the local macOS Messages database.

What it can do

  • List recent chats

  • Read messages from a chat

  • Read messages by local date across all chats

  • Search message text and subjects

  • List attachments and local attachment paths

  • Read text-like attachment contents

  • Return attachments alongside messages

  • Return server/database metadata

Related MCP server: iMessage MCP Server

What it cannot do

  • Send messages

  • Edit messages

  • Delete messages

  • Mark chats or messages as read/unread

  • Modify attachment files

The SQLite connection is opened in readonly mode, and the server only exposes query tools.

Attachment support

Use list_attachments to find attachments by chat or message. Use read_attachment with an attachment_id to read text-like files such as .txt, .md, .csv, .json, .html, .rtf, .doc, and .docx.

For PDFs and images, read_attachment also tries macOS Spotlight text metadata. If no text is available, binary files return metadata plus resolved_path. Import that path into AnythingLLM or use AnythingLLM's OCR/PDF pipeline to extract content.

get_messages returns attachment metadata under each message by default. Pass include_attachment_content: true to also extract readable attachment text inline with the message result.

Use get_messages_by_date for prompts such as "what messages did I send today?" Set direction to sent, received, or all. It returns message text and, when available, extracted attachment text inline.

Attachment text cache

Successful attachment text extraction is cached under cache/attachments. The cache key includes the attachment ID, local file path, file size, modified time, and max_bytes, so changed files are reprocessed automatically.

read_attachment uses the cache by default. Set use_cache: false only when you intentionally want to force OCR/PDF extraction again.

Run it

npm start

If your MCP client cannot find sqlite3, set:

export SQLITE3_PATH=/Users/lilty/miniconda3/bin/sqlite3

If your Messages database is in a different location, set:

export IMESSAGE_DB_PATH="$HOME/Library/Messages/chat.db"

MCP client config

Use this in your MCP client configuration:

{
  "mcpServers": {
    "imessage": {
      "command": "node",
      "args": ["/Users/lilty/Documents/Codex/2026-05-29/imessage-mcp/src/server.js"],
      "env": {
        "SQLITE3_PATH": "/Users/lilty/miniconda3/bin/sqlite3"
      }
    }
  }
}

Notes

  • On macOS, you may need to grant Full Disk Access to the app that launches the MCP server.

  • The Messages database is read directly from ~/Library/Messages/chat.db.

Available Tools

7 tools
get_messagesB

读取指定聊天中的短信,并可把附件路径或附件文字一起返回。只读,不会发送或修改任何信息。

Inputs: chat_identifier (required), limit, offset, newest_first, +3 more.

get_messages_by_dateA

按本机日期读取所有聊天中的短信,可筛选已发送/已接收,并默认尝试提取附件文字。只读,不会发送或修改任何信息。

Inputs: date, limit, offset, direction, +3 more.

list_attachmentsB

列出 iMessage 附件,返回本机文件路径、大小、类型和关联短信等元数据。只读。

Inputs: limit, offset, message_id, chat_identifier.

list_chatsB

列出本机 iMessage 数据库中的最近聊天。只读,不会发送或修改任何信息。

Inputs: limit, offset.

read_attachmentA

读取附件内容:文本/文档会直接返回文字,图片会尝试 OCR,PDF 会尝试抽取或 OCR 文字;无法提取时返回附件路径和元数据。只读。

Inputs: file_path, max_bytes, use_cache, attachment_id.

search_messagesA

搜索本机 Messages 数据库中的短信正文、主题和联系人。只读,不会发送或修改任何信息。

Inputs: query (required), limit.

server_infoA

返回 MCP 服务器、数据库路径和只读能力等元数据。

Inputs: no named parameters.

Tool Schema Changelog

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

Loading tool schema changelog…

    TDQS

    A3.7/5.0

    Scored across 7 tools

    Disambiguation4/5

    Each tool has a mostly distinct scope: chat listing, chat-scoped messages, date-scoped messages, full-text search, attachment listing, attachment reading, and server metadata. The only real overlap is between get_messages (per-chat) and get_messages_by_date (cross-chat by date), which a careful reader can separate but might occasionally confuse. search_messages is clearly distinct from both.

    Naming Consistency5/5

    All tools use snake_case and follow a predictable verb_noun pattern (list_chats, get_messages, search_messages, list_attachments, read_attachment, get_messages_by_date). server_info is the only non-verb entry, but it is a conventional metadata endpoint rather than a deviation that hurts readability.

    Tool Count5/5

    Seven tools is well within the ideal 3-15 range and each one covers a distinct retrieval need for a read-only message archive. Nothing looks like filler or a redundant wrapper.

    Completeness4/5

    For a deliberately read-only iMessage archive server, the surface is nearly complete: chat discovery, message retrieval by chat or date, search, and attachment listing plus content extraction. Minor gaps remain, such as a dedicated way to look up or resolve contact/chat metadata or to fetch a single message by ID. Sending is intentionally absent and documented as such.

    Maintenance

    ActivityInactive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers