# iMCP服务
## 基本信息
- Slug: `loopwork-ai-imcp`
- Source: modelscope
- Publisher: @loopwork-ai/iMCP
- Categories: calendar-management / location-services
- Hosted: No
- License: Apache License 2.0
- Source URL: https://www.modelscope.cn/mcp/servers/@loopwork-ai/iMCP
## 简介
一个为您的信息、联系人等提供MCP服务器的macOS应用程序
## 安装提示

```bash
</details> <img align="right" width="372" src="/Assets/imcp-screenshot-approve-connection.png" /> ### 从 Claude Desktop 调用 iMCP 工具 退出并重新打开 Claude Desktop 应用程序。您将被提示批准连接。 > [!NOTE] > 您可能会看到这个对话框两次；请两次都点击批准。 <br clear="all"> 批准连接后，您现在应该在聊天框的右下角看到 🔨12。点击它可以看到由 iMCP 提供给 Claude 的所有工具列表。 <p align="center"> <img width="694" src="/Assets/claude-desktop-screenshot-tools-enabled.png" alt="启用工具后的 Claude Desktop 截图" /> </p> 现在您可以向 Claude 询问需要访问您的个人数据的问题，例如： > "我这里的天气怎么样？" Claude 将使用适当的工具检索此信息，为您提供准确、个性化的回答，而无需在对话中手动分享这些数据。 <p align="center"> <img width="738" src="/Assets/claude-desktop-screenshot-message.png" alt="Claude 对用户消息 '我这里的天气怎么样？' 的响应截图" /> </p> ## 技术细节 ### 应用程序与命令行接口 iMCP 是一个 macOS 应用程序，其中包含一个命令行可执行文件 `imcp-server`。 * [`iMCP.app`](/App/) 提供了配置服务的界面，并且最重要的是， 它提供了一种与 macOS 系统权限交互的方式， 以便它可以访问联系人、日历和其他信息。 * [`imcp-server`](/CLI/) 提供了一个 MCP 服务器，该服务器 使用标准输入/输出进行通信 ([stdio 传输][mcp-transports])。 应用程序和命令行接口通过 Bonjour 在本地网络上相互通信， 用于自动发现。两者都广播类型为 "_mcp._tcp" 和域为 "local" 的服务。 来自 MCP 客户端的请求由命令行接口从 `stdin` 读取并转发给应用程序； 应用程序的响应由命令行接口接收并通过 `stdout` 写出。 有关实现细节，请参见 [`StdioProxy`](https://github.com/loopwork-ai/iMCP/blob/8cf9d250286288b06bf5d3dda78f5905ad0d7729/CLI/main.swift#L47)。 对于这个项目，我们创建了 [mcp-swift-sdk](https://github.com/loopwork-ai/mcp-swift-sdk)： 这是一个用于 Model Context Protocol 服务器和客户端的 Swift SDK。 应用程序使用这个包来处理来自 MCP 客户端的代理请求。 ### iMessage 数据库访问 Apple 不提供公开 API 来访问您的消息。然而，macOS 上的 Messages 应用将数据存储在位于 `~/Library/Messages/chat.db` 的 SQLite 数据库中。 iMCP 运行在 [App Sandbox](https://developer.apple.com/documentation/security/app-sandbox) 中， 这限制了其对用户数据和系统资源的访问。 当您启用 Messages 服务时，系统会提示您通过标准文件选择器打开 …
```

## MCP Server 详情

<picture>
  <source media="(prefers-color-scheme: dark)" srcset="Assets/hero-dark.svg">
  <source media="(prefers-color-scheme: light)" srcset="Assets/hero-light.svg">
  <img alt="iMCP">
</picture>

