Health4ai logo

Health4ai

Query Apple Health data stored in your Supabase project through local MCP tools for sleep, HRV, workouts, trends, and recovery.

Install Health4ai

Run the project’s own setup commands, in order.

Setup steps from the project

health4ai installs with its own steps rather than a config we can generate, so these are copied as-is. Follow them in order and run the commands in a terminal. Source: github.com

  1. 1. Install
    git clone https://github.com/jefflitt1/health4ai.git
    
  2. 2. Configure
    cp mcp-server/.env.example mcp-server/.env
    
  3. 3. Add to your MCP client
    mcphost --model ollama/llama3.2 \
      --mcp-server "health4ai:python /path/to/health4ai/mcp-server/main.py"
    

Overview

health4ai connects Apple Health data from an iPhone to a Supabase/Postgres database and exposes it through a local MCP server. Its tools cover sleep stages, HRV, workouts, HealthKit metrics, personal baselines, period comparisons, and recovery-oriented summaries. Use it when you want an AI client such as Claude Desktop, Claude Code, Cursor, or a local Ollama setup to query your own health data without a managed health-data backend. The iOS app performs the HealthKit sync, while the MCP process reads the resulting records from your Supabase project.

Use cases

  • Review recent sleep stages and recovery indicators
  • Compare HRV or another metric across two date ranges
  • Find days when a health metric exceeded a threshold
  • Inspect workout volume, duration, distance, and calories
  • Track monthly health trends across multiple years

Key features

  • Apple HealthKit sync through an iOS app
  • User-owned Supabase/Postgres storage
  • Local stdio MCP server
  • Sleep-source prioritization across wearable providers
  • Raw metrics, personal baselines, and period comparisons
  • Data-status reporting for empty metric results

Tools11

What Health4ai lets your agent do. Expand a tool for its parameters.

Self-reported~219 tokens of context

Security & health

What it can reach and how reliably it runs — from our own checks, not the maintainer’s claims.

ActiveLast checked

Recent health check succeeded.

15/15 checks healthy over the last 49d

Adoption & maintenance

Factual signals from GitHub, npm, and our automated checks — not a rating.

GitHub stars12Stargazers on the source repository.
Last commit5d agoMost recent push to the default branch.
Tools exposed11Callable tools this server registers over MCP.
Directory activity11 viewsConfig copies, upvotes, and views on AllMCPs.

How Health4ai works

What health4ai does

health4ai makes Apple Health data available to MCP-compatible AI clients through a database you create and control. The iOS app reads HealthKit data and synchronizes it to your Supabase project. The local MCP server then queries that data using purpose-built tools rather than requiring an AI client to access HealthKit directly.

Supported data includes sleep stages, HRV, heart rate, workouts, VO₂ max, and more than 150 other HealthKit metric types. The server can return recent summaries, raw time-series records, long-term monthly aggregates, threshold-based searches, personal statistics, and comparisons between date ranges.

Sleep results select one source per night using this order: Oura, Apple Watch, Whoop, Garmin, Withings, then another source with the most stage records. The same source-selection rule is used in recovery briefs.

How it works

The data path is:

iPhone HealthKit → your Supabase project → local MCP server → AI client

The iOS app uses HealthKit background observation and scheduled background tasks to sync records. A Supabase Edge Function receives the ingest requests, while the MCP process connects to the project's Postgres database using its pooler connection string. The server is run locally over standard input/output, so an MCP client launches the Python process directly.

The database and backend belong to the user. health4ai does not run a separate hosted backend or retain access to the health records.

Setup and configuration

Create a Supabase project and execute the supplied schema in its SQL editor. Deploy the healthkit-ingest Edge Function with the Supabase CLI, create a Supabase Auth user, and install the health4ai iOS app from the App Store. In the app, provide the project URL and anon key, sign in with the created user, and start synchronization.

From the repository checkout, copy mcp-server/.env.example to mcp-server/.env and set:

  • DATABASE_URL: the Supabase project's pooler PostgreSQL connection string, using the database password rather than an API key.
  • HEALTHKIT_USER_ID: the UID of the Supabase Auth user whose records the server should query.

Configure the MCP client to run python /path/to/health4ai/mcp-server/main.py with those environment variables. Claude Desktop, Claude Code, Cursor, and local Ollama workflows using an MCP client such as mcphost are shown usage paths.

Tools and capabilities

  • get_health_summary returns key metrics for a requested number of recent days.
  • get_sleep reports nightly duration and REM, Deep, and Core stages.
  • get_hrv_trend provides daily SDNN HRV with rolling comparisons and a trend.
  • get_daily_snapshot gathers records for one date.
  • get_workouts lists workout type, duration, distance, and calories.
  • query_metric retrieves raw time-series data for a HealthKit metric type.
  • get_long_term_trend produces monthly aggregates across multiple years.
  • get_coaching_brief combines recovery, sleep, training load, and fitness indicators.
  • search_records finds days when a metric crossed a threshold.
  • get_metric_stats calculates min, max, mean, and percentiles for a personal baseline.
  • compare_periods compares a metric across two date ranges.

Limitations and notes

Supabase is required for the supported backend; plain Postgres installations such as Neon or a local Docker database are not supported. The iOS app does not sign users up, so the Auth user must be created in the Supabase dashboard first.

HealthKit can return an empty result both when no samples exist and when a permission was not shared. Tools that can be empty include a data_status block: never_recorded indicates that the metric has never produced a sample, while empty_window indicates a gap in the requested period despite data elsewhere. Check Health sharing permissions and re-import when appropriate.

The iOS component requires iOS 17 or newer, and the project identifies Python 3.11 or newer as its runtime requirement. The project is licensed under MIT.

Written by AllMCPs with AI assistance from the project’s README and listing data. How we build listings

Reviews

No reviews yet — be the first to share how it worked for you.

Frequently Asked Questions about Health4ai

health4ai is an MCP server that connects AI clients to Apple Health data stored in your own Supabase/Postgres project. Its main tools query sleep, HRV, workouts, HealthKit metrics, daily snapshots, trends, personal statistics, period comparisons, threshold matches, and recovery briefs through a local Python process.

Install the repository, configure the Supabase backend and iOS sync, then run the MCP server from the checkout. Copy `mcp-server/.env.example` to `.env`, set `DATABASE_URL` and `HEALTHKIT_USER_ID`, and configure your client to launch `mcp-server/main.py` with Python.

Yes, health4ai works with Cursor through its standard MCP configuration. Add the server block to `~/.cursor/mcp.json`, using the Python path to `mcp-server/main.py` and the `DATABASE_URL` and `HEALTHKIT_USER_ID` environment variables.

No, health4ai requires a Supabase project for its supported backend. The iOS app sends data through the project's `healthkit-ingest` Edge Function, and the MCP server reads the resulting records through the Supabase project's pooler connection.

Related MCP servers

Add a badge to your READMEShow it’s listed — live SVG, Markdown or HTML.

AllMCPs Directory Badge

Full Badge Customizer

Showcase your server listing on GitHub or your project documentation. Embed this dynamic SVG badge to highlight official listing status and live engagement.

Badge Style:
Live Dynamic SVG PreviewHealth4ai AllMCPs Directory Badge
Markdown (GitHub README)
[![AllMCPs](https://allmcps.com/api/badge/health4ai?style=directory)](https://allmcps.com/mcp/health4ai)
HTML Embed
<a href="https://allmcps.com/mcp/health4ai"><img src="https://allmcps.com/api/badge/health4ai?style=directory" alt="Health4ai on AllMCPs" /></a>