imessage-mcp
imessage-mcp
一个只读的 MCP 服务器,将您的 iMessage 数据暴露给 Claude Code 和 Claude Desktop,并支持自动联系人姓名解析。
设置
1. 安装
cd ~/workspace/imessage-mcp
python3.12 -m venv .venv
source .venv/bin/activate
pip install -e .2. 授予完全磁盘访问权限
该服务器需要读取 ~/Library/Messages/chat.db 和联系人数据库。请为运行该服务器的应用程序授予完全磁盘访问权限:
打开 系统设置 → 隐私与安全性 → 完全磁盘访问权限
对于 Claude Code:添加您的终端应用程序(例如 Terminal, iTerm2, Ghostty)
对于 Claude Desktop:添加 Claude 应用程序
3. 配置 Claude Code
添加到 ~/.claude/settings.json:
{
"mcpServers": {
"imessage": {
"command": "/Users/jaredmoskowitz/workspace/imessage-mcp/.venv/bin/python",
"args": ["-m", "imessage_mcp"]
}
}
}4. 配置 Claude Desktop
添加到 ~/Library/Application Support/Claude/claude_desktop_config.json:
{
"mcpServers": {
"imessage": {
"command": "/Users/jaredmoskowitz/workspace/imessage-mcp/.venv/bin/python",
"args": ["-m", "imessage_mcp"]
}
}
}Related MCP server: imessage-rich-search
工具
list_chats
列出按最近活动排序的 iMessage 聊天记录。
limit(可选,默认 50):返回的最大聊天数
get_messages
获取特定聊天中的消息。
chat_id(必填):来自list_chats的聊天标识符limit(可选,默认 50):最大消息数since(可选):ISO 日期字符串 — 仅获取此日期之后的消息
search_messages
在所有聊天中搜索包含关键字的消息。
query(必填):搜索文本limit(可选,默认 50):最大结果数
使用示例
"列出我的群聊" "获取我的 Business Ideas 聊天中的最后 20 条消息" "在我的消息中搜索 'startup idea'"
Available Tools
3 toolsget_messagesA
Get messages from a specific iMessage chat.
Args: chat_id: The chat identifier (from list_chats) limit: Maximum number of messages to return (default 50) since: Only return messages after this ISO date (e.g. '2024-01-15' or '2024-01-15T10:30:00')
| Name | Required | Description | Default |
|---|---|---|---|
| chat_id | Yes | ||
| limit | No | ||
| since | No |
Output Schema
| Name | Required | Description |
|---|---|---|
| result | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations provided, so description must disclose behavior. It describes a read operation with filtering, but omits details like rate limits, permissions, or whether messages are sorted.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is concise with two short paragraphs: one for purpose, one for parameters. No unnecessary words or repetition.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
For a simple read tool with output schema, the description covers the key aspects: what it does and what each parameter does. Could mention sorting or pagination, but not essential.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema has 0% description coverage; the description adds crucial meaning by explaining chat_id as from list_chats, limit with its default, and since with ISO date examples.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the tool gets messages from a specific iMessage chat, distinguishing it from sibling search_messages by specifying the chat_id is obtained from list_chats.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description implies usage by stating chat_id comes from list_chats and provides limit/since filters, but does not explicitly compare to search_messages or advise when not to use this tool.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
list_chatsA
List iMessage chats sorted by most recent activity.
Args: limit: Maximum number of chats to return (default 50)
| Name | Required | Description | Default |
|---|---|---|---|
| limit | No |
Output Schema
| Name | Required | Description |
|---|---|---|
| result | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are provided, so the description carries the full burden. It mentions sorting by activity but does not disclose if it requires authentication, rate limits, pagination, or that it is read-only. It adds minimal behavioral context beyond the action itself.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is extremely terse: one sentence for purpose and one for the parameter. Every sentence earns its place with no wasted words.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the tool's simplicity (one parameter, output schema available), the description covers the essential purpose and parameter semantics. It lacks mention of sorting direction but 'most recent activity' implies descending. Mostly complete for a simple list tool.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The description explains the 'limit' parameter as 'Maximum number of chats to return (default 50)', adding meaning beyond the schema's type and default. With 0% schema coverage, this compensates adequately, though other implicit constraints are not mentioned.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states 'List iMessage chats sorted by most recent activity', using a specific verb and resource, and is differentiated from sibling tools (get_messages, search_messages) which focus on individual messages.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description provides no guidance on when to use this tool versus alternatives like get_messages or search_messages, nor any context for selection or prerequisites.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
search_messagesB
Search all iMessage chats for messages containing the query text.
Args: query: The text to search for limit: Maximum number of results to return (default 50)
| Name | Required | Description | Default |
|---|---|---|---|
| query | Yes | ||
| limit | No |
Output Schema
| Name | Required | Description |
|---|---|---|
| result | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are provided, so the description must disclose behavior. It only states that it searches all chats, without detailing performance, pagination, error handling, or what happens with empty queries or limits.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is very concise, with two sentences and a bullet list. It front-loads the core purpose. However, it could be more structured (e.g., separate sections) to improve readability for complex use cases.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the tool's simplicity (2 parameters, no nested objects) and the presence of an output schema, the description is mostly adequate. However, it lacks usage context and any mention of return structure, leaving some gaps for an agent.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 0%, yet the description adds only minimal clarification: 'The text to search for' for query and 'Maximum number of results to return (default 50)' for limit. This adds little beyond the schema's title fields, failing to compensate for the lack of schema descriptions.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the tool searches all iMessage chats for messages containing the query text, specifying the verb 'search', resource 'iMessage chats', and scope 'all'. It distinguishes from siblings 'get_messages' (which likely retrieves specific messages) and 'list_chats'.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
No guidance is provided on when to use this tool vs. its siblings ('get_messages', 'list_chats'), nor are there any prerequisites or exclusions mentioned. The agent is left to infer usage context without explicit direction.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
3 tool updates
v0.1.0- First observed
get_messages - First observed
list_chats - First observed
search_messages
TDQS
Scored across 3 tools
Each tool targets a distinct operation: listing chats, retrieving messages from a specific chat, and searching across all chats. There is no functional overlap.
All tool names follow a consistent verb_noun pattern using snake_case (list_chats, get_messages, search_messages), making the set predictable.
Three tools is appropriate for the server's scope, covering essential read operations without being too few or excessive.
The tool set provides solid coverage for reading iMessage data. A potential minor gap is the lack of a send message tool, but that may be intentional for a read-only server.
Maintenance
Related MCP Connectors
MCP connector for iMessage & Contacts via a local Mac agent + Vercel relay
Let Claude or ChatGPT search, read and send your WhatsApp messages over MCP. OAuth sign-in.
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
- AlicenseAqualityCmaintenanceA local MCP server that enables reading iMessage conversations and sending new messages through Claude Desktop. It provides secure, read-only access to your Mac's iMessage database and AppleScript-based message sending capabilities.6MIT
- AlicenseAqualityCmaintenanceEnables full-text search of macOS iMessages including link preview metadata. Works as an MCP server for Claude Desktop to search your messages locally.1MIT
- AlicenseNot gradedqualityDmaintenanceRead-only MCP server for your iMessage DB. No hosted service.MIT
- AlicenseNot gradedqualityDmaintenanceRead-only MCP server for local macOS Messages database, enabling querying of chats, messages, attachments, and metadata.246 npmMIT