Local MCP server exposing Apple Health data (from the HealthMirror iOS app) to AI tools on your Mac
HealthMirror MCP demonstrates solid tool design with clear naming (verb_noun pattern), comprehensive parameter descriptions, and well-documented return structures. All 5 tools follow consistent patterns with explicit date range validation and historical data safeguards. However, schemas lack formal enum constraints for constrained inputs (e.g., metric names, aggregation types, bucket values are documented in text but not as JSON Schema enums), and output schemas are described in docstrings rather than formally declared. Error handling returns error dicts but lacks recovery guidance. Tool descriptions average ~250 chars (within baseline 194 p50), and all parameters have descriptions. No tool annotations (readOnlyHint) despite all being read-only operations.
Compute one-shot health summary: recovery / cycle / today activity / last night sleep. Used by both local dashboards and AI conversations. Args: date: "YYYY-MM-DD" allow_historical: must be True to query data older than 30 days. tz: IANA timezone name (e.g. "Asia/Shanghai", "America/New_York", "Asia/Tokyo"). None → use the Mac's current local timezone. Pass explicitly when querying a past date for a day spent in a different timezone: e.g. querying "2026-05-18" from New York for a day spent in Shanghai must use tz="Asia/Shanghai", otherwise the day window is offset.
Query a quantity health metric with aggregation. Args: metric: One of 'heart_rate', 'hrv_sdnn', 'resting_heart_rate', 'active_energy', 'steps', 'weight'. start_date: "YYYY-MM-DD" inclusive end_date: "YYYY-MM-DD" inclusive aggregation: 'sum' | 'mean' | 'min' | 'max' | 'count' | 'latest'. bucket: 'none' | 'day'. allow_historical: bypass 30-day default range limit. Returns dict with aggregation, unit, by_source, all_sources, coverage.
Query sleep data from the local HealthMirror JSONL files. Args: start_date: "YYYY-MM-DD" (inclusive) end_date: "YYYY-MM-DD" (inclusive) include_raw: include raw HealthKit stage samples in response (default False). Set True only when you need per-stage debugging; raw samples can be hundreds per night. allow_historical: by default queries are limited to the last 30 days to prevent accidentally pulling large history into the AI context. Pass True for older data. Returns: JSON object with: - episodes: list of {kind: "main"|"nap", sleepDay (only main), bedtime_utc, wakeTime_utc, inBed_min, asleep_min, stages: per-stage minutes, sample_count} - coverage: {samples_total, samples_deleted_via_tombstone, samples_used} - raw_samples (optional): list of HealthSampleRecord
Constrained parameters lack JSON Schema enums. 'metric' accepts only 6 values, 'aggregation' accepts 6 values, 'bucket' accepts 2 values, all documented in text but not as formal enum constraints. LLMs cannot parse text constraints reliably.
Output schemas documented only in docstrings, not formally declared. Callers cannot introspect return structure from schema. E.g., get_sleep returns {episodes, coverage, raw_samples?} but this is prose, not JSON Schema.
Error responses return {'error': str(e)} without recovery guidance. E.g., DateRangeError should suggest 'Pass allow_historical=True to query data older than 30 days' rather than bare error text.
Inferred effective spec: <=2025-11-25.
| Scored | Grade | Overall | Spec posture | Rubric |
|---|---|---|---|---|
| 2026-09-23 | D | 59 | <=2025-11-25 | v2 |
Query workout records (with multi-source dedup). Args: start_date: "YYYY-MM-DD" inclusive end_date: "YYYY-MM-DD" inclusive workout_type: optional filter (e.g. 'running', 'yoga') allow_historical: bypass 30-day default range limit.
Return server liveness status. Use to verify the MCP connection.
No tool annotations despite all tools being read-only. FastMCP supports readOnlyHint via @mcp.tool(annotations={...}). This metadata helps agents reason about side effects.
Date range validation logic is server-side only. No min/max constraints in parameter schemas. LLMs cannot see that start_date must be ≤ end_date or that historical queries require explicit opt-in.