Back to MCP directory
publicPublicdnsLocal runtime

imessage-query-fastmcp-mcp-server

一个基于FastMCP框架的iMessage查询服务器,提供安全访问和分析iMessage数据库的功能。

article

README

🚀 iMessage 查询 MCP 服务器

这是一个通过模型上下文协议(MCP)提供安全访问的 iMessage 数据库服务器。借助 FastMCP 框架和 imessagedb 库构建,它允许大语言模型(LLMs)查询和分析 iMessage 对话,同时具备正确的电话号码验证和附件处理功能。

🚀 快速开始

克隆仓库:

git clone https://github.com/hannesrudolph/imessage-query-fastmcp-mcp-server.git
cd imessage-query-fastmcp-mcp-server

📦 安装指南

系统要求

  • macOS(iMessage 数据库访问所需的系统)
  • Python 3.6+

依赖项

安装所有必需的依赖项:

# 使用 pip
pip install -r requirements.txt

所需软件包

  • fastmcp:构建 MCP 框架的库
  • imessagedb:用于访问和查询 macOS Messages 数据库的 Python 库
  • phonenumbers:Google 的电话号码处理库,用于正确的号码验证和格式化

所有依赖项均在requirements.txt文件中列出,以方便安装。

安装选项

您可以在 Claude Desktop 或 Cline VSCode 插件中安装此 MCP 服务器。选择最适合您需求的选项。

选项 1:为 Claude Desktop 安装

使用 FastMCP 进行安装:

fastmcp install imessage-query-server.py --name "iMessage 查询"

选项 2:为 Cline VSCode 插件安装

要将此服务器与 Cline VSCode 插件 一起使用:

  1. 在 VSCode 中,点击 Cline 插件侧边栏中的服务器图标(☰)
  2. 点击“编辑 MCP 设置”按钮(✎)
  3. 将以下配置添加到设置文件中:
{
  "imessage-query": {
    "command": "uv",
    "args": [
      "run",
      "--with",
      "fastmcp",
      "fastmcp",
      "run",
      "/path/to/repo/imessage-query-fastmcp-mcp-server/imessage-query-server.py"
    ]
  }
}

/path/to/repo替换为克隆仓库的完整路径(例如/Users/username/Projects/imessage-query-fastmcp-mcp-server

✨ 主要特性

MCP 工具

服务器向 LLMs 公开以下工具:

get_chat_transcript

根据特定的电话号码检索消息历史记录,可选日期过滤。包括:

  • 消息文本和时间戳
  • 附件信息(如有)
  • 正确的电话号码验证
  • 日期范围筛选

🔧 技术细节

安全功能

  • iMessage 数据库的只读访问
  • 使用 phonenumbers 库进行电话号码验证
  • 附件处理的安全性,检测缺失文件
  • 日期范围验证
  • 进度输出抑制以保持 JSON 响应干净

📚 详细文档

仓库包含用于开发的文档:

  • dev_docs/imessagedb-documentation.txt:包含 iMessage 数据库结构和 imessagedb 库功能的全面文档。

该文档在开发时作为上下文提供,并可用于与 LLMs 结合使用以辅助开发。

help

Runtime guide

cloud

Hosted runtime

Hosted servers run from a provider-managed environment. You usually connect the MCP client to the hosted endpoint or follow the provider's authorization flow, without keeping a local process alive

  1. Open provider connection page
  2. Authorize or copy endpoint
  3. Connect from your MCP client
terminal

Local runtime / other methods

Local servers run on your own machine or infrastructure. You normally copy the server_config into your MCP client, install the required package, and provide env variables from env_schema when needed

  1. Copy server_config
  2. Install required package
  3. Fill env variables and restart client