Guide

Apple Health in Gemini CLI

Google's Gemini CLI can read your Apple Health data through HealthAPI's MCP server. Add the server, sign in from the CLI and approve it on your iPhone. Then Gemini can answer questions, analyze trends and write code from your real numbers.

  • 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 · gemini

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

$gemini

>/mcp auth healthapi

>Compare my steps on weekdays and weekends over the last 90 days

healthapi · get_trendstepCount, 90 days

Weekdays average 8,900 steps and weekends 6,300. Saturday is your quietest day.

HealthAPI on your iPhone

“Gemini CLI MCP Client” wants to read your health data

We can't confirm who runs this app. Only approve it if you set it up yourself and trust it.

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.
  • Gemini CLI on a computer with a web browser.

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

    Run gemini mcp add --scope user --transport http healthapi https://healthapi.app/mcp. The user scope puts it in ~/.gemini/settings.json, so it works in every folder.
  3. Sign in and approve on your iPhone

    Start gemini and run /mcp auth healthapi. 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 Gemini

    Ask for something that needs your data, such as “Use HealthAPI to compare my steps this week with last week.” Gemini asks before each tool call; choose Always allow this server to stop the prompts.
Shell
gemini mcp add --scope user --transport http healthapi https://healthapi.app/mcp

Keep --scope user: without it, gemini mcp add writes to the current project's .gemini/settings.json, and in your home folder it refuses. The sign-in page labels the request an unverified app called Gemini CLI MCP Client that returns to a program on this computer. That is expected; approve it if you started it and the codes match. Gemini CLI waits 5 minutes for the approval; if it gives up, run /mcp auth healthapi again for a new code.

Run /mcp list in Gemini CLI, or gemini mcp list in a terminal, to check the server is connected. Gemini knows the tools as mcp_healthapi_get_sleep, mcp_healthapi_get_trend and so on, and it reads HealthAPI's own instructions too: dates are in your timezone, and a night of sleep belongs to the morning it ended.

The settings.json entry

The command writes the entry for you. To write it by hand, Google's documentation uses httpUrl for a streamable HTTP server:

~/.gemini/settings.jsonJSON
{
  "mcpServers": {
    "healthapi": {
      "httpUrl": "https://healthapi.app/mcp"
    }
  }
}

Gemini CLI keeps the sign-in in ~/.gemini/mcp-oauth-tokens.json and refreshes it on its own. It asks before every tool call unless you allow the server; HealthAPI's tools only read, but each call uses one of your daily requests.

With an API key instead

For a machine without a browser, send your API key as a header. Copy it in the app (Connect, then Other tools). The key is written into the file as is, so keep it in your user settings, never a project's .gemini/settings.json:

~/.gemini/settings.jsonJSON
{
  "mcpServers": {
    "healthapi": {
      "httpUrl": "https://healthapi.app/mcp",
      "headers": { "Authorization": "Bearer <your API key>" }
    }
  }
}

What to do with it

  • Ask about a trend. “Use HealthAPI to get 90 days of HRV and resting heart rate. Are they moving together, and on which days did they split?”
  • Turn it into files. “Get my last 8 weekly summaries and write them to weeks.csv, one row per week.”
  • Write a script around it. “Look at one daily summary from HealthAPI, then write a Python script that pulls the same fields from the REST API each morning.”
  • A training log. “List my workouts since the start of the month with time, distance and energy, and total them by type.”

Scripts that run on their own should call the REST API with your key; see the Python and JavaScript guides. All eight tools and their inputs are on the MCP server page.

Questions

Why does the sign-in page say “Unverified app”?

Gemini CLI registers itself under the name “Gemini CLI MCP Client” and receives the answer on localhost, so HealthAPI can't prove which program is asking. If you just ran /mcp auth yourself and the codes match, approve it.

Does it work over SSH or in a container?

Not the sign-in: it needs a browser on the same machine, and Google's documentation says it won't work over SSH without X11 forwarding or in a container without a browser. Send your API key in a header there instead, as shown on this page.

How many requests does it use?

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

How do I sign in again or disconnect?

Run /mcp auth healthapi again for a fresh sign-in. To cut Gemini CLI off, disconnect it in the HealthAPI app under Settings, Connected apps; gemini mcp remove --scope user healthapi removes it from your settings.

Can Gemini 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 Gemini CLI.

Get HealthAPI for iPhone, add the server, and approve it on your phone.