Skip to main content
Glama
health-connect-mcp

health-connect-mcp

by weissmike

health-connect-mcp

A read-only MCP server for your Android Health Connect data, on Cloudflare Workers. Ask Claude about your weight, body fat, sleep, steps, nutrition and more, using whatever your scale and apps write to Health Connect. Apps such as Lose It, Tonal, Google Fit and smart-scale apps all write there, so their data arrives through one pipe, into your own Cloudflare account.

Health Connect is an on-device store with no cloud API, so something on the phone has to push the data out. This repo is the other end of that pipe:

scale / watch / apps ─▶ Health Connect (phone) ─▶ sync app ─POST /ingest─▶ Worker ─▶ D1 database
                                                                                              │
                               Claude (web, desktop, mobile) ──OAuth 2.1──▶ /mcp ─────────────┘
  • POST /ingest takes JSON from the companion Android app (health-connect-sync-android, or the HC Webhook app), authenticated with its own bearer token, and stores each record in a D1 table keyed by Health Connect's own record id. Re-syncs, edits and deletions are handled, so there are no duplicates.

  • /mcp is the read-only MCP endpoint behind an OAuth 2.1 login, so it works as a custom connector in claude.ai. The static owner token also works as a plain bearer for Claude Code.

  • Everything is single-user. Your data lives in your own Cloudflare account.

Tools

Tool

What it returns

get_sync_status

Every record type present: counts, first and latest record, last sync, which apps wrote it, recent syncs. Start here, and use it to confirm the phone is still syncing.

get_weight_history

Weight readings in kg and lb with min, max and change, plus the recording app

get_body_fat

Body fat percentage readings

get_sleep

Sessions by wake-up day, hours, and minutes per stage when the source provides stages

get_steps

Daily steps per source app, plus the largest single source (summing sources would double count)

get_daily_summary

Counts per type, steps, weights and sleep for one day

get_records

Raw records of any type (heart rate, nutrition, exercise, hydration, ...), newest first

Records are stored generically, so every data type the phone app sends is queryable through get_records even if it has no dedicated tool yet.

Related MCP server: Fitbit / Google Health MCP

Setup

You need a Cloudflare account with a domain, Node 22+, an Android phone with Health Connect, and npx wrangler login done once.

1. Deploy the Worker

  1. npm install, then cp wrangler.jsonc wrangler.local.jsonc.

  2. npx wrangler d1 create health-connect and npx wrangler kv namespace create OAUTH_KV. Paste both ids into wrangler.local.jsonc, and set your hostname in the route and in __ORIGIN__.

  3. npx wrangler d1 migrations apply health-connect --remote --config wrangler.local.jsonc

  4. npx wrangler deploy --config wrangler.local.jsonc (a new deploy can take up to 30 seconds to be served).

  5. Two secrets, each openssl rand -hex 32 (different values), set with npx wrangler secret put NAME --config wrangler.local.jsonc < file:

    • MCP_BEARER: your owner token, the password on the login page and a plain bearer for /mcp.

    • INGEST_TOKEN: the token the phone app sends. Keep it separate; it can only write data, not read it.

2. Point the phone at it

Option A, a free app you build yourself: health-connect-sync-android. Build and install it, provision the URL and token over USB (so the token is never typed on the phone), grant Health Connect read permissions, and tap Sync now.

Option B, an existing app: install HC Webhook from Google Play, grant it Health Connect read access, add a webhook with URL https://<your-host>/ingest and a custom header Authorization: Bearer <INGEST_TOKEN>, choose the data types, and sync.

Then ask Claude to run get_sync_status. You should see the record types and the apps that wrote them.

3. Connect Claude: claude.ai, Settings, Connectors, Add custom connector, https://<host>/mcp, then paste the owner token on the login page. Claude Code: claude mcp add --transport http health https://<host>/mcp --header "Authorization: Bearer <owner token>".

Develop and test

npm install
npm run check          # typecheck + unit tests (pure normalizer)

scripts/e2e.py exercises ingest, idempotent re-sends, edits, stale writes, deletions and every tool against a local wrangler dev --local instance; see its header for how to run it.

Notes and limits

  • Your health data is sensitive. The owner token is the only gate on reading it, and the ingest token on writing it. Keep both out of chat and git. Anyone who has them can read or inject data.

  • Free-plan limits. Workers on the free plan have a small per-request CPU budget. A first sync of dense data (for example heart rate samples) can exceed it. Start with weight, body fat, steps and sleep, then add heavier types one at a time. Requests over 10 MB or 40,000 records are rejected; the phone app retries.

  • Sources overlap. If a phone and a watch both record steps, raw sums double count. get_steps reports per source and the largest source rather than adding them up.

  • Dates and time zones are kept as the phone sends them (local time or UTC depending on the app's "payload timestamps" setting). Sleep is dated by the day you woke up.

  • The payload shape was taken from the app's documentation, not from every device. Unusual record types are stored as sent.

Built on

This project stands on other people's work. Please star and credit them:

Full details in NOTICE.md.

License

MIT, see LICENSE. Not affiliated with Google or the authors of the companion app.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      C
      maintenance
      Enables ChatGPT and Claude to access Android Health Connect records through nine read-only MCP tools for overviews, daily summaries, sleep, workouts, intraday series, trends, correlation, search, and fetch.
      MIT
    • A
      license
      Not graded
      quality
      B
      maintenance
      Enables AI assistants such as Claude, ChatGPT and Gemini to read wearable health data — daily activity, sleep stages, heart rate, SpO2, HRV, workouts, weight and nutrition — through a self-hosted, OAuth-protected Cloudflare Worker endpoint. It also lets users log weight, body fat, water, food, exercises, mood and symptoms by voice or chat, while leaving sensor-recorded data read-only.
      MIT
    • A
      license
      Not graded
      quality
      C
      maintenance
      Gives Claude read-only access to your own ring's health data — sleep, readiness, HRV, heart rate, activity, workouts, stress, resilience, SpO2, VO2 max and cardiovascular age — from claude.ai, desktop, and mobile. Runs as a private remote server on your own Cloudflare Worker, locked to a single account with OAuth-encrypted tokens and no stored health data.
      MIT
    • A
      license
      Not graded
      quality
      Not graded
      maintenance
      Enables Claude and other remote MCP clients to query your own read-only Garmin Connect data — recovery trends, sleep, HRV, Body Battery, stress, heart rate, and activities — through Garmin's official Personal API, with OAuth sign-in that works from the mobile apps as well as desktop. Deploys on Cloudflare Workers' free tier with no password sharing or scraping.
      MIT