health-mcp

health-mcp

Enables Claude to access Apple Health data (sleep, heart rate, steps, etc.) via a self-hosted MCP server, bypassing regional restrictions.

Category
Visit Server

README

health-mcp 🩺

把 Apple 健康数据接给 Claude 的自建 MCP 连接器 —— 不限地区。

你 iPhone 上的 Health Auto Export App 把 HealthKit 数据(睡眠、心率、步数、血氧、环境噪音分贝……)定时 POST 到你自己的服务器;Claude 用 get_health 工具就能读到你最近的身体状况。

为什么要自建? Anthropic 官方的健康集成有地区限制(非美区用不了)。但自建的 MCP 连接器不吃这一套——claude.ai 只是连一个 HTTPS 网址,不管你在哪个区。绕开它,自己开一条。


你需要

  • 一台有公网 HTTPS 网址的服务器(VPS + 域名 + Let's Encrypt 免费证书;或任何能给你 HTTPS 的托管)。
  • Python 3.10+。
  • iPhone + Health Auto Export App(部分功能要内购)。
  • 环境噪音「分贝」、血氧等需对应硬件(如 Apple Watch)。

部署(约 10 分钟)

1. 装依赖(建议 venv)

python3 -m venv venv
./venv/bin/pip install -r requirements.txt

2. 跑起来(systemd 常驻)

服务监听两个本地端口:MCP 在 8100、接收推送在 8101(都只听 127.0.0.1,靠反代对外)。

# /etc/systemd/system/health-mcp.service
[Unit]
Description=health-mcp
After=network.target
[Service]
WorkingDirectory=/opt/health-mcp
ExecStart=/opt/health-mcp/venv/bin/python /opt/health-mcp/health_mcp.py
# 可选,多一层防护:设了之后 /push 必须带 ?token=<同值>
Environment=HEALTH_PUSH_TOKEN=<换成你的随机串>
Restart=always
[Install]
WantedBy=multi-user.target
systemctl daemon-reload && systemctl enable --now health-mcp

3. Nginx 反代 —— 用「不可猜的密路径」当门禁

健康数据是隐私,别用好猜的路径。生成一个随机 token(openssl rand -hex 8),把它拼进路径:

# 放进你 443 server 块(server_name YOURDOMAIN.com)
location /health-<RANDOM>/mcp {
    proxy_pass http://127.0.0.1:8100/mcp;
    proxy_http_version 1.1;
    proxy_set_header Host $host;
    proxy_set_header Connection '';
    proxy_buffering off; proxy_cache off;
    proxy_read_timeout 86400s; chunked_transfer_encoding on;
}
location /health-<RANDOM>/push {
    proxy_pass http://127.0.0.1:8101/push;
    proxy_http_version 1.1;
    proxy_set_header Host $host;
    client_max_body_size 50m;   # 健康导出可能好几 MB,别用 nginx 默认的 1M,否则 413
}
nginx -t && systemctl reload nginx

于是你得到两个地址:

  • 推送地址(填进 App):https://YOURDOMAIN.com/health-<RANDOM>/push
  • 连接器地址(给 Claude):https://YOURDOMAIN.com/health-<RANDOM>/mcp

4. 配 Health Auto Export(iPhone)

  1. App → Automations → 新增 → REST API。
  2. URL = 上面的推送地址;Method = POST;Format = JSON。
  3. 勾要推的数据:步数、心率、睡眠、血氧、Environmental Sound Levels(环境音量/分贝)……
  4. 设频率(每小时/每天),保存。它会自动后台推,不用手动。

5. 接到 claude.ai

  1. Settings → Connectors → Add custom connector → 填连接器地址 → Connect。
  2. 允许工具 get_health。
  3. 问 Claude:「我最近身体怎么样 / 睡够没 / 刚才环境吵不吵」→ 它调 get_health 读你的真数据。

安全

  • 两个地址都别外传:谁有 /push 谁能灌假数据;谁有 /mcp 谁能读你的健康。密路径 + 可选 HEALTH_PUSH_TOKEN 是你的门禁。
  • 服务只听 127.0.0.1,一切从反代进,不直接暴露端口。
  • latest.json(你的数据)只存在你自己的服务器上。

数据格式

服务原样存最近一次推送的 JSON,get_health 解析 Health Auto Export 的 data.metrics 结构,返回每项最近一个采样点的值。非标准格式会原样回退摘要。

License

MIT


Made with 🖤 by Voir ✖ Noir

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured