apple-health-coverage-mcp
Enables coverage-aware Apple Health metrics, distinguishing observed values from placeholders and providing day-level coverage and trend tools.
README
Apple Health Coverage MCP
A local, read-only MCP semantic layer that prevents Apple Watch non-wear, discharged-device gaps, delayed sync, and exporter placeholder zeros from silently corrupting health trends.
Missing observations are unknown, not zero. A zero is valid only when the metric was actually observable.
This project does not diagnose health conditions and does not claim to know whether a missing Watch interval was caused by non-wear, a depleted battery, or another device problem.
Problem
Many Apple Health pipelines produce daily rows even when the Watch was not collecting data. Empty fields or generated zeroes can then make activity, recovery, sleep, and custom health axes look worse than they were.
Apple Health Coverage MCP separates two questions:
- What value was observed?
- Was that metric observable well enough to interpret the value?
It classifies coverage before calculating a trend and refuses to interpret periods below a configurable coverage threshold.
Current scope
The current release consumes a normalized daily JSON file. It includes a deterministic synthetic fixture and no personal health data.
Implemented:
- Full, partial, unavailable, pending-sync, and unknown coverage states
- Independent Watch-availability evidence
- Distinction between observed zero and placeholder zero
- Metric-specific Watch dependence
- Phone-backed metrics such as steps
- Coverage-aware trend thresholds
- Late-arriving/backfilled daily upserts
- MCP
structuredContentplus text fallback - Read-only/idempotent/closed-world MCP annotations
Planned adapters:
- MetricBridge /
health-export-mcp - Apple Health
export.xml - HealthKite-style live iPhone bridge
- Versioned custom health-axis definitions
Coverage states
| State | Meaning | Trend behavior |
|---|---|---|
observed |
At least 18 hours of skin-contact evidence | Eligible |
partial_coverage |
Some Watch evidence, but not a full day | Eligible only when metric rules permit |
likely_watch_unavailable |
Phone activity exists but Watch skin-contact evidence does not | Watch-required values excluded |
sync_pending |
Recent samples may still arrive | Temporarily excluded |
unknown |
Neither Watch nor phone provides enough evidence | Excluded |
likely_watch_unavailable deliberately returns multiple possible reasons and claimedCause: null.
Metric semantics
Every metric declares its own rules:
{
"exercise_minutes": {
"unit": "min",
"measurementMode": "cumulative_event",
"zeroSemantics": "valid_if_observable",
"wearDependence": "wearable_required"
},
"step_count": {
"unit": "count",
"measurementMode": "cumulative_event",
"zeroSemantics": "valid_if_observable",
"wearDependence": "wearable_preferred"
}
}
An exporter-provided exercise_minutes: 0 is excluded when Watch coverage is unavailable. A real zero from an observed day remains in the average. Phone-backed step_count can remain usable when the Watch is absent.
MCP tools
health_coverage_day— explain one day's observation coveragehealth_coverage_range— inspect coverage across dateshealth_metric_catalog— discover metric-specific observability ruleshealth_metric_trend— calculate only coverage-supported trendshealth_data_quality— summarize coverage before interpretation
All tools are local, read-only, idempotent, and closed-world.
Run the synthetic demo
Requires Node.js 22 or newer.
npm test
npm run check
npm run demo
The demo queries health_data_quality through the real JSON-RPC stdio server using examples/synthetic-health.json.
MCP client configuration
Use an absolute path:
{
"mcpServers": {
"apple-health-coverage": {
"command": "node",
"args": [
"/absolute/path/apple-health-coverage-mcp/src/server.js",
"--data",
"/absolute/path/apple-health-coverage-mcp/examples/synthetic-health.json"
]
}
}
}
For personal data, replace the synthetic fixture with a normalized adapter output stored outside the Git repository.
Normalized input
{
"schemaVersion": "wear-health/v1",
"metricDefinitions": {},
"days": [
{
"date": "2026-08-18",
"ingestedAt": "2026-08-19T08:00:00Z",
"coverageSignals": {
"skinContactHours": 0,
"heartRateSamples": 0,
"phoneActivityPresent": true,
"watchSeenOnAdjacentDays": true,
"syncState": "complete"
},
"metrics": {
"exercise_minutes": 0,
"step_count": 3200
}
}
]
}
That example classifies the Watch as likely unavailable. The exercise zero is excluded as a likely placeholder, while phone-backed steps remain usable.
Backfill model
HealthKit records may arrive or change after a previous analysis. upsertDays:
- Uses date as the daily identity
- Keeps the newer ingestion
- Merges newly available metrics
- Marks the record
backfilled - Preserves the previous coverage classification
Derived trends and future health axes should always be recomputed after an upsert.
Privacy
- The server opens no network connection.
- MCP tool output still goes to whichever AI model your client uses.
- Personal exports, databases, ZIP files, and generated CSVs are gitignored.
- Never commit Apple Health exports or real derived datasets.
- Prefer aggregate queries or a local model for sensitive data.
Development
The implementation uses Node's standard library and native test runner.
npm test
npm run check
Tests use synthetic records and cover observed zeroes, placeholder zeroes, partial wear, Watch unavailability, pending sync, unknown days, low-coverage trend refusal, phone fallback, and backfill.
License
MIT
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。