mac-messages
Mac Messages Host
你的 Mac 上完整的 Apple Messages(iMessage/SMS)历史记录,只读,供 AI 代理使用 —— 一个通过 REST/OpenAPI 和可流式 HTTP MCP 提供的批处理工具。
一个工具,批量请求:单个
messages(requests: str)工具接收一个 JSON 请求数组,并返回一个对齐的 JSON 响应数组——一次调用完成许多独立的操作。它通过 REST(POST /api/messages)和 MCP(/mcp/)提供完全相同的功能。构造上只读:数据库以 SQLite
mode=ro方式打开;没有任何写入路径。无法发送、编辑或删除任何内容。现代 macOS 正文解码:存储在
attributedBodytypedstream 块(Ventura 及更高版本)中的消息文本,以及message_summary_infoplist 中的编辑历史,都会被透明地解码。自动生成的工具提示词:面向 AI 的提示词由 Pydantic 模型生成(约 615 个 gpt-4o token,由
tiktoken计数并由测试强制约束);tool_prompt.md快照通过漂移测试保持同步。
安装
需要 macOS 上的 Python 3.11+。
pip install . # or: pip install -e . for development
mmhost info # permission check + database status
mmhost start # serve API + MCP on http://127.0.0.1:8761macOS 权限(重要)
~/Library/Messages/chat.db 受 macOS TCC 保护。运行 mmhost 的进程需要具有完全磁盘访问权限:
System Settings → Privacy & Security → Full Disk Access → 启用你的终端应用(或任何启动服务器的程序),然后重新启动它。
mmhost info 会立即告诉你数据库是否可读。
Related MCP server: jons-mcp-imessage
端点
端点 | 用途 |
| 批量工具(REST) |
| OpenAPI 规范 |
| 交互式文档 |
| 存活探针 |
| 可流式 HTTP MCP 端点(单个 |
认证
当配置了 admin_token(持久化配置、MMHOST_ADMIN_TOKEN 或 --admin-token)时,使用 Authorization: Bearer <token>。如果未配置令牌,则访问是开放的——这是安全的,因为服务器默认绑定 127.0.0.1。
请求类型
get_info— 数据库状态、计数、历史日期范围list_chats— 按最近活跃度列出会话(筛选、分页)get_chat— 某个会话的完整记录(通过before向前分页)get_recent— 所有会话中的最新消息(通过since轮询)search_messages— 对正文进行不区分大小写的子串搜索
有关由模型生成的准确面向 AI 的文档,请参阅 tool_prompt.md。
示例
curl -s http://127.0.0.1:8761/api/messages \
-H 'Content-Type: application/json' \
-d '{"requests": "[{\"kind\":\"list_chats\",\"limit\":3}]"}'MCP 客户端配置
{
"mcpServers": {
"mac-messages": {
"type": "streamable-http",
"url": "http://127.0.0.1:8761/mcp/"
}
}
}配置
持久化保存在平台配置目录中(macOS 上为 ~/Library/Application Support/mac_messages_host/config.json);可以通过 MMHOST_CONFIG 覆盖位置。仅包含服务器级设置——参阅 example.env。
开发
pip install -e '.[dev]'
pytest
# after changing request models:
python -m tests.regenerate_tool_prompt架构遵循 oWoHo AI Tool Server 模式(纯核心库 + 派生的 FastAPI/FastMCP/CLI 接口),与 reddit_tool_server 和 obsidian_ai_miniserver 类似。
许可证
MIT——参阅 LICENSE.md。
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.
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.10410MIT
- AlicenseAqualityDmaintenanceEnables AI assistants to read iMessage history and send messages on macOS. Supports conversation listing, message search with keyword and semantic modes, contact lookup, and sending messages to existing conversations.1311MIT
- AlicenseNot gradedqualityCmaintenanceEnables AI assistants to read, search, and send iMessages with features like contact name resolution, session grouping, and attachment listing. It provides intent-aligned tools to efficiently navigate conversation history and manage messages through natural language queries.5MIT
- AlicenseNot gradedqualityDmaintenanceEnables reading and sending iMessages on macOS through MCP, with tools for managing chats, messages, and attachments via AI agents.MIT
Related MCP Connectors
MCP connector for iMessage & Contacts via a local Mac agent + Vercel relay
Search, read, and write your Apple Notes from ChatGPT/Claude via a local Mac agent + MCP relay.
Let ChatGPT, Claude & Cursor use your Mac: email, calendar, iMessage, Teams, files. Local, free.
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/whogben/mac_messages_host'
If you have feedback or need assistance with the MCP directory API, please join our Discord server