Apple Health

io.github.neiltron由 GitHub 账号 neiltron 发布v1.4.5更新于 Nov 3, 2026

Local-first Apple Health MCP server for questions about your sleep, workouts and heart data.

已验证STDIO仅桌面位置与生活数据与分析

概览

AI 生成的概览

本地运行的 MCP 服务器,让助手用 SQL 查询导出的 Apple Health 睡眠、锻炼和心率数据,并生成健康摘要。

可以做什么
  • 查看健康导出中的表名、列、单位和示例行
  • 执行一条 DuckDB 分析型 SELECT 语句,输出 JSON、CSV 或摘要
  • 生成每周、每月或自定义时间范围的健康报告
适用场景
当你的电脑上已有 Apple Health 的 CSV 导出,并希望助手回答关于睡眠、锻炼、心率等记录指标的问题,或定期生成汇总时使用。
运行要求
通过 npx 以 stdio 在本地运行,需要 Node.js 22 或更高版本。需要由 Simple Health Export CSV 生成并解压的 Apple Health CSV 导出,其目录通过 HEALTH_DATA_DIR 指定。可选 MAX_MEMORY_MB(默认 2048)和 CACHE_SIZE(默认 100)。无需账号或 API 密钥。
安装前请注意
所有工具都能访问导出中的全部历史数据,因此只应从你信任该数据的 MCP 客户端连接。返回给客户端的结果可能被发送到该客户端配置的模型提供商。防护措施限制文件访问并禁用网络和临时磁盘存储,但不隔离进程;不要将其暴露给不受信任的网络客户端。报告不是医疗建议。

安装

在 SourceWeft 中

  1. 打开 控制台中的 Apple Health,将其添加到工作区。
  2. 为需要使用其工具的对话启用该服务。

Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。

其他 MCP 客户端

参照 仓库 中的启动说明。

README

Apple Health MCP Server

[npm version] [License: MIT]

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.

Requirements

The native Apple Health export.xml format is not currently supported.

Configure an MCP client

For Claude Desktop, add the following to ~/Library/Application Support/Claude/claude_desktop_config.json:

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.

Environment variables

VariableRequiredDefaultPurpose
HEALTH_DATA_DIRYes—Directory containing the exported CSV files
MAX_MEMORY_MBNo2048DuckDB memory limit in megabytes
CACHE_SIZENo100Maximum number of cached query results

Export health data

  1. Install and open Simple Health Export CSV on your iPhone.
  2. Select All and choose the time range to export.
  3. Transfer the archive to the computer running your MCP client.
  4. Unzip it and set 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.

Tools

ToolPurpose
health_schemaDiscover table names, columns, units, and sample rows
health_queryRun one DuckDB SELECT-family analytical statement with JSON, CSV, or summary output
health_reportGenerate 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. See Query safeguards for supported statements and restricted operations.

Query safeguards

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.

History and memory

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:

  • Only the Simple Health Export CSV layout is supported.
  • The DuckDB database is in memory and is rebuilt for each server process, so each launch reloads from the CSV files. Persistent incremental import is planned future work, not current behavior.
  • Device overlap can produce duplicate-looking measurements; queries should account for sourceName where appropriate.
  • Health reports summarize recorded data and are not medical advice.

Development

bash
git clone https://github.com/neiltron/apple-health-mcp.gitcd apple-health-mcpbun install
npm testnpm run typechecknpm run build

See Architecture for the code layout, data lifecycle, and implementation constraints. See Release procedure for publishing and recovery steps.

License

MIT

来源:README.md,提交 5b0320d

工具

0
SourceWeft 尚未在沙箱中启动过该软件包,因此其工具未知。

版本历史

2
  1. v1.4.5最新Sep 20, 2026
  2. v1.4.1Sep 16, 2026

评分

已满足适用检查项的 50%

该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。

  • 近 30 天内可连通25 分

    请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。

  • 已声明认证方式10 分

    请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。

  • 已列出工具15 分

    请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。

  • 描述必需15 分
  • 图标10 分
  • 文档15 分
  • 许可证10 分