Back to Browse

Healthsql MCP Server

Developer ToolsLow Risk10.0MCP RegistryLocal
Free

Server data from the Official MCP Registry

Your whole Apple Health record as a local SQLite database. Read-only SQL, on your Mac.

About

Your whole Apple Health record as a local SQLite database. Read-only SQL, on your Mac.

Security Report

10.0
Low Risk10.0Low Risk

Valid MCP server (0 strong, 2 medium validity signals). No known CVEs in dependencies. Imported from the Official MCP Registry.

4 files analyzed · No issues found

Security scores are indicators to help you make informed decisions, not guarantees. Always review permissions before connecting any MCP server.

Permissions Required

This plugin requests these system permissions. Most are normal for its category.

file_system

Check that this permission is expected for this type of plugin.

env_vars

Check that this permission is expected for this type of plugin.

Shell Command Execution

Runs commands on your machine. Be cautious — only use if you trust this plugin.

database

Check that this permission is expected for this type of plugin.

What You'll Need

Set these up before or after installing:

HEALTHSQL_EXPORT_DIRRequired

How to Install

Install command not verified. See the repository for install instructions.

View repository

Documentation

View on GitHub

From the project's GitHub README.

HealthSQL

Your whole Apple Health record as a local SQLite database, so that an AI agent on your computer can answer questions about your body. The agent queries it with SQL, from a shell or as an MCP server.

Apple Health lives on the iPhone. Apple gives it no way to a computer except a manual export, and that export is out of date the day you make it. HealthSQL has two parts:

  1. An iPhone app that copies every Health record to its own folder in your iCloud Drive and keeps the copy current.
  2. healthsql, this repository. One Python file that reads that folder and builds the database. Claude Code, Codex, Claude Desktop, Cursor, and any other agent that has a shell or speaks MCP can then query it.
Watch, ring, scale → Health on the iPhone → the HealthSQL app → your iCloud Drive → healthsql → your agent

There is no server and no account. Your Apple Account is the only link between the phone and the computer: iCloud Drive carries the files.

Guides and the full reference are at healthsql.app.

The iPhone app is with Apple for review. Until it is in the App Store, you can try the command on the sample data in this repository: see Try it without an iPhone.

Install

curl -fsSL https://healthsql.app/install | sh

This saves one file to ~/.local/bin/healthsql and then starts healthsql setup, which checks the computer, builds the database, and prints how to connect each agent. It needs Python 3.9 or later and nothing else. On a Mac, xcode-select --install gives you Python.

You can read the code before you use it. It is healthsql.py: one file, standard library only.

With uv or pipx:

uv tool install git+https://github.com/declankra/healthsql
pipx install git+https://github.com/declankra/healthsql

The computer must be signed in to the same Apple Account as the iPhone, with iCloud Drive on. The first build reads your whole history, so a record of millions of samples takes a few minutes.

Connect your agent

An agent that has a shell needs nothing more: it can call healthsql and read the answer.

For MCP, the command registers itself with the client you name:

healthsql connect claude-code      # or: codex, claude-desktop, cursor

For any other MCP client, add a stdio server whose command is the full path to healthsql and whose one argument is mcp:

{
  "mcpServers": {
    "healthsql": { "command": "/Users/you/.local/bin/healthsql", "args": ["mcp"] }
  }
}

HealthSQL is in the MCP registry as io.github.declankra/healthsql.

The server has two tools:

ToolWhat it does
health_overviewSays what the database holds: when the iPhone last synced, each view with its columns, example queries, and every metric with its unit and date range. The agent calls it once.
health_queryTakes one read-only SQL statement and returns the rows as JSON.

You can also give the whole setup to your agent. Tell it:

Set up HealthSQL on this computer so you can read my Apple Health data. Follow https://healthsql.app/agents.md and tell me what my record covers when you are done.

Ask in SQL

healthsql                                     # start here: the views, their columns, examples, every metric
healthsql query "SELECT day, steps, resting_hr, hrv_ms, asleep_min FROM daily ORDER BY day DESC LIMIT 7"
healthsql query --csv "SELECT * FROM daily" > daily.csv
healthsql status                              # is the feed alive, and what to do if it is not
healthsql sync                                # read every waiting file from the iPhone now

