Apple Health MCP Server
Apple Health MCP 服务器
使用 SQL 和 DuckDB 从 MCP 客户端查询 Apple Health 数据。该服务器在本地运行,按需读取 CSV 导出文件,并提供模式发现、只读查询和健康摘要等工具。
要求
Node.js 22 或更高版本
使用 Simple Health Export CSV 创建的 Apple Health CSV 导出文件
目前不支持 Apple Health 原生的 export.xml 格式。
Related MCP server: apple-mcp
配置 MCP 客户端
对于 Claude Desktop,请将以下内容添加到 ~/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"
}
}
}
}更改配置后请重启客户端。其他 MCP 客户端可以使用相同的命令、参数、环境和 stdio 传输方式。
环境变量
变量 | 是否必需 | 默认值 | 用途 |
| 是 | — | 包含导出 CSV 文件的目录 |
| 否 |
| DuckDB 内存限制(以兆字节为单位) |
| 否 |
| 缓存查询结果的最大数量 |
导出健康数据
在 iPhone 上安装并打开 Simple Health Export CSV。
选择全部并选择要导出的时间范围。
将压缩包传输到运行 MCP 客户端的计算机。
解压缩并将
HEALTH_DATA_DIR设置为生成的目录。
服务器会就地读取文件。它不会上传导出数据,也不会发起网络请求,但返回给 MCP 客户端的查询结果可能会被发送到该客户端配置的模型提供商。
工具
工具 | 用途 |
| 发现表名、列、单位和示例行 |
| 运行只读 |
| 生成每周、每月或自定义健康摘要 |
从 health_schema 开始;表名取决于导出文件中的文件。有关数据模型和工作示例,请参阅 查询 Apple Health 数据。
历史记录与内存
第一个需要某个表的请求会加载该表的完整 CSV 历史记录。没有日期窗口限制,因此查询可以追溯到导出所涵盖的最早时间。
由于每个工具都可以访问全部已配置的历史记录,因此只能从您信任其处理这些数据的 MCP 客户端启动此服务器。
已加载的表保存在内存中,DuckDB 会获得上述 MAX_MEMORY_MB 限制。大约 1 GiB 可以覆盖两年的多表导出,因此 2048MB 的默认值留有足够余量;对于更大的导出,请提高 MAX_MEMORY_MB。服务器绝不会将健康数据行溢出到磁盘上的临时目录,因此如果导出数据超出内存限制,将直接以明确的错误提示失败。
其他当前限制:
仅支持 Simple Health Export CSV 的布局。
DuckDB 数据库位于内存中,每次服务器进程都会重建,因此每次启动都会从 CSV 文件重新加载。持久化增量导入是计划中的未来工作,而非当前行为。
设备重叠可能会产生看起来重复的测量值;查询应在适当情况下考虑
sourceName。健康摘要仅汇总已记录的数据,不构成医疗建议。
开发
git clone https://github.com/neiltron/apple-health-mcp.git
cd apple-health-mcp
bun install
npm test
npm run typecheck
npm run build有关代码布局、数据生命周期和实现约束,请参阅 架构。
许可证
MIT
Maintenance
Related MCP Servers
- AlicenseAqualityCmaintenanceA Model Context Protocol server that enables seamless interaction between LLM-based agents and Apple Health data, allowing users to query, analyze, and manage health records through natural language commands.7250MIT
- AlicenseBqualityDmaintenanceMCP server for macOS Apple apps. Enables read/write access to Notes, Reminders, Calendar, Contacts, and Safari using SQLite and JXA, all running locally.428122MIT
- AlicenseAqualityAmaintenanceLocal-first MCP server that connects AI agents to your Oura Ring readiness, sleep, activity, and HRV data. Tokens never leave your machine.273342MIT
- AlicenseAqualityAmaintenanceAn MCP server that enables AI agents to query Apple Health data (190+ metrics) in natural language, including trends, comparisons, and structured exports.148153MIT
Related MCP Connectors
GibsonAI MCP server: manage your databases with natural language
MCP server for Withings health data — sleep, activity, heart, and body metrics.
Hosted MCP server exposing US hospital procedure cost data to AI assistants
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/neiltron/apple-health-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server