iMCP 是一款 macOS 应用程序，用于将您的数字生活与 AI 连接起来。
它支持 [Claude Desktop](https://claude.ai/download) 以及越来越多的支持
[模型上下文协议 (MCP)](https://modelcontextprotocol.io/introduction) 的客户端列表。

## 功能

<table>
  <tr>
    <th>
      <img src="Assets/calendar.svg" width="48" height="48" alt="" role="presentation"/>
    </th>
    <td><strong>日历</strong></td>
    <td>查看和管理日历事件，包括使用可自定义设置（如重复、提醒和可用性状态）创建新事件。</td>
  </tr>
  <tr>
    <th>
      <img src="Assets/contacts.svg" width="48" height="48" alt="" role="presentation"/>
    </th>
    <td><strong>联系人</strong></td>
    <td>访问关于您自己的联系信息，并按姓名、电话号码或电子邮件地址搜索您的联系人。</td>
  </tr>
  <tr>
    <th>
      <img src="Assets/location.svg" width="48" height="48" alt="" role="presentation"/>
    </th>
    <td><strong>位置</strong></td>
    <td>访问当前位置数据，并在地址和地理坐标之间进行转换。</td>
  </tr>
  <tr>
    <th>
      <img src="Assets/maps.svg" width="48" height="48" alt="" role="presentation"/>
    </th>
    <td><strong>地图</strong></td>
    <td>提供地点搜索、路线指引、兴趣点查找、旅行时间估算和静态地图图像生成等位置服务。</td>
  </tr>
  <tr>
    <th>
      <img src="Assets/messages.svg" width="48" height="48" alt="" role="presentation"/>
    </th>
    <td><strong>消息</strong></td>
    <td>访问特定参与者在自定义日期范围内的消息历史记录。</td>
  </tr>
  <tr>
    <th>
      <img src="Assets/reminders.svg" width="48" height="48" alt="" role="presentation"/>
    </th>
    <td><strong>提醒事项</strong></td>
    <td>查看并创建具有可自定义到期日期、优先级和提醒的不同提醒事项列表中的提醒事项。</td>
  </tr>
  <tr>
    <th>
      <img src="Assets/weather.svg" width="48" height="48" alt="" role="presentation"/>
    </th>
    <td><strong>天气</strong></td>
    <td>访问任何地点的当前天气状况，包括温度、风速和天气条件。</td>
  </tr>
</table>

> [!TIP]
> 对于新的功能有建议？
> 请通过 <imcp@loopwork.com> 联系我们。

## 开始使用

### 下载并打开应用程序

首先，[下载 iMCP 应用程序](https://iMCP.app/download)
（需要 macOS 15.3 或更高版本）。

<img align="right" width="344" src="/Assets/imcp-screenshot-first-launch.png" alt="首次启动时 iMCP 的截图" />

当您打开应用程序时，
会在菜单栏中看到一个
<img style="display: inline" width="20" height="16" src="/Assets/icon.svg" />
图标。

点击此图标会显示 iMCP 菜单，该菜单中列出了所有可用的服务。最初，所有服务都会显示为灰色，表示它们处于非活动状态。

顶部的蓝色切换开关表示 MCP 服务器正在运行，并且已准备好与兼容 MCP 的客户端连接。

<br clear="all">

<img align="right" width="372" src="/Assets/imcp-screenshot-grant-permission.png" alt="macOS权限对话框截图" />

### 激活服务

要激活某个服务，请点击其图标。系统将提示您一个权限对话框。例如，在激活日历访问时，您会看到一个对话框询问“`iMCP`希望完全访问您的日历”。点击<kbd>允许完全访问</kbd>继续。

> [!IMPORTANT]
> iMCP **不会** 收集或存储您的任何数据。
> 像 Claude Desktop 这样的客户端_确实会_在工具调用过程中将您的数据发送出去。

<br clear="all">

<img align="right" width="344" src="/Assets/imcp-screenshot-all-services-active.png" alt="所有服务均已启用的iMCP截图" />

一旦被激活，每个服务的图标将从灰色变为它们特有的颜色——日历为红色、消息为绿色、位置为蓝色等。

重复这一过程以激活您想要启用的所有功能。这些权限遵循 Apple 的标准安全模型，使您可以完全控制 iMCP 可以访问哪些信息。

<!-- <br clear="all"> -->

<!-- <img align="right" width="344" src="/Assets/imcp-screenshot-configure-claude-desktop.png" /> -->

<br clear="all">

### 连接到 Claude Desktop

如果您尚未安装 Claude Desktop，可以[在此下载](https://claude.ai/download)。

打开 Claude Desktop 并转到“设置... (<kbd>⌘</kbd><kbd>,</kbd>)”。点击设置面板侧边栏中的“开发者”，然后点击“编辑配置”。这将在
`~/Library/Application Support/Claude/claude_desktop_config.json` 创建一个配置文件。

<br/>

要将 iMCP 连接到 Claude Desktop，请点击 <img style="display: inline" width="20" height="16" src="/Assets/icon.svg" />
\> “配置 Claude Desktop”。

这将添加或更新使用应用程序中捆绑的 `imcp-server` 可执行文件的 MCP 服务器配置。文件中的其他 MCP 服务器配置将被保留。

<details>
<summary>您也可以手动配置 Claude Desktop</summary>

点击 <img style="display: inline" width="20" height="16" src="/Assets/icon.svg" />
\> “复制服务器命令到剪贴板”。然后在编辑器中打开 `claude_desktop_config.json` 并输入以下内容：

```json
{
  "mcpServers" : {
    "iMCP" : {
      "command" : "{paste iMCP server command}"
    }
  }
}
```
</details>

<img align="right" width="372" src="/Assets/imcp-screenshot-approve-connection.png" />

### 从 Claude Desktop 调用 iMCP 工具

退出并重新打开 Claude Desktop 应用程序。您将被提示批准连接。

> [!NOTE]
> 您可能会看到这个对话框两次；请两次都点击批准。

<br clear="all">

批准连接后，您现在应该在聊天框的右下角看到 🔨12。点击它可以看到由 iMCP 提供给 Claude 的所有工具列表。

<p align="center">
  <img width="694" src="/Assets/claude-desktop-screenshot-tools-enabled.png" alt="启用工具后的 Claude Desktop 截图" />
</p>

现在您可以向 Claude 询问需要访问您的个人数据的问题，例如：
> "我这里的天气怎么样？"

Claude 将使用适当的工具检索此信息，为您提供准确、个性化的回答，而无需在对话中手动分享这些数据。

<p align="center">
  <img width="738" src="/Assets/claude-desktop-screenshot-message.png" alt="Claude 对用户消息 '我这里的天气怎么样？' 的响应截图" />
</p>

## 技术细节

### 应用程序与命令行接口

iMCP 是一个 macOS 应用程序，其中包含一个命令行可执行文件 `imcp-server`。
* [`iMCP.app`](/App/) 提供了配置服务的界面，并且最重要的是，
  它提供了一种与 macOS 系统权限交互的方式，
  以便它可以访问联系人、日历和其他信息。
* [`imcp-server`](/CLI/) 提供了一个 MCP 服务器，该服务器
  使用标准输入/输出进行通信
  ([stdio 传输][mcp-transports])。

应用程序和命令行接口通过 Bonjour 在本地网络上相互通信，
用于自动发现。两者都广播类型为 "_mcp._tcp" 和域为 "local" 的服务。
来自 MCP 客户端的请求由命令行接口从 `stdin` 读取并转发给应用程序；
应用程序的响应由命令行接口接收并通过 `stdout` 写出。
有关实现细节，请参见 [`StdioProxy`](https://github.com/loopwork-ai/iMCP/blob/8cf9d250286288b06bf5d3dda78f5905ad0d7729/CLI/main.swift#L47)。

对于这个项目，我们创建了 [mcp-swift-sdk](https://github.com/loopwork-ai/mcp-swift-sdk)：
这是一个用于 Model Context Protocol 服务器和客户端的 Swift SDK。
应用程序使用这个包来处理来自 MCP 客户端的代理请求。

### iMessage 数据库访问

Apple 不提供公开 API 来访问您的消息。然而，macOS 上的 Messages 应用将数据存储在位于
`~/Library/Messages/chat.db` 的 SQLite 数据库中。

iMCP 运行在 [App Sandbox](https://developer.apple.com/documentation/security/app-sandbox) 中，
这限制了其对用户数据和系统资源的访问。
当您启用 Messages 服务时，系统会提示您通过标准文件选择器打开 `chat.db` 文件。
这样做之后，macOS 会将该文件添加到应用程序的沙盒中。
[`NSOpenPanel`](https://developer.apple.com/documentation/appkit/nsopenpanel) 就是这样神奇地工作的。

但是，打开 iMessage 数据库只是完成了一半的工作。
在过去几年里，
Apple 已经不再以纯文本形式存储消息，
而是转向专有的 `typedstream` 格式。

为此项目，我们创建了 [Madrid](https://github.com/loopwork-ai/Madrid)：
这是一个用于读取您的 iMessage 数据库的 Swift 包。
它包括一个解码 Apple `typedstream` 格式的 Swift 实现，
该实现改编自 Christopher Sardegna 的 [imessage-exporter](https://github.com/ReagentX/imessage-exporter) 项目
及其关于反向工程 `typedstream` 的[博客文章](https://chrissardegna.com/blog/reverse-engineering-apples-typedstream-format/)。

### JSON-LD for Tool Results

iMCP 提供的…

