Apple Health MCP Server

Apple Health MCP Server

Streams Apple Watch health metrics (HRV, sleep, heart rate, etc.) to Claude via iOS Shortcuts and Redis, enabling personalized daily health briefings and training guidance.

Category
访问服务器

README

Apple Health MCP Server

An MCP server that streams your Apple Health data to Claude. Say "GM" and get a personalized daily health briefing based on your HRV, sleep, heart rate zones, and training patterns.

Why This Exists

I wanted Claude to understand my body. Not generic health advice. My HRV. My sleep. My training load. Every morning I say "GM" and Claude tells me how I'm actually doing and what I should do about it.

The Stack

Apple Watch → iPhone Health App → iOS Shortcuts → Vercel → Upstash Redis → Claude (MCP)

Why Vercel? Native MCP support. Deploy a Python function, it speaks MCP. Done.

Why Upstash Redis? Serverless Redis with a REST API. Free tier is generous. No infrastructure to manage. Data stays yours.

Why iOS Shortcuts? No app to build. Shortcuts can query HealthKit and POST to an API. Janky? A little. Works? Perfectly.

What You Get

Every morning, Claude gives you:

  • Recovery read: HRV vs your 14-day baseline, sleep quality, resting HR trends
  • Training guidance: Push, maintain, or back off based on your body's signals
  • Watch-outs: Patterns worth monitoring (sleep fragmentation, elevated HR, skipped meditation)
  • Day outlook: How you'll likely feel

Claude sees all your metrics: HRV, resting HR, HR zones, sleep (quality, fragmentation, deep/REM), exercise minutes, steps, active calories, mindful minutes, and respiratory rate.

<details> <summary>Example Output</summary>

Example Output

</details>

Setup (15 minutes)

1. Upstash Redis

  1. Go to upstash.com, create account
  2. Create a Redis database (free tier)
  3. Grab the REST URL and token

2. Deploy to Vercel

  1. Fork this repo
  2. Go to vercel.com/new, import your fork
  3. Add these environment variables:
Variable What it is
UPSTASH_REDIS_REST_URL From Upstash dashboard
UPSTASH_REDIS_REST_TOKEN From Upstash dashboard
API_KEY Run openssl rand -hex 32
MCP_SECRET Run openssl rand -hex 16
EXERCISE_DAYS_PER_WEEK Optional. e.g., strength:4,yoga:7,cardio:2
  1. Deploy. That's it.

<details> <summary>Vercel Environment Variables</summary>

Vercel Env

</details>

3. iOS Shortcuts

You'll create individual shortcuts for each health metric, then a master shortcut that runs them all.

Sub-shortcuts (one per metric):

Each sub-shortcut does two things:

  1. Find Health Samples - Query a specific metric for the last 24 hours
  2. Get Contents of URL - POST to https://your-app.vercel.app/api/ingest
    • Method: POST
    • Headers: Authorization: Bearer YOUR_API_KEY
    • Body: Form encoded, with field name matching the metric

Critical configuration:

Field name Health metric Group by: Day Source Filter
steps Step Count YES Your Apple Watch
exercise Exercise Minutes YES Your Apple Watch
activeEnergy Active Energy YES Your Apple Watch
hrv Heart Rate Variability NO None
heartRate Heart Rate NO None
respRate Respiratory Rate NO None
sleep Sleep Analysis NO None
mindful Mindful Minutes NO None

Why this matters:

Cumulative metrics (steps, exercise, active energy) need special handling:

  • Group by: Day aggregates readings into daily totals instead of individual samples
  • Source Filter prevents double-counting. Without it, iOS returns readings from both iPhone and Apple Watch, inflating totals by ~20%

Discrete metrics (HRV, heart rate, respiratory rate) should NOT use grouping. They need individual samples for proper avg/min/max calculations.

<details> <summary>Sub-shortcut Example</summary>

Shortcut Example

</details>

<details> <summary>Steps Shortcut with Group by Day + Source Filter</summary>

Steps Shortcut

</details>

Master shortcut:

Create a master shortcut that calls all your sub-shortcuts in sequence. This is what you'll run each morning.

<details> <summary>Master Shortcut</summary>

Master Shortcut

</details>

Automation (semi-automated):

You can schedule the master shortcut to run daily. Go to Shortcuts → Automation → Create Personal Automation → Time of Day.

