iMessage MCP Server & CLI

A free, open source iMessage MCP server and CLI that lets Claude Code, Codex, Cursor and other AI agents catch you up, search your history and send messages, on your Mac.

Navid Moazzezby Navid Moazzez·Updated Oct 5, 2026·11 min read·
  1. 1

    Add it with a single command in a terminal.

    claude mcp add imessage \
    -- npx -y @thenavidm/imessage-mcp-cli@latest
  2. 2

    In Claude Code, type /mcp. iMessage should show as connected.

    /mcp

Mac only. Needs Node 22.13 or newer, and Full Disk Access for the app that runs it. Turn it on.

It's free and open source. If it saves you time, star it on GitHub, so more people find it.

Rate this tool

This free iMessage MCP server and CLI gives your AI real access to your Messages history on your Mac, and the Messages app itself. It keeps an inbox that remembers what you've already seen, searches your full history, looks people up in Contacts, sends messages and files, and transcribes voice notes.

It's one install with two ways in. Claude, Codex, Cursor or any other MCP app calls its 10 tools for you, and the same tools work as a CLI that agents like Claude Code, Codex and OpenCode run, or that you type yourself.

In this guide, I'll show you:

  • What the iMessage MCP server & CLI is, and what you can ask it
  • How to install it and check that it works
  • When to use the MCP server, and when the CLI
  • Every tool, and how to keep your account safe

Every tool on this page comes from the server itself, and every cost was measured in Claude Code.

key_takeaways.mdTL;DR

Key takeaways

It gives your AI 10 tools for Messages on your Mac: an inbox that remembers what you've seen, search across your full history, contacts and sending.
Every send waits for your approval, and the approval shows the recipient and the words.
It transcribes voice notes, and reading changes nothing in Messages.
The same tools run as a CLI, which costs your AI nothing until it runs.

What is the iMessage MCP server & CLI?

The iMessage MCP server & CLI is a free, open source program that lets AI agents read, search and send your iMessages for you, in two ways. The MCP server is what an AI app like Claude, Codex or Cursor connects to, through MCP (Model Context Protocol), the open standard AI apps use to call outside tools.

You ask in plain language. Your AI picks the right tool, and the server makes the call to the Messages database right on your Mac.

The CLI is the same program as commands. imessage-cli inbox runs the same code your AI runs when you ask what you missed, whether an agent like Claude Code runs it or you do.

In an AI OS, the layer that connects your AI to your context, your data and your tools, a server like this is how your AI reaches iMessage. My guide to building an AI operating system names iMessage among the tools it reaches, and here's how I use AI myself.

What can you ask it?

Once it's set up, you ask the way you'd ask an assistant. These are real prompts it handles:

Try asking
What did I miss?
What did Mike say about the invoice last month?
Text Anna that I'm running fifteen minutes late.
Transcribe that voice note.
Who have I not replied to this week?
Find the address someone sent me in March.

The first one shows why this is useful. The inbox keeps its place on disk, so it covers everything since you last asked, even while nothing was running.

It works well next to my Google Workspace MCP server and Telegram MCP server, so your AI can check your Gmail and catch up on your Telegram chats in the same chat. Every server I've made is on my MCP servers page.

For your messages, my free voice memo to text converter and text summarizer help too.

How to install the iMessage MCP server

Pick your app in the box at the top of this page. Each one is a single command or a pasted block, and there's no account or key to add.

Windsurf, Zed and Cline take the same server, though they don't have a tab in the box yet. Follow the box's Cursor tab, and put its block here instead:

AppWhere the block goes
WindsurfIn the Cascade panel, open the Actions menu (…) and choose Open MCP config file, then paste the block.
ClineClick the MCP Servers icon in the Cline panel, open the Configure tab, click Configure MCP Servers, and paste the block.
ZedGo to Settings, then AI, then MCP Servers, and choose Add Server, then Add Local Server. Enter the block's command, arguments and variables, and Zed saves them under context_servers.
Before you start0/3

Watch out: It can read every conversation in your Messages database, and a message it sends comes from your own account and can't be unsent. Connect it only to an AI app you trust with your messages.

Give it access to your messages

There's no sign-in. macOS asks twice, at different moments.

Turn on Full Disk Access, for reading0/4

The first time it sends anything, macOS asks whether that app may control Messages. Allow it. That prompt appears once, and only if you send.

Check that it works

Run the doctor. It checks the database, your contacts, the inbox cursor and the voice note tools.

npx -y @thenavidm/imessage-mcp-cli doctor

