Connect Apple Health to Claude Code, Codex & Desktop AI via Local MCP
Apple HealthKit stays locked on iPhone, while AI coding and desktop assistants run on your Mac. With the built-in local MCP server coming in HealthDock 1.3, tools like Claude Code, Codex, Cursor, Claude Desktop, and VS Code can query your synced sleep stages, HRV, workouts, and daily heart rate on demand—without manual XML exports or third-party cloud dashboards.
--mcp-stdio or 127.0.0.1)
🛡️ Write tools off by default; never writes to Apple Health
⚡ Need context.md today? Convert export.zip in your browser now
What Is MCP—and Why Use It Instead of Uploading export.zip?
The Model Context Protocol (MCP) is an open standard that lets AI assistants invoke structured local tools instead of forcing you to paste giant files into a chat box. Rather than stuffing years of raw Apple Health XML into a single prompt, your AI client starts light and fetches specific slices—like last night’s sleep stages or a 30-day HRV series—only when your question calls for them.
Today, if you want to explore your HealthKit history in Claude or ChatGPT right away, dropping export.zip into our free Apple Health to Claude converter generates a clean ~2KB context.md in seconds inside your browser. HealthDock’s companion apps (on the App Store now) automate the iPhone-to-Mac sync over Bluetooth and local Wi-Fi—and coming in HealthDock 1.3, the Mac app adds a native local MCP server on top of that archive.
| Workflow | Freshness | Detail Granularity | Where Data Lives |
|---|---|---|---|
Manual export.zip + ConverterAvailable free right now |
Re-export from iPhone whenever you want new days | Great ~2KB context.md overview or filtered CSV |
100% browser-local until you paste into an AI chat |
| Third-Party Cloud Dashboards Hosted health APIs |
Automatic via external servers | Fixed vendor endpoints | Uploaded to a remote database under an account |
| HealthDock Local MCP Server Coming in HealthDock 1.3 |
Automatic background sync from iPhone to Mac | On-demand drill-down: 7/30/90d baselines, single-day peak HR, sleep stages, workouts | Plain Mac files + local-only MCP; only queried snippets go to your chosen AI |
Client Setup Preview: Claude Code, Codex, Cursor, Claude Desktop & VS Code
In HealthDock 1.3 (upcoming), Settings includes client cards to connect in one click or copy snippets for Claude Code, Codex, Cursor, Claude Desktop, and VS Code. We recommend stdio mode, where your AI tool starts the binary directly. As a fallback, local Streamable HTTP runs at http://127.0.0.1:47321/mcp with an access token, listening only on 127.0.0.1.
# Register HealthDock MCP server in Claude Code (stdio)
claude mcp add --scope user healthdock -- "/Applications/HealthDock.app/Contents/MacOS/HealthDock" --mcp-stdio
# Or run a one-off query straight from Terminal without an MCP client
HealthDock --query get_day_detail '{"date":"YYYY-MM-DD"}'
[mcp_servers.healthdock] command = "/Applications/HealthDock.app/Contents/MacOS/HealthDock" args = ["--mcp-stdio"]
{
"mcpServers": {
"healthdock": {
"command": "/Applications/HealthDock.app/Contents/MacOS/HealthDock",
"args": ["--mcp-stdio"]
}
}
}
MCP Tools Reference (Coming in HealthDock 1.3)
Behind the scenes, HealthDock’s Mac archive stores ordinary files you own—context.md, daily/YYYY/YYYY-MM-DD.json (where an omitted field means no reading was recorded that day, never 0), archive/, routes/*.json, ecg/*.json, journal/, and data dictionaries (CLAUDE.md, AGENTS.md, DATA.md)—as covered in our Apple Health on Mac guide. When wearables overlap (such as wearing both an Apple Watch and a smart ring), sleep is resolved to one primary source per night, adjustable in Settings.
| Tool Name | Access | What It Does |
|---|---|---|
get_health_context |
Read-only | Returns your 7-day, 30-day, and 90-day summary compared against personal baselines. |
query_daily_range |
Read-only | Fetches daily summaries across a start and end date range. |
get_day_detail |
Read-only | Returns granular single-day details, such as peak heart rate and the time it occurred. |
get_metric_series |
Read-only | Pulls a date-indexed time series for an individual health metric. |
get_sleep_stages |
Read-only | Returns deep, REM, core, and awakening stage details for a specific night. |
list_workouts |
Read-only | Lists recorded workouts with duration and activity metadata. |
list_events / list_goals |
Read-only | Reads logged personal life events and active habit goals from your local archive. |
log_event, delete_event,set_goal, deactivate_goal |
Opt-in write (Off by default) |
Disabled until enabled in Settings. Writes only life events and goals to events/YYYY-MM.jsonl and goals.json—never writes back to Apple Health. |
Example Session: Asking About Yesterday’s Peak Heart Rate
Suppose you ask Claude Code or Claude Desktop: “What time did my heart rate peak yesterday, and was it during a workout?” Instead of scanning gigabytes of XML, your AI calls get_day_detail (and list_workouts if needed) on your Mac. Below is a synthetic illustration of the tool exchange coming in HealthDock 1.3:
User: "What time was my highest heart rate yesterday, and what was my day like?"
→ Assistant calls healthdock.get_day_detail({"date": "2026-11-21"})
← Local MCP response (synthetic sample):
{
"date": "2026-11-21",
"resting_hr_avg": 56,
"hrv_sdnn_ms": 62,
"heart_rate_max": 171,
"heart_rate_max_at": "2026-11-21T17:38:12+08:00",
"steps": 11280,
"sleep_min": 450,
"workouts": [
{ "type": "Outdoor Run", "start": "17:12", "end": "17:54", "duration_min": 42 }
]
}
Assistant: "Yesterday (Nov 21), your heart rate peaked at 171 bpm at 17:38, right in the
middle of your 42-minute Outdoor Run (17:12–17:54). Outside of training, resting heart rate
was 56 bpm and HRV averaged 62 ms across 7.5 hours of sleep."
Want your AI to also compile a morning briefing or remember travel and social notes alongside your metrics? Read our companion previews on AI Daily Health Reports and Logging Life Events & Goals.
Privacy Boundary: Local MCP Server vs. Your Chosen AI Provider
HealthDock’s iPhone-to-Mac sync runs strictly over Bluetooth and local Wi-Fi with encrypted device pairing—zero accounts and zero HealthDock servers. In HealthDock 1.3, the MCP server executes exclusively on your Mac (via local stdio or loopback 127.0.0.1), and HealthDock itself never uploads any health data anywhere.
Be clear on what happens next: whenever your AI tool calls an MCP function, the data returned to that AI client is sent to whichever AI provider you chose (unless you run a strictly offline local model) and is governed by that provider’s own privacy policy. Review our full Privacy Policy for complete details on permissions and local AI controls.
Try Browser Conversion Today — Or Get the Apps
Need Apple Health inside Claude or Codex right now? Use our free 100% browser-local converter to generate context.md from export.zip today—or leave your email to hear when the HealthDock apps launch worldwide.
iPhone: 7-day free trial, then $4.99/year or $14.99 once (US prices). Not available in the EU.
Apple Health MCP Server FAQ
Is the Apple Health MCP server available in HealthDock right now?
Not yet. HealthDock is on the App Store now, but the built-in local MCP server is coming in HealthDock 1.3. If you want an AI-ready context.md summary for Claude or ChatGPT today, use our free browser-local converter right now.
Should I connect via --mcp-stdio or local Streamable HTTP?
We recommend stdio mode (/Applications/HealthDock.app/Contents/MacOS/HealthDock --mcp-stdio) whenever your AI client supports local command servers, since your client starts the binary directly without opening a port. For clients that need HTTP, HealthDock 1.3 provides http://127.0.0.1:47321/mcp with an access token, bound strictly to 127.0.0.1.
Can Claude Code or Codex modify my Apple Health records through MCP?
Never. HealthDock on iPhone requests read-only access to Apple Health. In HealthDock 1.3, MCP write tools (log_event, delete_event, set_goal, deactivate_goal) are turned off by default in Settings. Even when enabled, they only save personal life events and goals into events/YYYY-MM.jsonl and goals.json in your Mac archive folder and never write back to Apple Health.
How does HealthDock prevent double-counted sleep if I wear both an Apple Watch and a smart ring?
When multiple wearables write sleep intervals to Apple Health, HealthDock 1.3 evaluates each night using a single primary sleep source rather than stacking overlapping totals. You can adjust your preferred primary source in Settings.
Does a local MCP server mean my health data never reaches cloud AI providers?
HealthDock itself runs no servers and never uploads your data anywhere, and the MCP server runs strictly on your Mac. However, whenever an AI client like Claude Code, Codex, Cursor, or Claude Desktop calls an MCP tool, the query results returned to that client are sent to whichever AI service provider powers your model and are governed by that provider’s privacy policy. See our Privacy Policy.