Each command first reads the files that are new, so an answer is as fresh as the phone's last sync. Every answer is JSON and says how fresh it is:

{"rows":[{"day":"2026-11-30","steps":1200,"active_kcal":1150.0,"hr_avg":151.21,"asleep_min":420.0}],
 "truncated":false,"phone_synced":"2026-11-30T14:17:30-08:00"}

The views:

ViewOne row for eachUse it for
dailydayAny question about a day or a trend: steps, distance, energy, heart rate, HRV, weight, sleep and more, side by side.
daysmetric and dayApple Health's own total for every metric it holds, with sum for a metric that adds up and avg, min, max for one that does not.
nightsnight of sleepTime asleep and in each stage, from one source.
nights_by_sourcenight and sourceA watch compared with a ring, or a source other than the one nights chose.
sleepsleep stage intervalThe stages of a night, minute by minute.
workoutsworkoutActivity, minutes, distance, heart rate, and the whole record as JSON.
samplesraw measurementA value at a time of day, or one source's own numbers.
ringsdayMove, Exercise and Stand, with the goals.

Under the views is one table, records, with every record the phone sent: quantities, categories, workouts, GPS routes, State of Mind entries, ECG summaries.

What it is careful about

  • Daily totals are Apple Health's own. A watch, a phone and a ring each record the same walk, so a sum of the raw step samples counts it two or three times. Only Health knows which source counts for which minute. The iPhone app asks Health for each day's total, the number the Health app shows, and daily and days hold those numbers.
  • Every answer says how fresh it is. phone_synced is the phone's last export. When something is wrong (the phone went quiet, files are still downloading, Health refused a type), there is one problem line that names what you must do.
  • Unknown is not zero. A day that has no total has no row.
  • A night comes from one source. If a watch and a ring both recorded it, nights picks the one with sleep stages and nights_by_source shows both.
  • Units do not depend on the phone's region. Lengths are meters, mass is kg, energy is kcal, temperature is degC, and a percent is a 0-1 fraction.
  • Deletions carry over. A record deleted on the phone leaves the database.
  • Queries cannot change anything. The database opens read-only for every query.

Privacy

  • The command makes no network requests. It reads the files in your iCloud Drive folder and writes one database file on your computer (on a Mac: ~/Library/Application Support/HealthSQL/health.db). You can delete that file at any time; the next command builds it again.
  • The rows your agent reads enter its context, so they go to the model provider that agent uses. With a local model they go nowhere.
  • What the iPhone app does is in the privacy policy.

Limits

  • iOS lets no app read Health while the iPhone is locked. New data arrives after you next unlock the phone.
  • Not in the export: clinical records, medications, vision prescriptions, ECG voltages, heartbeat series, audiograms.
  • We test on macOS. The command also knows where iCloud for Windows keeps the folder, but that path is not tested yet.
  • HealthSQL is not a medical device, and an agent is not a doctor.

Try it without an iPhone

The repository has a small sample export: one made-up day, written by the app in the iOS Simulator.

git clone https://github.com/declankra/healthsql && cd healthsql
export HEALTHSQL_EXPORT_DIR="$PWD/testdata/export" HEALTHSQL_DB=/tmp/healthsql-sample.db
python3 healthsql.py
python3 healthsql.py query "SELECT day, activity, minutes, meters, avg_hr FROM workouts"
python3 healthsql.py mcp        # an MCP server on stdin and stdout

The sample is from 30 November 2026. Because that is more than three days ago, each answer has a problem line that says the iPhone last synced some days ago. That is what you would see for a real phone that stopped exporting.

In this repository

Feedback

If HealthSQL cannot do what you need, or a number looks wrong, write to contact@dkbuilds.co or open an issue. A person reads every message.

License

MIT. Copyright (c) 2026 dkBuilds LLC.

Reviews

No reviews yet

Be the first to review this server!