If the database line fails, Full Disk Access is missing for the app that runs it, and remember the Cmd+Q.

In Claude Code, /mcp also shows whether the iMessage server is connected. It's one of the Claude Code commands worth knowing.

Use the iMessage CLI

The CLI is the same 10 tools as commands. AI agents that run commands, like Claude Code, Codex and OpenCode, use it on their own, and you can type the same commands in a terminal or a script.

Every tool name becomes a command with dashes, so search_messages runs as imessage-cli search-messages.

npm install -g @thenavidm/imessage-mcp-cli
imessage-cli
imessage-cli inbox --peek
imessage-cli search-messages --query "invoice" --limit 10
imessage-cli resolve-contact --name "Sarah"

The bare imessage-cli lists every command, imessage-cli which <words> finds the command for a task, and imessage-cli <command> --help shows what a command takes. Sending needs --confirm, the terminal's version of your approval.

imessage-cli install <app> adds the server to Claude Code, Codex, Claude Desktop, Cursor, VS Code or Gemini CLI, in each app's own format.

These are the flags you'll use most:

FlagWhat it does
--jsonPrints JSON
--compactPrints the JSON on one line
--select a,b.cKeeps only those fields, and a dotted path goes deeper
--agentMachine mode: compact JSON, no prompts, and it never confirms anything
--confirmLets a write that asks first go ahead
--dry-runShows what a write would do, without doing it

A script can branch on the exit code:

Exit codeWhat it means
0It worked
2The command was typed wrong, or a send needed --confirm
3It wasn't found
4macOS refused access, so turn on Full Disk Access or allow Automation for Messages
5Messages or a transcription service failed

MCP server or CLI: which one?

Both are the same program with the same 10 tools. The difference is when your AI pays for them, in the tokens it reads.

Every message, in an app that loads every tool
MCP server
1,700 tokens
CLI
Nothing
Every message, in Claude Code
MCP server
110 tokens
CLI
Nothing
When iMessage comes up
MCP server
Nothing more, or in Claude Code the tools it picks
CLI
2,200 tokens, once
20 messages with iMessage in one, every tool loaded
MCP server
35,000 tokens
CLI
2,200 tokens
Works in Claude Desktop's chat
MCP server
Yes
CLI
No, there's no terminal there
Works in a script, a cron job or CI
MCP server
No
CLI
Yes

An app that loads every tool up front sends the full list with every message, whether you mention iMessage or not. Claude Code doesn't by default: its tool search sends only the tool names and the server's instructions, and loads a tool's full definition when your AI reaches for it.

The CLI costs nothing until iMessage comes up. Then your agent reads its skill file once and runs the commands it needs. With the skill added, Claude Code also lists its one-line description with every message, about 80 tokens.

When the whole conversation is about iMessage, the gap closes. Then the MCP server is the better experience, because you ask in plain language and your AI never has to look up a command.

How to spend less

In Claude Code, leave tool search on, which it is unless you've set ENABLE_TOOL_SEARCH=false.

Turn the server off when you aren't using it, with your AI app's own switch.

Or install the CLI and connect the server later, on the days it earns its place. Every tool stays in reach, and the standing cost drops to nothing.

Every number here was measured on October 5, 2026 in Claude Code 2.1.286 with Claude Opus 5.5. It's the same one-line prompt with and without the server connected, once with tool search off so every tool loads, and once with Claude Code's default. The skill was measured the same way, and other apps and models count tokens a little differently.

The inbox remembers where you were

The inbox keeps its place in ~/.imessage-mcp/state.json, so you can close everything, come back two days later and ask what you missed. It's written safely, so a crash can't make it skip or repeat messages.

The first call returns nothing, because it starts at the end of your history rather than dumping years of messages. It includes your own sends, which makes note-to-self work, and includeFromMe: false leaves them out.

Voice notes

Transcription has 4 providers, and only one keeps the audio on your Mac.

groq
What it is
Whisper on Groq's servers, the default and the cheapest
Audio leaves your Mac
Yes
local
What it is
Whisper on your own Mac, with a whisper command installed
Audio leaves your Mac
No
openai
What it is
Whisper on OpenAI's servers
Audio leaves your Mac
Yes
elevenlabs
What it is
ElevenLabs' Scribe model, strongest across languages
Audio leaves your Mac
Yes

Set IMESSAGE_TRANSCRIBE to choose, and put the provider's key in its environment variable. ffmpeg is needed for every provider.

Every iMessage tool

The tables below list all 10 tools, grouped the way the README groups them. Of these, seven only read, and the rest send, speak or move the inbox's place.

