messages
Enables fuzzy search and browsing of Apple Messages (iMessage/SMS) with contact resolution, filtering by sender or date, and context display through CLI, MCP, or Claude Code plugin.
README
messages
Fuzzy search and browse Apple Messages (iMessage/SMS) from the command line, as a Claude Code plugin, or as an MCP server.
Features
- Fuzzy search with typo tolerance across all your messages
- Browse recent messages, contacts, and conversations
- Contact resolution - shows names instead of phone numbers
- Context display - see messages before/after each match
- Filter by sender or date range
- Auto-indexing - index automatically rebuilds when new messages are detected
- Multiple interfaces - CLI, MCP server, or Claude Code plugin
Requirements
- macOS (reads from Apple Messages database)
- Node.js 22+
- Full Disk Access permission for your terminal (to read
~/Library/Messages/chat.db)
Installation
Homebrew
brew install cardmagic/tap/messages
npm
npm install -g @cardmagic/messages
Claude Code Plugin (recommended)
Install as a plugin to get skills (auto-invoked) and slash commands:
# Add the marketplace
claude plugin marketplace add cardmagic/ai-marketplace
# Install the plugin
claude plugin install messages@cardmagic
This gives you:
- Skill: Claude automatically searches messages when you ask about texts/iMessages
- Slash commands:
/messages:search,/messages:recent,/messages:from, and more
MCP Server
For direct MCP tool access without the plugin:
claude mcp add --transport stdio messages -- npx -y @cardmagic/messages --mcp
Or install globally first:
npm install -g @cardmagic/messages
claude mcp add --transport stdio messages -- messages --mcp
From source
git clone https://github.com/cardmagic/messages.git
cd messages
make install
# Then add as plugin OR MCP server:
claude plugin marketplace add cardmagic/ai-marketplace
claude plugin install messages@cardmagic
# OR
claude mcp add --transport stdio messages -- messages --mcp
Granting Full Disk Access
The tool needs to read your Messages database at ~/Library/Messages/chat.db:
- Open System Settings > Privacy & Security > Full Disk Access
- Click + and add your terminal app (Terminal.app, iTerm, Warp, etc.)
- Restart your terminal
Usage
CLI
Browse Commands
# Show most recent messages (who texted me?)
messages recent
# List contacts by recent activity
messages contacts --limit 10
# List conversations with message counts
messages conversations
# Show recent messages from someone
messages from "Mom"
# Show full conversation thread
messages thread "John" --after 2024-12-01
Search Commands
# Search for messages (index auto-builds on first search)
messages search "coffee tomorrow"
# Filter by sender
messages search "dinner" --from "Mom"
# Filter by date
messages search "meeting" --after 2024-01-01
# Adjust result count and context
messages search "project" --limit 20 --context 5
# Show index statistics
messages stats
# Force rebuild the index
messages index
Search Options
| Option | Description |
|---|---|
-f, --from <sender> |
Filter by sender name or phone |
-a, --after <date> |
Only messages after date (YYYY-MM-DD) |
-l, --limit <n> |
Max results (default: 10) |
-c, --context <n> |
Messages before/after (default: 2) |
Claude Code Plugin
When installed as a plugin, you get:
Skill (auto-invoked): Claude automatically searches messages when you ask things like:
- "What did Mom say about dinner?"
- "Who texted me recently?"
- "Find messages about the trip"
Slash Commands:
| Command | Description |
|---|---|
/messages:search <query> |
Fuzzy search with optional filters |
/messages:recent |
Show most recent messages |
/messages:contacts |
List contacts by activity |
/messages:conversations |
List conversations with message counts |
/messages:from "Name" |
Messages from a specific person |
/messages:thread "Name" |
Full conversation thread |
/messages:browse <cmd> |
Alias for browse commands |
MCP Server
When installed as an MCP server, Claude Code can use these tools:
| Tool | Description |
|---|---|
search_messages |
Search messages with fuzzy matching |
recent_messages |
Get most recent messages |
list_contacts |
List contacts by activity |
list_conversations |
List conversations with counts |
get_thread |
Get conversation thread with a contact |
get_message_stats |
Get index statistics |
Manual MCP Configuration
For Claude Desktop or VS Code, add to your MCP configuration:
{
"mcpServers": {
"messages": {
"command": "npx",
"args": ["-y", "@cardmagic/messages", "--mcp"]
}
}
}
How It Works
-
Auto-Indexing: On first search (or when new messages are detected), the tool automatically:
- Reads your Apple Messages SQLite database
- Builds a SQLite FTS5 full-text search index
- Creates a MiniSearch fuzzy search index
- Resolves contact names from your Address Book
-
Searching: Queries both indexes for best results with typo tolerance
-
Storage: Index files are stored in
~/.messages/:index.db- SQLite FTS5 databasefuzzy.json- MiniSearch indexstats.json- Index statistics
License
MIT
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。