How health4.ai works
Apple has no server-side HealthKit API: there is no webhook, no OAuth flow, no REST endpoint that lets a remote server pull your health data. health4.ai solves this with a free iOS app that moves HealthKit data to a destination you own: a Google Sheet in your own Google Drive (the easiest option), or your own Postgres/Supabase database for power users. There is no health4.ai account and no health4.ai server, so your data never touches us.
Every tracker that shares with Apple Health
Not just Apple Watch. If it writes to Apple Health, health4ai syncs it.
- Rings and watches: Apple Watch, Oura, Garmin, Polar, Coros, Ultrahuman.
- Scales and blood pressure: Withings, Renpho, Omron.
- Glucose: Dexcom.
- Workouts: Strava, Peloton, Nike Run Club.
- Nutrition: MyFitnessPal, Cronometer.
- Sleep: Eight Sleep, AutoSleep.
- All of the above sync to Apple Health.
- Apple Health syncs to health4ai.
- health4ai syncs to a destination you own: a Google Sheet in your Drive, or a Postgres/Supabase database.
- Your data is available to AI clients: Claude, ChatGPT, Cursor, Ollama.
One real database: 40 devices and apps. The biggest source isn't Apple Watch. It's Oura.
Coverage depends on what each brand shares with Apple Health. Some hold back metrics (for example, WHOOP does not share Recovery or Strain), and Fitbit and FreeStyle Libre do not share to Apple Health at all.
Setup: start with a Google Sheet
- Download health4.ai from the App Store (free).
- Choose Save to Google Sheets and sign in with Google. The app creates one spreadsheet in your Drive, with one row per day: steps, sleep, heart rate, HRV, workouts and more. It uses the narrow
drive.filescope, so it can only see files it creates. - Allow Health access. The app syncs in the background when iOS allows it, and you can sync from the app any time. Background timing is decided by iOS.
- Open the sheet in Google Drive. Share it with an AI assistant that has Google Drive access, or download it as CSV and give it to any AI assistant. Want your AI to query live data over MCP? Use the database option below.
The in-app setup checklist, Sync History, and Your Sources screen (every device and app writing to Health) help you confirm it is working. If iOS shares only recent Health data, the app tells you.
Power users: your own database
Want every HealthKit sample, queryable by any MCP client? Send data to a Postgres/Supabase database you own instead. Steps 1 to 5 below are for this option; you do not need them for Google Sheets.
Create a free Supabase project
Go to supabase.com and create a free project. Open its SQL editor and run the health4.ai schema (tables, row-level security, grants), then deploy the ingest function and add the user you will sign in as:
# 1. SQL editor → run https://health4.ai/schema.sql
# 2. Deploy the ingest function (Supabase CLI):
supabase functions deploy healthkit-ingest \
--project-ref <ref> --no-verify-jwt
# 3. Authentication → Users → add the user you will sign in asSupabase only: the app signs in with Supabase Auth and writes through a Supabase Edge Function. Download schema.sql · Full setup guide
Install the iOS app and connect your database
Download health4.ai from the App Store. Tap through the Welcome and Privacy screens, then open the Connect tab and choose the database option (Supabase). Paste your project URL and anon key, then tap Sign In as the user you added.
https://abc123.supabase.co — Settings → APIeyJ… — Settings → API → anon publicGrant HealthKit access, and sync begins
Tap Allow Health Access during onboarding. iOS shows the standard HealthKit permission sheet, and you choose which types to share. The app imports the history iOS shares with it, then keeps syncing new data in the background when iOS allows it (it registers HKObserverQuery, but iOS decides when the app actually wakes). If you only share "Past 30 Days" on iOS 27, the app warns you; widen access in Settings or the Health app.
Run the MCP server on your Mac
Clone the repo and configure the server with your Supabase credentials:
git clone https://github.com/jefflitt1/health4ai
cd health4ai/mcp-server
pip install -r requirements.txt
cp .env.example .env
# Edit .env: SUPABASE_URL, SUPABASE_SERVICE_ROLE_KEY, HEALTHKIT_USER_IDAdd to your AI client
Add one block to your AI's MCP config. Works with Claude Desktop, Cursor, Continue, and any MCP-compatible client:
{
"mcpServers": {
"health4ai": {
"command": "python3",
"args": ["/path/to/health4ai/mcp-server/main.py"]
}
}
}Ask your AI about your health
Once the first sync completes (the time depends on how much history iOS shares), go to your AI and ask:
Common questions
Can I use Neon or a local Postgres for the database option?▾
No. The database option signs in with Supabase Auth and sends data to a Supabase Edge Function, so it needs a Supabase project you own. The Google Sheet option needs no database at all. Neon, local Docker and other plain Postgres hosts have no way to receive data from the app. Full setup guide
Can I use health4.ai with multiple AI clients?▾
Yes. With the database option, the MCP server is a local stdio process: point as many AI clients as you like at the same main.py. Add the server entry to Claude Desktop, Cursor, Continue, or any MCP-compatible client. All clients read from the same Supabase database.
Does health4.ai ever see my health data?▾
No. The iOS app sends data directly from your iPhone to your own Google Sheet or database. There is no health4.ai account and no health4.ai server in the path. We never see your health data.
How do I revoke HealthKit access?▾
Go to iPhone Settings → Privacy & Security → Health → health4ai and toggle off any or all data types. The app stops receiving new data immediately. Your historical data stays in your own Google Sheet or database; delete it there directly if you want it gone.
Under the hood (database option)
iPhone (health4.ai iOS app)
└─ HKObserverQuery ──► fires on every new HealthKit sample
└─ BGProcessingTask ──► runs full sync while charging
│ POST /functions/v1/healthkit-ingest (your Edge Function)
▼
Your Supabase project (you own this — health4.ai has no access)
├── healthkit_metrics (raw samples, 30-day rolling window)
└── healthkit_daily_summaries (pre-aggregated, multi-year)
│ read over a direct Postgres connection
▼
health4ai MCP server (local stdio, runs on your Mac)
tools: get_sleep · get_hrv_trend · get_workouts · get_daily_snapshot
query_metric · get_health_summary · get_long_term_trend
search_records · get_metric_stats · compare_periods
get_coaching_brief
│
▼
Claude Desktop / Cursor / Continue / OllamaOpen source, MIT licensed. The full source for the iOS app and MCP server is at github.com/jefflitt1/health4ai.