An MCP server that provides safe access to your iMessage database through Model Context Protocol (MCP). This server is built with the FastMCP framework and the imessagedb library, enabling LLMs to que
An MCP server that provides safe access to your iMessage database through Model Context Protocol (MCP). This server is built with the FastMCP framework and the imessagedb library, enabling LLMs to query and analyze iMessage conversations with proper phone number validation and automatic macOS permission handling.
This project uses uv
for fast, reliable Python package management. Install it first:
# Install uv using Homebrew (recommended)
brew install uv
# Or install using the official installer
curl -LsSf https://astral.sh/uv/install.sh | sh
The script automatically manages its dependencies using the embedded metadata. No separate installation needed! Dependencies include:
All dependencies are automatically installed when the script runs via uv
.
The server exposes the following tools to LLMs:
Retrieve message history for a specific phone number with optional date filtering.
Parameters:
phone_number
(required): Phone number in any format (E.164 format preferred)start_date
(optional): Start date in ISO format (YYYY-MM-DD)end_date
(optional): End date in ISO format (YYYY-MM-DD)Features:
Clone the repository:
git clone https://github.com/hannesrudolph/imessage-query-fastmcp-mcp-server.git
cd imessage-query-fastmcp-mcp-server
You can install this MCP server in Claude Desktop, Cline VSCode plugin, or any other MCP client. Choose the option that best suits your needs.
~/Library/Application Support/Claude/claude_desktop_config.json
{
"mcpServers": {
"imessage-query": {
"command": "/full/path/to/imessage-query-server.py"
}
}
}
/Users/username/Projects/imessage-query-fastmcp-mcp-server/imessage-query-server.py
)To use this server with the Cline VSCode plugin:
{
"imessage-query": {
"command": "/full/path/to/imessage-query-server.py"
}
}
For other MCP clients, use the direct script path as the command:
/full/path/to/imessage-query-server.py
The script's shebang (#!/usr/bin/env -S uv run --script
) handles dependency management automatically.
Note: This simplified configuration replaces the previous FastMCP installation method. The script is now self-contained and manages its own dependencies through
uv
.
This server requires Full Disk Access permission to read the iMessage database. The server includes intelligent permission detection and will guide you through the setup process.
When you first use the server, it will:
If automatic detection doesn't work, follow these steps:
/Applications/Claude.app
/Applications/Cursor.app
/Applications/Visual Studio Code.app
This server only requires read access to your iMessage database. It cannot modify, delete, or send messages.
The repository includes comprehensive documentation for development:
dev_docs/imessagedb-documentation.txt
: Complete documentation about the iMessage database structure and the imessagedb library's capabilitiesdev_docs/fastmcp-documentation.txt
: FastMCP framework details and MCP tool developmentdev_docs/mcp-documentation.txt
: Model Context Protocol specificationThis documentation serves as context when developing features and can be used with LLMs to assist in development.
Variable | Description | Default |
---|---|---|
SQLITE_DB_PATH | Custom path to iMessage database | ~/Library/Messages/chat.db |
The server automatically locates the iMessage database in the default macOS location. The environment variable is only needed for custom database locations.
If you need to use a custom database path:
export SQLITE_DB_PATH="/path/to/custom/chat.db"
Test the server directly using mcptools (github.com/f/mcptools):
# Navigate to the repository directory
cd /path/to/imessage-query-fastmcp-mcp-server
# List available tools
mcp tools ./imessage-query-server.py
# Test a tool call
mcp call get_chat_transcript ./imessage-query-server.py -p '{"phone_number": "+1234567890"}'
The script will automatically handle dependency installation via uv
when first run.
"β Full Disk Access permission required"
"Messages database not found"
"Invalid phone number"
If you encounter issues:
hannesrudolph/imessage-query-fastmcp-mcp-server
December 15, 2024
June 30, 2025
Python