imessage-mcp
Provides read-only tools for searching and reading macOS Messages/iMessage history, including listing recent chats, reading messages by chat/contact/date, searching message text, retrieving conversations and unread messages, and listing contacts/handles with names.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@imessage-mcp show me my unread messages from the last week"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
imessage-mcp
A local, read-only Model Context Protocol server that lets an MCP client (such as Claude Desktop) search and read your macOS Messages history from ~/Library/Messages/chat.db.
It runs on your Mac over stdio, opens the database read-only, and never sends data anywhere. It cannot send, edit or delete messages.
Requirements
macOS with Messages signed in and in use
Node.js 22.13 or newer (uses the built-in
node:sqlitemodule, so no native compilation is needed)
Related MCP server: iMessage MCP
Install and build
git clone https://github.com/kashyapmanu/imessage-mcp.git
cd imessage-mcp
npm install
npm run buildOutput goes to dist/. The entry point is dist/index.js.
Full Disk Access
macOS protects ~/Library/Messages and ~/Library/Application Support/AddressBook (Contacts). The app that launches this server (for example Claude Desktop, or your terminal if you run it manually) needs Full Disk Access:
Open System Settings > Privacy & Security > Full Disk Access.
Enable the app that runs the server (e.g. Claude).
Fully quit and restart that app.
If Messages access is missing, every tool returns an error that explains this. If only Contacts access is missing, message tools still work but names are omitted, and the server logs one line to stderr.
Grant access to this server only (recommended)
Claude Desktop starts MCP servers through a helper that makes macOS check the program being run, so a plain node entry needs Full Disk Access granted to node itself, which would cover every Node script. Instead, build a tiny launcher that runs only this server and grant access to that:
scripts/build-launcher.sh # needs Xcode Command Line Tools (cc, codesign)This creates ~/.local/share/imessage-mcp/imessage-mcp-launcher. Add that file under Full Disk Access, and use it as the command in the config below (no args). The launcher bakes in two paths: the stable Homebrew symlink /opt/homebrew/bin/node (so Node upgrades and npm run build need no action) and this repo's dist/index.js. Re-run the script and re-grant only if you move the repo or stop using Homebrew Node.
Configuration
Variable | Default | Purpose |
|
| Override the Messages database file to read. |
|
| Override the AddressBook base directory used for Contacts name lookup. |
Contacts names
Handles are labelled with names from macOS Contacts. The server opens every AddressBook-v22.abcddb under the AddressBook directory (the root database and each Sources/*/ database) read-only, once per process, the first time a name is needed. It normalises phone numbers to their last 10 digits, so (415) 555-1234 matches the handle +14155551234, and lower-cases emails. Names are display only; nothing is written.
If a Contacts database cannot be read, the server prints one line to stderr and continues without names.
Tools
All tools are annotated readOnlyHint: true and openWorldHint: false. Results are JSON-style text. Limits default to 50 and max at 500. Each message's text is capped at 2000 characters, and total output at 100 KB.
Tool | Purpose |
| Recent conversations with chat id, name, participant handles and |
| Messages newest-first, filtered by |
| Case-insensitive text search with optional |
| The most recent messages of one chat, oldest first. Use |
| Incoming messages that Messages marks unread. The flag is read from |
| Phone numbers and emails with their Contacts |
Notes:
Tapbacks (reactions) and group events are excluded from message results.
Message text is read from
message.text. When that is empty, the server decodes the NSString frommessage.attributedBody.contactaccepts a contact name, phone number or email. It matches messages from any handle that matches the text, belongs to a contact whose name contains it, or (for 7 or more digits) has the same digits, so(415) 555-1234finds+14155551234. It also matches your replies in chats that include those handles. A name matching more than 200 handles is cut to the first 200, with a note on stderr.Names come from macOS Contacts. Without Contacts access,
sender_name,nameandparticipant_namesare null or empty.
Claude Desktop configuration
Add this to claude_desktop_config.json (Claude > Settings > Developer > Edit Config), using the absolute path to your build:
{
"mcpServers": {
"imessage": {
"command": "/Users/YOU/.local/share/imessage-mcp/imessage-mcp-launcher"
}
}
}Use the absolute path to the launcher. (Without the launcher, use the absolute path from command -v node as command and ["/absolute/path/to/imessage-mcp/dist/index.js"] as args, and grant Full Disk Access to node.) Fully quit Claude Desktop from the menu bar and reopen it afterwards.
Set it up with an AI agent
Paste this into Claude (Claude Code, or any agent with shell access on your Mac) to install and connect the server for you:
Set up the iMessage MCP server from https://github.com/kashyapmanu/imessage-mcp on this Mac so I can use it in Claude Desktop. It is local-only and read-only.
1. Check that Node.js 22.13+ is installed (`node -v`). If not, tell me and stop.
2. Clone the repo into ~/Projects/imessage-mcp, then run `npm install` and `npm run build`. Run `npm run smoke` and report the result (it prints only counts, never message contents).
3. (The launcher build in the next step bakes in the node and dist/index.js paths, so nothing to do here.)
4. Run scripts/build-launcher.sh and use the resulting ~/.local/share/imessage-mcp/imessage-mcp-launcher as the "command" (no args). Back up ~/Library/Application Support/Claude/claude_desktop_config.json, then add an "imessage" entry under "mcpServers" with the launcher path as "command" and no "args". Keep every existing server entry unchanged and keep the JSON valid.
5. Tell me to add that launcher file (not node, not all of Node) to Full Disk Access (System Settings > Privacy & Security > Full Disk Access), then fully quit and reopen Claude Desktop. Do not change any system or security setting yourself.
6. After I restart, help me verify by asking Claude to list my 3 most recent chats. Do not print or store message contents beyond what I ask for.
Ask me before anything that is not on this list.Security and privacy
Runs entirely on your machine. There are no network calls and no third-party services.
The database is opened with
readOnly: trueandPRAGMA query_only. All SQL is parameterised, and the server issues onlySELECTstatements.Message content is returned to whichever MCP client you connect. Only connect clients you trust, because they will see your message history.
Logs go to stderr only, since stdout carries the protocol.
Smoke test
npm run build
npm run smokescripts/smoke.mjs starts the built server, lists the tools and calls list_chats with a limit of 3. It prints only counts and field names, never message contents.
Available Tools
6 toolsget_conversationGet conversation contextARead-only
Return the most recent messages of one chat in chronological order (oldest first). Use 'before' (ISO date) to page back into older context.
Inputs: chat_id (required), limit, before.
get_unreadGet unread incoming messagesARead-only
List incoming messages that Messages marks as unread, newest first. The unread flag comes from chat.db and may not match the Messages app exactly.
Inputs: limit.
list_chatsList iMessage chatsARead-only
List recent iMessage/SMS conversations, newest activity first. Returns chat id, name (group display name, else participant contact names, else handles), participant handles with their Contacts names (participant_names), last message time and message count. Use the chat id with read_messages, get_conversation.
Inputs: limit, offset.
list_contacts_handlesList handles with message countsARead-only
List phone numbers, emails and other Messages handles with their Contacts name (if any) and how many messages each has, most active first. Optional query matches a substring of the handle id or of a contact name.
Inputs: limit, query.
read_messagesRead iMessage messagesARead-only
Read messages newest-first, optionally filtered by chat id, contact (name, phone or email) and date range. Returns timestamp, sender (me or handle), sender_name from Contacts for incoming messages, text, is_from_me and attachment count. Tapbacks and group events are excluded.
Inputs: limit, since, until, offset, +2 more.
search_messagesSearch iMessage textARead-only
Case-insensitive substring search over message text, newest first. Also decodes attributedBody for messages whose plain text is empty. Optional contact (name, phone or email) and date filters are applied in SQL. Incoming messages include sender_name from Contacts. The scan is capped; the result says if the cap was hit, meaning the search was not exhaustive.
Inputs: query (required), limit, since, until, +1 more.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 6 tools
Most tools are clearly separated by resource and intent: list_chats for conversation inventory, get_unread for the unread queue, search_messages for text lookup, list_contacts_handles for handle/contact inventory. The only mild overlap is read_messages versus get_conversation, since both return message content; descriptions clarify that one is filtered newest-first and the other is per-chat chronological, so confusion is limited.
All six names follow a predictable verb_noun pattern in snake_case: list_chats, get_unread, read_messages, search_messages, get_conversation, list_contacts_handles. The verbs (list/get/read/search) are used sensibly and consistently with their semantics.
Six tools is a well-scoped set for an iMessage read/inspection server, with each tool covering a distinct access pattern (chat list, unread, message read, search, conversation context, contacts). Nothing feels redundant or padded.
The read-side surface is fairly comprehensive: chats, unread messages, message history, search, conversation paging, and contact/handle mapping. However, there is no send-message or reply operation, no explicit attachment retrieval despite attachment counts being reported, and no way to mark messages read, which are notable gaps for a messaging server.
Related MCP Connectors
Explore your Messages SQLite database to browse tables and inspect schemas with ease. Run flexible…
MCP connector for iMessage & Contacts via a local Mac agent + Vercel relay
Search your AI chat history (ChatGPT, Claude, Codex) from any MCP client. Remote, private, read-only
Your own WhatsApp as an MCP server: read, search and send from any MCP client.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceEnables reading, searching, and sending iMessages directly from MCP-compatible clients by accessing the local macOS iMessage database, supporting conversations, attachments, and both individual and group chats.10MIT
- AlicenseAqualityCmaintenanceRead-only MCP server for local macOS Messages database, enabling querying of chats, messages, attachments, and metadata.7MIT
- FlicenseNot gradedqualityCmaintenanceEnables AI clients to read and search macOS Messages history through a read-only MCP interface.-
- AlicenseNot gradedqualityCmaintenanceEnables MCP clients to search and read Apple Messages history on macOS, including conversation timelines, attachments, contact resolution, change syncing, communication analytics, and server status checks.6MIT