The inbox

inbox
What it does
Messages that have arrived since this tool last ran.
Kind
Reads

Reading

search_messages
What it does
Search message history by text, sender, chat, or date range.
Kind
Reads
list_conversations
What it does
List chats by most recent activity, with resolved contact names and participants.
Kind
Reads
get_conversation
What it does
Read one conversation in order, oldest first.
Kind
Reads

Contacts

resolve_contact
What it does
Look up a person in Contacts by name and return their sendable handles.
Kind
Reads

Sending

send_message
What it does
Send a message to a phone number, email, or chat GUID.
Kind
Asks first
send_file
What it does
Send a file by absolute path.
Kind
Asks first

Voice

transcribe_voice_note
What it does
Transcribe an audio attachment to text.
Kind
Reads
speak
What it does
Turn text into speech with ElevenLabs and return the audio file path, optionally sending it.
Kind
Asks first

Status

server_status
What it does
Database reachability, cursor position, contact count, and which optional tools are installed.
Kind
Reads

Is the iMessage MCP server safe?

Reading changes nothing. Sending is the one thing to be careful with, because a message goes to a real person from your own account and can't be unsent, so every send asks first.

send_message, send_file and speak with a recipient ask first, marked "Asks first" in the tool tables above. The approval shows the recipient and the words, so you see exactly what would go before you say yes.

When your AI calls one of them, the call needs a yes first. Where you use it decides who gives it:

  • Claude Code (2.1.246 and later) asks you before every call, in every one of its permission modes.
  • An app that can show forms asks you in a form.
  • Any other app takes your AI's confirm: true as the yes, so tell your AI to check with you first.
  • An agent with no person to ask needs IMESSAGE_CONFIRM=model, so its confirm: true counts in every app.
  • In a terminal, you add --confirm to the command.

If the answer is no, nothing reaches iMessage.

Make it read-only

Set IMESSAGE_READ_ONLY=1 and the three sending tools disappear from the list, so an agent that should only read never sees them. The inbox still works, because the only thing it writes is its own place on disk.

Keep a log of every write

Set IMESSAGE_AUDIT_LOG to a file path. The server writes one line per attempted write, allowed or blocked, with what it was about to do and who approved it.

Watch out: Anyone who can text you can put words in front of your AI. Treat instructions inside messages as hostile, and check who you're about to text, because matching on the last 7 digits of a number can collide across countries.

Your data

Nothing leaves your Mac, except in 2 cases. Voice transcription uploads the audio unless the provider is local, and speak sends its text to ElevenLabs.

The only thing this server writes is ~/.imessage-mcp/state.json, which holds one number and a timestamp. No message is copied, cached or indexed. Whatever your AI reads goes to its own model provider, like anything you paste into a chat.

iMessage MCP server settings

Every setting is optional, as an environment variable in your app's config.

IMESSAGE_DB
Default
~/Library/Messages/chat.db
What it does
Points at another copy of the database
IMESSAGE_STATE_DIR
Default
~/.imessage-mcp
What it does
Sets where the inbox keeps its place
IMESSAGE_READ_ONLY
Default
off
What it does
1 takes the sending tools away. Reading and the inbox still work
IMESSAGE_AUDIT_LOG
Default
none
What it does
Names a file that gets one line per send attempt, with the recipient but never the words
IMESSAGE_TRANSCRIBE
Default
groq
What it does
Picks the transcription provider: groq, local, openai or elevenlabs
GROQ_API_KEY
Default
none
What it does
Holds the key for the default provider
OPENAI_API_KEY
Default
none
What it does
Holds the key for openai
ELEVENLABS_API_KEY
Default
none
What it does
Holds the key for speak and for elevenlabs transcription
ELEVENLABS_VOICE_ID
Default
none
What it does
Sets the voice speak uses
IMESSAGE_WHISPER_MODEL
Default
base
What it does
The local Whisper model
GROQ_WHISPER_MODEL
Default
whisper-large-v3-turbo
What it does
Groq's model
OPENAI_WHISPER_MODEL
Default
whisper-1
What it does
OpenAI's model
ELEVENLABS_MODEL_ID
Default
eleven_multilingual_v2
What it does
The speech model
ELEVENLABS_STT_MODEL
Default
scribe_v1
What it does
ElevenLabs' transcription model
IMESSAGE_ALLOW_DESTRUCTIVE
Default
on
What it does
0 refuses the writes that can't be undone
IMESSAGE_SURFACE
Default
full
What it does
search lists three tools that find, describe and run the rest
IMESSAGE_TOOL_TIMEOUT_MS
Default
none
What it does
Gives up on any tool after this many milliseconds
IMESSAGE_CONFIRM
Default
human
What it does
model lets your AI's confirm: true approve on its own, for an agent with no person to ask
IMESSAGE_HTTP_PORT
Default
8787
What it does
Sets the port for --http
IMESSAGE_HTTP_HOST
Default
127.0.0.1
What it does
Sets the address for --http, and any other needs a token
IMESSAGE_HTTP_TOKEN
Default
none
What it does
Sets the bearer token every --http request needs
IMESSAGE_HTTP_ALLOWED_ORIGINS
Default
none
What it does
Lists other websites allowed to call --http, comma separated
IMESSAGE_DEBUG
Default
off
What it does
1 prints debug lines

