iwatch-mcp

iwatch-mcp

Enables real-time Apple Watch heart rate monitoring via MCP tools, reading data from macOS HealthKit.

Category
访问服务器

README

iwatch-mcp

Real-time Apple Watch heart rate monitoring via the Model Context Protocol.

Heart rate data flows: Apple Watch → iPhone → Mac (via iCloud/HealthKit).
This server reads it from macOS HealthKit and exposes it as MCP tools to Claude or any MCP client.

Architecture

Claude / MCP client
      │  MCP (stdio)
      ▼
iwatch-mcp  (Python)          ← pip install
      │  subprocess
      ▼
HealthKitHelper  (Swift CLI)  ← ./healthkit-helper/build.sh
      │  HealthKit API
      ▼
macOS HealthKit database      ← synced from Apple Watch via iPhone

Prerequisites

Requirement Notes
macOS 13+ HealthKit for Mac requires Ventura or later
Xcode Installed from the App Store (needed to build Swift helper)
Apple Developer account Required to sign the binary with HealthKit entitlement
Apple Watch paired Data syncs through iPhone → iCloud → Mac
Python 3.11+ For the MCP server

Why signing is required: com.apple.developer.healthkit is a restricted entitlement.
macOS will reject HealthKit calls from binaries not signed with a valid Apple Developer certificate.

Setup

1 — Build and sign the Swift helper

cd healthkit-helper
./build.sh

build.sh automatically finds the best signing identity in your keychain
(prefers "Developer ID Application", falls back to "Apple Development").

To list available signing identities:

security find-identity -v -p codesigning

To sign manually with a specific identity:

codesign --force \
         --sign "Apple Development: you@example.com (TEAMID)" \
         --entitlements HealthKitHelper.entitlements \
         --options runtime \
         .build/release/HealthKitHelper

2 — Grant HealthKit access

Run the helper once to trigger the macOS permission dialog:

./healthkit-helper/.build/release/HealthKitHelper latest

When prompted, open System Settings → Privacy & Security → Health and enable
HealthKitHelper for reading heart rate data.

3 — Install the Python MCP server

pip install -e .

Or with pipx (recommended for isolation):

pipx install .

4 — Connect to Claude

Add to ~/Library/Application Support/Claude/claude_desktop_config.json.

Option A — venv entrypoint (recommended):

{
  "mcpServers": {
    "iwatch": {
      "command": "/Users/ehuang/Repos/iwatch-mcp/.venv/bin/iwatch-mcp"
    }
  }
}

Option B — run via python module:

{
  "mcpServers": {
    "iwatch": {
      "command": "/Users/ehuang/Repos/iwatch-mcp/.venv/bin/python",
      "args": ["-m", "iwatch_mcp.server"]
    }
  }
}

Restart Claude Desktop. The iwatch server will appear in the MCP panel.

MCP Tools

get_heart_rate

Returns the most recent heart rate sample from HealthKit.

Example response:

{
  "bpm": 72.0,
  "timestamp": "2025-06-15T14:32:00.000Z",
  "source": "Apple Watch",
  "device": "Apple Watch Series 9"
}

stream_heart_rate(duration_seconds: int = 30)

Collects readings over a rolling time window.
Immediately returns any buffered readings from the last 5 minutes, then
watches for new samples for duration_seconds seconds.

Note: Apple Watch syncs over iCloud — "real-time" latency is typically 10–60 seconds.

Example response:

[
  {"bpm": 68.0, "timestamp": "2025-06-15T14:31:45.000Z", "source": "Apple Watch", "device": "Apple Watch Series 9"},
  {"bpm": 70.0, "timestamp": "2025-06-15T14:32:00.000Z", "source": "Apple Watch", "device": "Apple Watch Series 9"}
]

get_heart_rate_history(hours: float = 24.0)

Retrieves and summarises historical heart rate data.

Example response:

{
  "count": 42,
  "hours_requested": 24.0,
  "min_bpm": 52.0,
  "max_bpm": 143.0,
  "avg_bpm": 71.3,
  "first_timestamp": "2025-06-14T14:35:00.000Z",
  "last_timestamp": "2025-06-15T14:32:00.000Z",
  "samples": [...]
}

MCP Resource

healthkit://heart-rate/status — reports whether the helper binary is built and ready.

Environment Variables

Variable Default Description
HEALTHKIT_HELPER_PATH healthkit-helper/.build/release/HealthKitHelper Override binary location

Troubleshooting

"HealthKit is not available on this device"

HealthKit requires macOS 13+ on Apple Silicon (M1/M2/M3 Mac). It is not available on Intel Macs.

"Auth failed" / empty results after first run

  1. Open System Settings → Privacy & Security → Health
  2. Scroll to find HealthKitHelper and toggle on Heart Rate
  3. Also ensure the Health app is open and signed into iCloud

No data / stale data

Health data syncs from Apple Watch through iPhone. Make sure:

  • iPhone is nearby and connected (Wi-Fi or Bluetooth to Mac)
  • iCloud Drive is enabled on both iPhone and Mac
  • Health app is signed into the same Apple ID on Mac

Binary not signed / HealthKit permission denied

HealthKit requires a real Apple Developer certificate. Ad-hoc signing (-s -) does not work
for the com.apple.developer.healthkit entitlement. You need either:

  • A paid Apple Developer Program membership ($99/year)
  • Or a free Apple Developer account (limited entitlements — HealthKit is included for device testing)

Test the helper directly

# Latest reading
./healthkit-helper/.build/release/HealthKitHelper latest

# 24 hours of history
./healthkit-helper/.build/release/HealthKitHelper history 24

# Stream for 60 seconds
./healthkit-helper/.build/release/HealthKitHelper stream 60

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选