Secure iMessage database access with MCP server for safe querying and conversation analysis
The iMessage Query MCP Server provides safe, standardized access to your macOS iMessage database through the Model Context Protocol (MCP). This server leverages FastMCP and imessagedb libraries, enabling LLMs like Claude Desktop, Continue, Cursor, and others to query and analyze your messaging data securely. By integrating this server, AI applications can gain read-only access to rich conversation histories, manage phone number validation, and handle attachments with precision.
The iMessage Query MCP Server offers a comprehensive suite of features that enhance the capabilities of AI applications through MCP. Key functionalities include:
These features are integral to MCP-capable AI applications, facilitating seamless integration and robust data utilization. The server acts as a bridge between the complex iMessage database structure and the simplified API provided by MCP.
The architecture of the iMessage Query MCP Server is designed around the FastMCP framework for efficient protocol handling. The core component, imessage-query-server.py
, serves as the entry point for all client connections, adhering to the strict read-only restrictions outlined by macOS.
graph TB
A[AI Application] -->|MCP Client| B[MCP Protocol]
B --> C[MCP Server]
C --> D[Data Source/Tool]
style A fill:#e1f5fe
style C fill:#f3e5f5
style D fill:#e8f5e8
In this protocol flow, an AI application interacts with the MCP client to request access to specific data. The protocol ensures secure and efficient data transfer between the server and its clients.
graph LR;
A[AI Application] ---> B[MCP Client]
B -- Request message --> C[MCP Server]
C [MCP Server Response]
C --> D[Data Source/Tool]
D ---> E[Filtered/Processed Data]
E ---> F[AIA Query Output]
This design ensures that the data flow is seamless and secure, with MCP servers handling the complex backend logic required for accessing and filtering data.
To set up the iMessage Query MCP Server, follow these steps:
Clone the Repository:
git clone https://github.com/hannesrudolph/imessage-query-fastmcp-mcp-server.git
cd imessage-query-fastmcp-mcp-server
Install Dependencies:
pip install -r requirements.txt
Run the Server:
fastmcp install imessage-query-server.py --name "iMessage Query"
or for Cline VSCode plugin integration:
Edit MCP Settings in Cline Plugin:
{
"imessage-query": {
"command": "uv",
"args": [
"run",
"--with",
"fastmcp",
"fastmcp",
"run",
"/path/to/repo/imessage-query-server.py"
]
}
}
Replace /path/to/repo
with the full path to where you cloned this repository.
A large customer service platform uses the iMessage Query MCP Server to retrieve historical conversations between support representatives and customers. By analyzing these interactions using an LLM, they can identify common issues, measure sentiment accurately, and improve their response strategies.
import requests
def get_chat_transcript(phone_number, start_date=None, end_date=None):
api_url = "http://localhost:8000/chat_transcript"
params = {"phone_number": phone_number}
if start_date:
params["start_date"] = start_date
if end_date:
params["end_date"] = end_date
response = requests.get(api_url, params=params)
return response.json()
A data analyst leverages the server to query large group conversations for specific patterns or keywords. This helps in understanding user behavior and tailoring marketing strategies.
query = "data analysis"
start_date = "2023-10-05"
end_date = "2023-10-10"
response = get_chat_transcript("1234567890", start_date, end_date)
print(response.json())
The iMessage Query MCP Server is compatible with several MCP clients:
MCP Client | Resources | Tools | Prompts | Status |
---|---|---|---|---|
Claude Desktop | ✅ | ✅ | ✅ | Full Support |
Continue | ✅ | ✅ | ✅ | Full Support |
Cursor | ❌ | ✅ | ❌ | Tools Only |
The compatibility matrix indicates that full support is provided for Claude Desktop and Continue, while Cursor lacks prompt functionality.
This MCP server ensures optimal performance with minimal overhead. It operates efficiently by leveraging optimized data retrieval mechanisms from the imessagedb library.
{
"mcpServers": {
"iMessageQuery": {
"command": "uv",
"args": [
"run",
"--with",
"fastmcp",
"fastmcp",
"run",
"/path/to/repo/imessage-query-server.py"
]
}
}
}
Ensure the iMessage Query MCP Server is thoroughly secured by configuring environment variables and securing API access keys. No specific environment variables are currently required, but you can configure additional security measures as needed.
Contributions are welcome! Developers interested in contributing should review the dev_docs/imessagedb-documentation.txt
file for detailed documentation on the imessagedb library's capabilities. Issues can be reported, and pull requests are encouraged to improve functionality and performance.
For further information and support within the broader MCP ecosystem, refer to the Model Context Protocol documentation or reach out to the community forums for additional resources.
By providing a robust and secure gateway into your iMessage database, the iMessage Query MCP Server empowers AI applications to extract valuable insights without compromising user privacy.
RuinedFooocus is a local AI image generator and chatbot image server for seamless creative control
Learn to set up MCP Airflow Database server for efficient database interactions and querying airflow data
Build stunning one-page websites track engagement create QR codes monetize content easily with Acalytica
Simplify MySQL queries with Java-based MysqlMcpServer for easy standard input-output communication
Explore CoRT MCP server for advanced self-arguing AI with multi-LLM inference and enhanced evaluation methods
Set up MCP Server for Alpha Vantage with Python 312 using uv and MCP-compatible clients