Important limitation: iOS requires confirmation for health data access. The automation will prompt you to tap "Run" each morning. It cannot run fully automatically. Your phone must be unlocked, and you cannot trigger it from your Apple Watch.

<details> <summary>Automation Setup</summary>

Automation List Automation Detail

</details>

One more thing: Go to Settings → Shortcuts → Advanced → Enable "Allow Sharing Large Amounts of Data". Otherwise iOS blocks large health exports.

Run your shortcuts once. Check your data is flowing: https://your-app.vercel.app/api/data?days=1 (add your API key as Bearer token).

4. Connect Claude

Add the MCP server in Claude's settings under Connectors:

{
  "mcpServers": {
    "health": {
      "url": "https://your-app.vercel.app/api/mcp?key=YOUR_MCP_SECRET"
    }
  }
}

<details> <summary>Claude MCP Connector</summary>

Claude Connector

</details>

5. System Instructions

Add this to your Claude project. Customize the "ABOUT ME" section for you.

When I say "GM" or "good morning", check my health data and brief me on my day.

ABOUT ME:
- 40s, focused on longevity and consistent training
- I track HRV as my primary recovery signal
- I'd rather undertrain than overtrain

WHAT I NEED FROM YOU:
1. Recovery read: How is my body doing? Compare yesterday's metrics vs baseline.
2. Training guidance: What should I do today? Push, maintain, or back off?
3. Watch-outs: Anything I should avoid or pay attention to?
4. Day outlook: How will I likely feel? What can I expect?

HOW TO REASON:
- Yesterday's data is your primary source. My shortcut syncs the previous day's data each morning, so "today" will always be empty. Don't mention missing today data.
- Look at yesterday's HRV vs baseline (negative % = below normal, needs attention)
- Look at recent_days for my training cycle. Low exercise_min (<30) = rest day, high (>60) = training day. Missing days = phone locked, no sync.
- Look at hr_zones for training intensity. High "hard"/"max" percentage = intense session. High "rest" = easy day or no workout.
- Look at yesterday's sleep quality (fragmentation, deep sleep, REM)
- Look at resting HR trend (elevated = accumulated fatigue)
- Look at steps and active_calories for total daily load. High step counts (>8k) or calories (>800) on top of training means more recovery/nutrition needed.
- Look at mindful_min for stress management. Zero meditation during high training load amplifies fatigue.
- Correlate signals across recent_days. One bad metric isn't the story, patterns are.

Keep it tight. 6-8 lines max. No disclaimers. Be direct.

How It Works

Claude gets raw data. No scores. No pre-computed "recovery status." Just numbers.

The magic is letting the LLM reason. It notices things like:

  • "HRV down but you had two hard days, that's expected adaptation"
  • "Resting HR crept up 6 bpm this week, watch for accumulated fatigue"
  • "Sleep fragmentation high but architecture is fine, you're okay"

MCP Tools

Tool What it does
get_today Raw health data for today (unprocessed)
get_trends Full metrics over multiple days (default 7 days)
get_recovery_status Comprehensive view: HRV vs 14-day baseline, plus last 3 days with all metrics (HRV, resting HR, HR zones, sleep, exercise, steps, calories, mindful, respiratory rate)

Troubleshooting

Steps/exercise showing wrong values?

  • Verify "Group by: Day" is enabled for cumulative metrics (steps, exercise, activeEnergy)
  • Verify Source Filter is set to your Apple Watch name
  • Without these settings, you get sample counts instead of totals, and double-counted values

Heart rate showing absurdly high values (e.g., 26,000)?

  • You accidentally enabled "Group by: Day" on a discrete metric
  • Remove grouping from HRV, heartRate, and respRate shortcuts

Data not matching Apple Health exactly?

  • HRV may differ slightly. Apple shows specific readings, we average all samples.
  • Steps/exercise should match exactly with correct shortcut configuration.

"No data synced today" error?

  • This is expected. Your shortcuts sync yesterday's data. Use get_recovery_status which includes recent_days.

Security

API_KEY protects ingest, MCP_SECRET protects the MCP endpoint. Basic protection. If you leak a key, rotate it in Vercel and update your shortcuts.

Your Data

Everything lives in your Upstash Redis. Nothing shared. Keys are health:YYYY-MM-DD.

Inspiration

Inspired by whoop-mcp-server by Yuri Divonis. Similar idea, different data source. This one uses Apple Watch data via iOS Shortcuts instead of WHOOP's API. No subscription required.

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选