
The Apple Health MCP server enables users to query their Apple Health data using SQL through DuckDB, powered by a natural language interface. It provides tools for executing SQL queries, generating automated health reports, and caching results efficiently, while supporting lazy loading of configurable time windows. The server solves the problem of accessing and analyzing Apple Health data by accepting CSV exports from the Simple Health Export app and making that data queryable through standard SQL syntax.
Query Apple Health data from an MCP client using SQL and DuckDB. The server runs locally, reads CSV exports on demand, and provides tools for schema discovery, analytical queries, and health summaries.
The native Apple Health export.xml format is not currently supported.
For Claude Desktop, add the following to
~/Library/Application Support/Claude/claude_desktop_config.json:
{
"mcpServers": {
"apple-health": {
"command": "npx",
"args": ["-y", "@neiltron/apple-health-mcp"],
"env": {
"HEALTH_DATA_DIR": "/path/to/your/unzipped/health-export"
}
}
}
}
Restart the client after changing its configuration. Other MCP clients can use
the same command, arguments, environment, and stdio transport.
| Variable | Required | Default | Purpose |
|---|---|---|---|
HEALTH_DATA_DIR | Yes | — | Directory containing the exported CSV files |
MAX_MEMORY_MB | No | 2048 | DuckDB memory limit in megabytes |
CACHE_SIZE | No | 100 | Maximum number of cached query results |
HEALTH_DATA_DIR to the resulting directory.The server reads the files in place. It does not upload the export or make network requests, although query results returned to your MCP client may be sent to that client's configured model provider.
| Tool | Purpose |
|---|---|
health_schema | Discover table names, columns, units, and sample rows |
health_query | Run one DuckDB SELECT-family analytical statement with JSON, CSV, or summary output |
health_report | Generate a weekly, monthly, or custom health summary |
Start with health_schema; table names depend on the files in your export.
See Querying Apple Health data
for the data model and working examples.
health_query accepts one DuckDB analytical statement. It supports joins,
CTEs, subqueries, set operations, window functions, and other DuckDB analysis
features. It rejects statements that change data or database settings. It also
rejects logging functions and functions that execute dynamic or serialized SQL.
The server limits DuckDB file access to HEALTH_DATA_DIR. It also disables
network access and temporary disk storage, and it locks the database settings.
The data directory stays readable and writable so the importer can read CSV
files.
These controls reduce accidental side effects from generated SQL. They do not
isolate the process. Run the server through a local stdio MCP client. Do not
expose it to an untrusted network client. Use process or OS isolation if the
server must accept untrusted SQL.
The first request that needs a table loads that table's full CSV history. There is no date window, so a query can reach as far back as the export goes.
Because every tool can reach the whole configured history, only start this server from an MCP client you trust with that data.
Loaded tables are held in memory, and DuckDB is given the MAX_MEMORY_MB limit
described above. Roughly 1 GiB covers a two-year multi-table export, so the
2048MB default leaves headroom; raise MAX_MEMORY_MB for a larger export. The
server never spills health rows to a temporary directory on disk, so an export
that does not fit in the limit fails with an explicit error instead.
Other current limitations:
sourceName where appropriate.git clone https://github.com/neiltron/apple-health-mcp.git
cd apple-health-mcp
bun install
npm test
npm run typecheck
npm run build
See Architecture for the code layout, data lifecycle, and implementation constraints.
MIT