Guide

Apple Health in Claude Code

Claude Code can read your Apple Health data through HealthAPI's MCP server, so it works from your real numbers while it writes a dashboard, a script or an analysis in your project. One command adds it, and you approve the sign-in on your iPhone.

  • Remote MCP, OAuth
  • 8 read-only tools
  • Updated 22 October 2026

HealthAPI: Free for 2 days, no card needed. Then an optional 7-day free trial when you subscribe.

health-dashboard · claude

$claude mcp add --transport http --scope user healthapi https://healthapi.app/mcp

>Chart my resting heart rate and HRV for the last 90 days

healthapi · get_trendrestingHeartRate, 90 days

healthapi · get_trendheartRateVariabilitySDNN, 90 days

Writecharts/heart_90d.py

Bashpython charts/heart_90d.py

Saved charts/heart_90d.png. Resting heart rate went from 58 to 55 bpm, and HRV rose from 41 to 45 ms.

HealthAPI on your iPhone

Claude Code wants to read your health data

Approve

What you need

  • An iPhone on iOS 15 or later with Apple Health. Apple Watch data comes along too.
  • The HealthAPI app. Free for 2 days, no card needed. Then an optional 7-day free trial when you subscribe. The preview includes 25 requests a day. When the 2 days are up, AI apps and the API stop reading your data until you choose a plan in the app. Your synced data is kept for about 5 weeks, so subscribing picks up where you left off. Pro is $4.99 a month or $49.99 a year (100 requests a day); Developer is $9.99 a month or $99.99 a year (1,000 a day). Cancel anytime in the App Store.
  • Claude Code on your computer.

Set it up in 4 steps

  1. Install HealthAPI and sync

    Get HealthAPI from the App Store, open it and allow Apple Health. Your history uploads, then new data keeps syncing.
  2. Add the server

    In a terminal, run claude mcp add --transport http --scope user healthapi https://healthapi.app/mcp. The user scope makes it available in every project.
  3. Sign in and approve on your iPhone

    Start claude, run /mcp, choose healthapi and sign in. A HealthAPI page opens in your browser with a short code. Scan its QR code with your iPhone, or enter the code in HealthAPI under Connect, check it matches, and tap Approve.
  4. Ask Claude Code

    Ask for something that needs your data, such as “Use HealthAPI to get my resting heart rate for the last 60 days and chart it.” Claude Code asks before each tool call unless you allow them.
Shell
claude mcp add --transport http --scope user healthapi https://healthapi.app/mcp

The sign-in page names Claude Code with a check mark and notes that it returns to a program on this computer: Claude Code waits for the answer on localhost. If you started the sign-in yourself and the codes match, approve it. From a shell, claude mcp login healthapi does the same as /mcp.

Scopes, projects and API keys

--scope user keeps the server in ~/.claude.json for all your projects. Leave it out and it applies to the current project only. To share it with a repository, use the project scope, which writes .mcp.json:

Shell
claude mcp add --transport http --scope project healthapi https://healthapi.app/mcp

That file holds only the address, so it's safe to commit. Everyone who opens the project signs in with their own iPhone and sees only their own data.

Rather use your API key than sign in? Copy it in the app (Connect, then Other tools), put it in an environment variable, and reference the variable. Claude Code fills in ${HEALTHAPI_KEY} when it connects, so the key itself never lands in the file:

.mcp.jsonJSON
{
  "mcpServers": {
    "healthapi": {
      "type": "http",
      "url": "https://healthapi.app/mcp",
      "headers": { "Authorization": "Bearer ${HEALTHAPI_KEY}" }
    }
  }
}

Fewer permission prompts

Claude Code asks before every HealthAPI tool call. The tools only read, so you can allow them all in ~/.claude/settings.json, or for one tool at a time with its full name:

~/.claude/settings.jsonJSON
{
  "permissions": {
    "allow": ["mcp__healthapi__*"]
  }
}

Each call still uses one of your daily requests, so an agent working unattended can spend them. Raw readings from get_samples can also be long; asking for summaries keeps the output small.

What to build with it

  • A dashboard in your repo. “Use HealthAPI to get 90 days of sleep, resting heart rate and HRV, save it to data/health.json, and build a static page that charts it.”
  • A script that runs without you. “Look at one HealthAPI daily summary, then write a Node script that reads yesterday from the REST API with HEALTHAPI_KEY and appends it to a CSV.”
  • An analysis you can check. “Compare my sleep after workout days with rest days over the last 3 months, and show the numbers you used.”
  • Fixtures for your own app. “Fetch my last weekly summary and turn it into TypeScript types and a test fixture.”

Once you've signed in, non-interactive runs can use the tools too. Allow just the ones the prompt needs:

Shell
claude -p "Use HealthAPI to summarize last night's sleep in three lines" \
  --allowedTools "mcp__healthapi__get_sleep"

Code that runs on a schedule doesn't need Claude at all: call the REST API with your key. The JavaScript and Python guides have starting points.

The tools, by their Claude Code names

ToolReturns
mcp__healthapi__get_health_overviewWhat is synced, date ranges, last sync, requests left. A good first call.
mcp__healthapi__get_daily_summaryOne day: activity, heart, vitals, workouts and that morning's sleep.
mcp__healthapi__get_weekly_summaryA Monday-to-Sunday week, with a line per day.
mcp__healthapi__get_sleepPer night: asleep, core, deep, REM, awake, bedtime and wake time.
mcp__healthapi__get_trendOne metric day by day, up to 365 days, with average, low and high.
mcp__healthapi__get_latestThe newest reading of each metric.
mcp__healthapi__get_workoutsWorkouts between two days, with totals.
mcp__healthapi__get_samplesRaw readings of one metric, up to 31 days.

Every tool is read only. The MCP server page covers inputs, sign-in and discovery, and the Cursor and Codex guides cover the same server in other tools.

Questions

I already connected HealthAPI in Claude. Do I need this?

Maybe not. When you sign in to Claude Code with a Claude subscription, the connectors you added on claude.ai are available in Claude Code too, and /mcp lists them. Add the server yourself if you use Claude Code with an API key or another provider, or want it in a project's .mcp.json. If both point at the same address, Claude Code uses the one you added and hides the connector.

Can I sign in over SSH?

Yes. Run claude mcp login healthapi --no-browser on the remote machine and open the link it prints in any browser. After you approve on your iPhone, the last page fails to load, because it points at the remote machine. Copy that page's address and paste it into Claude Code.

How many requests does it use?

Each tool call is one request. A question usually takes one to three; building something may take more. Pro allows 100 a day and Developer 1,000, reset at 00:00 UTC.

How long does the sign-in last?

Until you disconnect it. Claude Code refreshes access on its own; if it goes unused for 60 days, sign in again with /mcp. Disconnect it in the HealthAPI app under Settings, Connected apps.

Can Claude Code change my health data?

No. All eight tools are read only. Nothing in Apple Health or HealthAPI changes.

The HealthAPI app icon

Your Health data, in your terminal.

Get HealthAPI for iPhone, add it to Claude Code, and build on your own numbers.