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 分