iMessage MCP Server
Click on "Install 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 Serversend 'Happy Birthday!' to Alice"
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 Server
An enterprise-grade Model Context Protocol (MCP) Server for macOS iMessage integration over Streamable HTTP and SSE transports.
It connects your local Mac's iMessage database (~/Library/Messages/chat.db), macOS Contacts (AddressBook), and Swift/AppleScript automation capabilities directly to AI assistants (Antigravity, Claude Desktop, Cursor, Gemini CLI, etc.) running locally or over secure tunnels (Cloudflare Tunnel, Tailscale).
Features
Dual MCP Transports: Supports modern Streamable HTTP (
/mcp) and Server-Sent Events (/sse).Full-Text Message Search: Instant SQLite query across historical iMessage text and rich attributed bodies.
Contact Resolution: Integrates with macOS Contacts database (
AddressBook-v22.abcddb) to resolve names, phone numbers, and emails.Multimodal Attachment Reading: Exposes attachment metadata (MIME type, size, path) and automatically converts
.heicphotos to.jpgfor vision-capable LLMs.Single-Bubble Attachment Sending: Swift NSPasteboard + System Events paste pipeline that combines text and file attachments into a single message bubble without triggering "Not Delivered" sandboxing failures.
Group Chat Rosters: Inspects group conversation member lists and handles.
Bearer Token Auth: Secures all MCP endpoints behind customizable Bearer token authentication.
Related MCP server: jons-mcp-imessage
Architecture Overview
┌─────────────────────────┐ HTTP/SSE ┌──────────────────────────────┐
│ AI Assistant / Client │ ─────────────────────────> │ iMessage MCP Server │
│ (Claude, Antigravity) │ <Authorization: Bearer> │ (Node.js / Express / TS) │
└─────────────────────────┘ └──────────────┬───────────────┘
│
▼
┌──────────────────────────────┐
│ macOS iMessage CLI │
│ (bin/imessage python script)│
└──────────────┬───────────────┘
│
┌─────────────────────────────────────────────┼────────────────────────────────────────────┐
▼ ▼ ▼
┌──────────────────────────┐ ┌──────────────────────────┐ ┌──────────────────────────┐
│ Messages DB (Read-Only) │ │ Contacts DB (Read-Only) │ │ Messages.app Automation │
│ ~/Library/Messages/chat.db│ │ AddressBook-v22.abcddb │ │ Swift NSPasteboard + GUI │
└──────────────────────────┘ └──────────────────────────┘ └──────────────────────────┘Prerequisites
Host Machine: macOS 12 (Monterey), 13 (Ventura), 14 (Sonoma), or 15 (Sequoia).
Node.js:
>=24.0.0(Active LTS).Package Manager:
pnpm(npm install -g pnpm).Python: Python 3.9+ (built-in macOS python3 or Homebrew).
Messages App: Signed into an active Apple ID / iMessage account.
Installation & Setup Guide
1. Clone & Install Dependencies
git clone https://github.com/genericService/imessage-mcp-server.git
cd imessage-mcp-server
pnpm install2. Configure Environment & Bearer Token
Create a .env file in the project root:
cp .env.example .envEdit .env to set your desired port and a strong random Bearer token:
PORT=8765
AUTH_TOKEN=your-secure-random-bearer-token-here
USE_HTTPS=false3. Grant macOS TCC & System Permissions
Due to macOS privacy safeguards (TCC), the process executing the server requires Full Disk Access and Accessibility permissions.
A. Full Disk Access (Required to read chat.db)
Open System Settings → Privacy & Security → Full Disk Access.
Enable the toggle for Terminal (or sshd-daemon if running remotely over SSH).
B. Accessibility & Automation (Required for sending attachments)
Open System Settings → Privacy & Security → Accessibility.
Click
+, pressCmd + Shift + G, paste/usr/libexec/sshd-keygen-wrapper(or your Terminal app path), and click Open.Ensure the toggle switch is turned ON.
Open System Settings → Privacy & Security → Automation and ensure Terminal / sshd has permission to control System Events and Messages.
4. Build & Start Server
# Build TypeScript
pnpm build
# Run in production mode
pnpm startClient Configuration (mcp_config.json)
To connect an AI client (Antigravity, Cursor, Claude Desktop, etc.) to the iMessage MCP server:
1. Native Direct HTTP Transport (Recommended)
Modern MCP clients support direct HTTP / SSE transport definitions with custom headers (Bearer token & Cloudflare Access tokens) without any external bridge process:
{
"mcpServers": {
"imessage": {
"url": "https://imessage.genericservice.app/mcp",
"headers": {
"Authorization": "Bearer YOUR_AUTH_TOKEN",
"CF-Access-Client-Id": "YOUR_CLIENT_ID.access",
"CF-Access-Client-Secret": "YOUR_CLIENT_SECRET"
}
}
}
}2. Local Network (Direct HTTP)
{
"mcpServers": {
"imessage": {
"url": "http://localhost:8765/mcp",
"headers": {
"Authorization": "Bearer YOUR_AUTH_TOKEN"
}
}
}
}3. Legacy mcp-remote Stdio Bridge (Optional)
If your client only supports stdio command execution:
{
"mcpServers": {
"imessage": {
"command": "pnpm",
"args": [
"dlx",
"mcp-remote",
"https://imessage.genericservice.app/mcp",
"--header",
"Authorization: Bearer YOUR_AUTH_TOKEN"
],
"trust": true
}
}
}OAuth 2.0 Auth Server (CLI & Online Agents)
The server embeds a native OAuth 2.0 Authorization Server supporting RFC 8414 metadata, Client Credentials grant, and Authorization Code grant with PKCE for CLI tools (Claude Code, Antigravity CLI, Codex) and online services (ChatGPT Actions, custom GPTs, web apps).
1. Server Metadata Endpoint
Discovery URL:
https://imessage.genericservice.app/.well-known/oauth-authorization-serverAuthorization Endpoint:
https://imessage.genericservice.app/oauth/authorizeToken Endpoint:
https://imessage.genericservice.app/oauth/token
2. Client Credentials Token Exchange (CLI & Headless Agents)
Agents can exchange client_id and client_secret for a signed HS256 JWT access token:
curl -X POST https://imessage.genericservice.app/oauth/token \
-H "Content-Type: application/json" \
-d '{
"grant_type": "client_credentials",
"client_id": "antigravity-cli",
"client_secret": "YOUR_SERVICE_SECRET"
}'Returns:
{
"access_token": "eyJhbGciOiJIUzI1Ni...",
"token_type": "Bearer",
"expires_in": 3600,
"refresh_token": "ref_5ae1f64eb91...",
"scope": "imessage:all"
}3. Interactive Web & Online Agents (ChatGPT / Web Apps)
Point your client to
https://imessage.genericservice.app/oauth/authorize.The user sees a branded authorization consent screen on the Mac host.
Upon approval, the server redirects with an authorization code exchanged at
/oauth/token.
Available MCP Tools
Tool Name | Description | Key Parameters |
| List recent conversations with AddressBook names and participant sets |
|
| Read message history with inline attachment details |
|
| Preview last N messages to verify thread context before sending |
|
| Full-text search across all historical iMessages |
|
| Exact participant set search across group chats |
|
| Search macOS Address Book by name, phone, or email |
|
| List members and resolved contact names in group chats |
|
| Fetch attachment metadata and base64 payload (HEIC to JPEG) |
|
| Send iMessage to contact, group chat thread, or chat ROWID (supports dry_run preview & confirm_token) |
|
| Retrieve full server README documentation & usage guide | (none) |
Security & Local Action Audit Logging
To maintain absolute privacy and trauma-informed data autonomy, the server never stores or logs personal message text, passwords, or attachment bytes.
If you wish to log AI agent action executions for security auditing, set ENABLE_AUDIT_LOG=true in your .env file. This appends structured JSON audit lines to logs/audit.log:
{
"timestamp": "2026-07-25T00:46:45Z",
"tool": "imessage_send_message",
"target": "Sarah (+14802016076)",
"dry_run": true,
"status": "success",
"duration_ms": 42
}Known Limitations & Considerations
Host Mac Requirement: Must run on a physical Mac or macOS VM signed into an active Apple ID.
AppleScript Attachment Sandboxing: Native AppleScript
send aliasin macOS Sonoma/Sequoia marks attachments as "Not Delivered". This server bypasses that bug using a Swift NSPasteboard paste workflow; therefore, the host Mac must be in an active Aqua GUI session.Read-Only SQLite Access: Database reads use
URI mode=ro(sqlite3.connect('file:chat.db?mode=ro', uri=True)) to ensurechat.dbis never locked or corrupted by server reads.SMS vs iMessage: Text-only messages fallback gracefully to SMS if the recipient handle is a mobile phone number registered on your iPhone's Text Message Forwarding network.
License
This project is licensed under the MIT License.
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
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/genericService/imessage-mcp-server'
If you have feedback or need assistance with the MCP directory API, please join our Discord server