DEV Community

Philip D'Souza
Philip D'Souza

Posted on

Claude Code vs Claude Desktop for Apple Health: script vs number

Claude Desktop and Claude Code both call the same read-only Apple Health MCP tools. The difference is what they hand back. A chat agent returns a number. A coding agent writes the script that computes the number, saves a chart to disk, and reruns it next month when fresh data lands.

Why Claude Code specifically

Claude Code runs in your terminal, reads and writes files, and executes code, not just chat replies. That combination is what makes it useful for health data. It can call the same read-only Apple Health tools a chat client can, but it can also turn the result into a script, a chart, or a CSV saved to disk, and rerun that script whenever fresh data lands.

A chat-only client can tell you a number. An agent with a file system and code execution can build you a reusable analysis.

Worked example: does your HRV track your sleep duration?

You: Pull my HRV and sleep duration for the last 90 days from health-export,
     compute the correlation between them, and plot it.

Claude Code: [calls list_metrics -> checks `days` and `firstDate` for both series]
             [calls get_health_metrics -> heart_rate_variability, 90d]
             [calls get_health_metrics -> sleep_analysis, 90d]
             [writes analyze_hrv_sleep.py -- aligns both series by date,
              computes Pearson r with scipy, renders a scatter plot]
             [runs the script]

             Pearson r over the nights where both readings exist, with the
             n it actually found, plus a scatter plot saved to
             hrv_vs_sleep.png -- computed from your own data, on your own
             machine.
Enter fullscreen mode Exit fullscreen mode

Note the first call: list_metrics returns days, firstDate and lastDate per metric, so the agent checks how much history it actually has before asking for a 90-day window, and tells you if the file is shallower than the question.

Nothing here required copying a CSV into a chat window or trusting a black-box insight. The script is on disk, the statistics are standard, and you can open analyze_hrv_sleep.py yourself and check every line. Ask a follow-up: "now split that by whether I trained that day" and Claude Code extends the same script rather than starting over.

The eight read-only tools

Tool What it returns
get_mcp_status Health check: data source, metric count, most recent data date
list_metrics Every available metric with unit, day count, date range
get_health_metrics Values for a metric over a date range with aggregation
get_trends Compare recent N-day window against prior N
compare_periods A/B two arbitrary date windows for a single metric
get_structured_export Clean structured JSON, paginated
get_intraday Hour-by-hour window, live within-day view
query_health_data Natural-language convenience query

190 Apple Health metrics. 84 kB npm package. Zero dependencies. Zero network calls.

Register the server with Claude Code

Let the CLI write its own config:

claude mcp add health-export \
  -e HEALTH_DATA_DIR="/Users/you/Library/Mobile Documents/iCloud~ai~healthexport~app/Documents" \
  -- node "/Users/you/.health-export-mcp/server.mjs"
Enter fullscreen mode Exit fullscreen mode

Verify with claude mcp list. Or paste "Read https://healthexport.dev/SKILL.md and set up Health Export AI for me" into Claude Code and it patches its own MCP config and verifies the connection.

Full setup, the comparison table against cloud-upload AI health apps and manual spreadsheets, and the FAQ: complete guide on healthexport.dev

Top comments (0)