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.
- Antigravity CLI 1.5.8 or later on a computer with a web browser; earlier versions could drop a sign-in like HealthAPI's after an hour. It updates itself, and
agy --versionshows yours; Google's quickstart has the install command. Any account the CLI accepts works, including a free Google Account.
Set it up in 5 steps
Install HealthAPI and sync
Get HealthAPI from the App Store, open it and allow Apple Health. Do this first: you approve the sign-in in the app. Your history uploads, then new data keeps syncing.Add the server
In a terminal, runagy mcp add healthapi https://healthapi.app/mcp. It puts HealthAPI in~/.gemini/config/mcp_config.jsonfor every folder and keeps any servers already there.Choose Authenticate in /mcp
Startagy, type/mcpand press Enter. Selecthealthapi(it shows [Auth Needed]) with the arrow keys, press Enter and choose Authenticate. Stay on this screen until you paste the code: it waits for it.Approve on your iPhone
A HealthAPI page with a short code opens in your browser. If none does, open the link on the /mcp screen. Scan the QR code with your iPhone, or enter the code in HealthAPI under Connect, check it matches, and tap Approve.Paste the code back
Your browser then shows an Antigravity page with a second code. Select Copy to Clipboard, paste it into the /mcp screen, not the chat box, and press Enter within ten minutes. HealthAPI then shows [Authed].
agy mcp add healthapi https://healthapi.app/mcpThen ask for something that needs your data, such as “Use HealthAPI to compare my sleep this week with last week.” The HealthAPI sign-in page names the request Google Antigravity and says antigravity.google shows a second code after you approve. Approve it if you chose Authenticate yourself and the codes match.
agy mcp list shows the server, and selecting it in /mcp lists its tools. Antigravity keeps HealthAPI's tool descriptions and its instructions (dates are in your timezone, and a night of sleep belongs to the morning it ended) in ~/.gemini/antigravity-cli/mcp/healthapi/, and the agent reads a tool's details when it needs it.
If it doesn't connect
No browser window opened
Check your browser's other windows first. If the page isn't there, open the sign-in link on the /mcp screen. Opening it again in the same browser shows the same code.
I can't find Authenticate
In /mcp, the up and down arrows move between servers and the left and right arrows between the selected server's actions; Esc leaves. Select healthapi, press Enter, move to Authenticate and press Enter. If healthapi isn't listed, run agy mcp list in a terminal to check it was added, then start agy again.
Two HealthAPI pages with different codes
The sign-in link was opened in two different browsers, and each browser gets its own code. Approve the code in one of them and keep that browser open: it turns into the Antigravity page with the code to paste.
Scanning the QR code opened a web page instead of HealthAPI
HealthAPI isn't installed or set up on that iPhone yet. Install it and open it once, then enter the code from the page in HealthAPI under Connect.
I approved, but no Antigravity code appeared
Look in your other browser tabs: the Antigravity page opens in one tab only, and a HealthAPI tab left behind says where it is. If the HealthAPI page says the code expired, choose Authenticate in /mcp again for a new one.
healthapi still shows [Auth Needed] after I pasted the code
The code works once, for ten minutes, and only in the /mcp screen; typed into the chat box, it goes to the agent as a message. Choose Authenticate again, approve the new code and paste it straight away.
An error that mentions code_verifier
Antigravity restarted the sign-in while you were finishing it, for example because a message was sent or /mcp reloaded in between. Versions from 1.5.2 keep the sign-in you started, so check agy --version, then choose Authenticate again and paste the code before doing anything else in agy.
I added the server while agy was running
Antigravity picks it up, but the sign-in doesn't start by itself. Open /mcp and choose Authenticate.
Antigravity asks me to sign in again after an hour
Update to 1.5.8 or later; earlier versions could drop the sign-in when the hourly access token was renewed. agy --version shows yours.
The mcp_config.json file
agy mcp add writes this entry for you. To write it by hand, add it inside mcpServers in ~/.gemini/config/mcp_config.json, or in a project's .agents/mcp_config.json to use HealthAPI in that project only:
{
"mcpServers": {
"healthapi": {
"serverUrl": "https://healthapi.app/mcp"
}
}
}Keep the address exactly as shown, with no slash at the end: Antigravity checks it against the address HealthAPI publishes for its sign-in. Antigravity CLI loads its servers from these files, not from Gemini CLI's ~/.gemini/settings.json, and Gemini CLI's httpUrl key doesn't work here: Google's documentation uses serverUrl for a remote server.
Antigravity asks before every HealthAPI tool call. To stop the prompts, run /permissions, choose Global, open the allowlist tab, press A and add mcp(healthapi/*). 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 ~/.gemini/config/mcp_config.json, never a project's .agents/mcp_config.json:
{
"mcpServers": {
"healthapi": {
"serverUrl": "https://healthapi.app/mcp",
"headers": { "Authorization": "Bearer <your API key>" }
}
}
}What to do with it
- Ask about a trend. “Use HealthAPI to get 60 days of resting heart rate and HRV. Which weeks stand out, and what else changed in them?”
- Turn it into files. “Get my last 8 weekly summaries and write them to weeks.csv, one row per week.”
- Build a page. “Write an HTML page that charts my daily steps and hours asleep for the last 30 days.”
- 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 nine tools and their inputs are on the MCP server page. With a paid Gemini API key or a Code Assist license, Gemini CLI works too.
Questions
Which accounts can use Antigravity CLI?
A personal Google Account on the free plan, Google AI Pro or Google AI Ultra; the paid plans get higher limits. A Google Workspace account gets a limited starter quota, or more through a Google Cloud project or Gemini Enterprise, and the CLI also runs with a Gemini API key. HealthAPI works the same with any of them.
I set up HealthAPI in Gemini CLI. Does it carry over?
Not the sign-in: HealthAPI ties each sign-in to the app that made it. Run agy mcp add healthapi https://healthapi.app/mcp and authenticate once in Antigravity; it reads servers from ~/.gemini/config/mcp_config.json, not Gemini CLI's ~/.gemini/settings.json. Then disconnect the old Gemini CLI MCP Client in the HealthAPI app under Settings, Connected apps.
Why are there two codes?
The first, on the HealthAPI page, is the one you check in the HealthAPI app before you tap Approve. After you approve, HealthAPI sends your browser to antigravity.google, and that page shows a second code rather than handing it to the CLI. Paste the second one into the /mcp screen that is waiting for it. It works once, for ten minutes; if it runs out, choose Authenticate again for a new one.
Does it work on a machine without a browser?
Use your API key there, such as on a server you reach over SSH: send it in a header as shown on this page, and there is no sign-in to complete.
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?
If Antigravity loses the sign-in, choose Authenticate for healthapi in /mcp again. To cut Antigravity off, disconnect it in the HealthAPI app under Settings, Connected apps, then run agy mcp remove healthapi.
Can Antigravity change my health data?
No. All nine tools are read only. Nothing in Apple Health or HealthAPI changes.