Troubleshooting

Run the doctor first. It names the step that failed and the fix.

What you seeWhat to do
Every tool says it can't read chat.dbTurn on Full Disk Access for the app that runs it, then quit it with Cmd+Q
The inbox returns nothing on a fresh installThat's expected. The first call starts at the end, so send yourself a message and ask again
Sends fail with no errorMessages must be open and signed in. Try one message by hand first
Contacts show as raw numbersThat person isn't in Contacts, or the number differs beyond the last 7 digits
Transcription failsRun the doctor, which names the provider and what it's missing

If the server doesn't show up in your app at all, run the command your app runs, in a terminal, and read the error.

More free tools for staying in touch

Make a QR code that opens a chat, or tag the links you send so you can see which ones people open.

FAQs about the iMessage MCP server & CLI

Here are the questions people ask most about the iMessage MCP server and CLI.

The iMessage MCP server & CLI is a free, open source program that lets an AI app like Claude, Codex or Cursor read, search and send your iMessages.

It has 10 tools for your inbox, search, contacts, sending and voice notes, and the same tools run as a CLI that agents like Claude Code and Codex use, or that you type yourself.

An MCP server is a standard way to give an AI app real access to a tool, so it can act instead of guessing.

MCP stands for Model Context Protocol, and Claude, Codex, Cursor and many other AI apps speak it.

Every server I've made is on my MCP servers page.

The iMessage CLI is the same program as the iMessage MCP server, run as commands.

AI agents like Claude Code, Codex and OpenCode run them for you, and you can type them in a terminal or a script.

One npm package installs both.

Use the iMessage MCP server in an AI app with no terminal, like Claude Desktop's chat, and the CLI in a terminal, a script or a cron job.

In an AI app that can run commands, like Claude Code, Codex or Cursor, the CLI is the lighter choice, because it costs nothing until it runs.

Yes, the iMessage MCP server is free and open source under the MIT license, with no account and no key.

Voice note transcription can use a paid provider, or run free on your Mac.

Yes, the iMessage MCP server reads the whole Messages database on your Mac, groups included.

There's no per-chat allowlist, so connect it only to an AI app you trust with your messages.

Yes, every send waits for your approval, because it goes from your own account and can't be unsent.

The approval shows the recipient and the words, so you see what would go before you say yes.

No, the iMessage MCP server only runs on a Mac, because the Messages database exists nowhere else.

No, the iMessage MCP server reads the history your Mac already synced through iCloud, and sends through the Messages app on your Mac.

The iMessage MCP server works with any app that speaks MCP.

That includes Claude Code, Claude Desktop, Codex, Cursor, VS Code, Windsurf, Zed, Cline, GitHub Copilot CLI, Gemini CLI, OpenCode, OpenClaw, Antigravity and Hermes, on your Mac.

I did.

I'm Navid Moazzez, and I made the iMessage MCP server & CLI as one of my free tools on navid.me.

You can read more about me.

The code is on GitHub under the MIT license, and the package is on npm.

More MCP servers & CLIs

Related free tools

Navid Moazzez

AI business strategist & AI OS builder

Navid Moazzez helps creators and founders master AI and build their own AI Operating System (AI OS) to automate their business and life.

Navid.me is reader-supported. When you buy through links on this site, I may earn an affiliate commission. Read the affiliate disclaimer.

Free AI newsletter

The most actionable AI newsletter for founders

Every week, get proven AI strategies, curated tools, and step-by-step systems to grow your audience, create better content, and build a profitable creator business.

No fluff, no filler, no BS. Just five minutes each week that might level up your online business and life.

P.S. Sign up now to get free access to my ultimate AI tools guide for creators.

Loved by 10,000+ readers
Loved by 10,000+ readers