MCP Server (Claude Desktop, Cursor)
Plug Apple Health into Claude Desktop, Cursor, and any other Model Context Protocol (MCP) client through the health-analyzer-mcp npm package. The MCP server runs locally on your Mac and talks to the Health Data AI Analyzer app over loopback — your health data never crosses the network.
This is the recommended integration for Claude Desktop and Cursor as of 2026. For the older OpenClaw workflow, see the OpenClaw Integration doc.
How It Works
- Health Data AI Analyzer (Mac app) — imports your Apple Health export and runs a read-only API on
http://127.0.0.1:8765. - health-analyzer-mcp (Node process spawned by your MCP client) — translates between the MCP protocol and the Mac app's local API.
- MCP client (Claude Desktop, Cursor, etc.) — discovers the 11 tools, calls them based on your prompts, and returns natural-language answers.
Everything happens on your Mac. Nothing leaves the machine except whatever response you explicitly ask your MCP client to reason about (and only to whichever AI provider that client is configured to use).
Prerequisites
- macOS — the Mac app is macOS-only
- Node.js 18+ — required to run the MCP server via
npx - Health Data AI Analyzer Mac app installed, with a dataset loaded and the Local API enabled in Settings
- An MCP client — Claude Desktop, Cursor, or any other
Setup — Claude Desktop
Step 1: Install the Mac App
Download Health Data AI Analyzer from the Mac App Store. Import an Apple Health XML export, or sync one from your iPhone using one of the sync paths.
Step 2: Enable the Local API
In the Mac app, open Settings and turn on Enable Local API for OpenClaw and scripts. The app writes an auth token to its sandboxed container; the MCP server auto-discovers this file.
Step 3: Add the MCP Server to Claude Desktop Config
Open your Claude Desktop config:
~/Library/Application Support/Claude/claude_desktop_config.json
Add the health-analyzer server entry. If the file doesn't exist, create it:
{
"mcpServers": {
"health-analyzer": {
"command": "npx",
"args": ["-y", "health-analyzer-mcp"]
}
}
}
Step 4: Restart Claude Desktop
Quit Claude Desktop completely (Cmd+Q) and reopen it. The new server appears in the tools menu; you should see all 11 tools available.
Step 5: Ask Claude About Your Health Data
Open a new conversation and try one of these prompts:
What were my step counts and sleep duration for the last 14 days?
Pull my HRV for the past 30 days and look for signs of overtraining
or stress. Be explicit about your confidence level.
Give me yesterday's daily health brief and suggest one experiment
for the coming week based on what you see.
Setup — Cursor
Cursor uses the same MCP spec. Open Cursor Settings → MCP and add the same JSON snippet:
{
"mcpServers": {
"health-analyzer": {
"command": "npx",
"args": ["-y", "health-analyzer-mcp"]
}
}
}
Save and the server activates immediately — no restart needed.
The 11 Tools
Every tool is read-only and annotated with the MCP readOnlyHint: true flag so clients know they're safe to call without user confirmation.
| Tool | What it does | Inputs |
|---|---|---|
get_status | Check whether the local API is running and whether a dataset is loaded. | None |
list_metrics | List the health metric types currently loaded in the app. | None |
get_health_summary | Overview of all loaded health metrics. | start_date, end_date |
get_steps | Daily step counts, averages, and totals. | start_date, end_date, limit |
get_sleep | Sleep duration and stage breakdown (deep, REM, core). | start_date, end_date, limit |
get_heart_rate | Heart rate, resting heart rate, and HRV trends over time. | start_date, end_date |
get_hrv | Heart rate variability and recovery trends. | start_date, end_date, limit |
get_weight | Weight measurements and trends. | start_date, end_date, limit |
get_workouts | Workout history including type, duration, and calories burned. | start_date, end_date, limit |
get_vo2max | VO2 max (cardio fitness) measurements and fitness level. | start_date, end_date, limit |
get_daily_health_brief | Yesterday's sleep, steps, workouts, and recovery context versus your recent baseline. | date (optional) |
Optional Environment Variables
The MCP server auto-discovers the auth token from the Mac app's sandboxed container. You should never need to set these — they only exist as escape hatches for non-standard installations:
| Variable | Purpose |
|---|---|
HEALTH_ANALYZER_TOKEN | Set the token value directly, skipping file lookup. |
HEALTH_ANALYZER_TOKEN_FILE | Absolute path to a local-api-token.txt file in a non-default location. |
Troubleshooting
"Cannot connect to Health Data AI Analyzer"
The Mac app is not running, or the Local API is not enabled. Open the Mac app, go to Settings, and confirm Enable Local API for OpenClaw and scripts is on. Then call get_status from your MCP client to confirm the connection.
"Token not found" or 401 errors
The server couldn't find the auth token file. Run get_status — the response includes the paths it searched. If the file exists at one of those paths but the server still can't read it, your shell may have restricted filesystem permissions; try setting HEALTH_ANALYZER_TOKEN_FILE explicitly.
Tools don't show up in Claude Desktop
Confirm Claude Desktop was fully restarted (Cmd+Q, not just close-window). If the issue persists, check the Claude Desktop logs at ~/Library/Logs/Claude/ for MCP startup errors. The most common cause is a missing Node.js install — run node --version in Terminal; you need 18+.
Slow first response
The first call after a restart may take several seconds because npx downloads the latest health-analyzer-mcp package. Subsequent calls reuse the cached package and are near-instant.
Privacy
The MCP server is built around the same rule as the rest of the app: your health data stays on your Mac.
- Loopback only — the server only ever connects to
127.0.0.1:8765; it has no network code that could reach the public internet. - Read-only — all 11 tools are read-only; the server cannot modify, delete, or write to your health records.
- Token-gated — most local API routes require the auth token, which is generated by the Mac app and only readable by your user account.
- Open source — the entire server is ~330 lines of MIT-licensed Node on GitHub. Auditable in 10 minutes.
The only data that ever leaves your Mac is whatever response your AI assistant asks to reason about — and only to the AI provider you've configured in your MCP client.