r/ClaudeAI • • 8d ago

Built with Claude I built an open-source MCP server to query Apple Health, WHOOP & Oura locally in Claude Desktop (trimmed tool tokens in v0.8.2)

I built Quantified Self MCP, an open-source MCP server designed specifically for Claude Desktop and Claude Code that lets you query, correlate, and analyze your personal health data completely offline.

What it does

Health data is sensitive, so instead of uploading it to cloud aggregators, this project keeps everything on your local machine in an SQLite database. It connects Claude directly to your wearable data:

  • Supported Sources: Apple Health (XML/Shortcuts), WHOOP API JSON, Oura Ring API JSON, Android Health Connect, and generic CSVs.
  • Statistical Evidence Engine: Rather than letting the LLM hallucinate medical conclusions, it provides tools for Pearson correlation analysis, IQR anomaly detection, 7d/30d moving averages, and data completeness checks.
  • Provenance Tracking: Tracks which device logged which metric (e.g., Apple Watch vs. Oura Ring) to prevent multi-device data conflation.
  • Privacy Granularity: Configurable privacy masks (hide sensitive metrics, add noise, or restrict date windows).

How Claude and Claude Code helped build it

I used Claude Code extensively throughout development:

  • Architecting the MCP tool surface: Claude helped structure the schemas across all 20 analytical tools. In the latest v0.8.2 release, I used Claude Code to audit and trim verbose tool descriptions, saving significant context tokens so Claude Desktop stays responsive even when multiple MCP servers are active.
  • Statistical Engine & Safety Guardrails: Claude helped implement and test the core analytical logic (handling missing data windows, preventing causal claims on correlations, and enforcing metric bounds).
  • Test Suite: Claude Code helped write the comprehensive test suite, including deterministic prompt surface budget tests (tests/test_tool_surface_size.py) to prevent token bloat regressions.

It is 100% Free & Open-Source (How to try it)

The project is completely free, licensed under MIT, has no paid tiers, and requires no API keys or third-party accounts.

You can test it out in Claude Desktop in under 2 minutes using the built-in demo dataset (60 days of realistic synthetic data):

  1. Install with uv or pip:
uv tool install quantified-self-mcp
# or: pip install quantified-self-mcp
  1. Seed the demo database:
quantified-self-init-db --demo

(Or import your real data anytime via quantified-self-init-db export.xml*)*

  1. Add to your Claude Desktop config: Add this to your claude_desktop_config.json:
{
  "mcpServers": {
    "quantified-self": {
      "command": "uvx",
      "args": ["quantified-self-mcp"]
    }
  }
}

Restart Claude Desktop, and you can immediately ask things like:

  • "How did my sleep duration correlate with my HRV last month?"
  • "Detect any anomalies in my resting heart rate over the last 30 days."

GitHub repo: https://github.com/Thecimal/quantified-self-mcp

Feedback, questions, and PRs are very welcome!

0 Upvotes

4 comments sorted by

1

u/shimoheihei2 8d ago

The annoying part with Apple Health is that you need to manually export it as xml. It works a lot better from a native app that can integrate in the Health app directly.

1

u/thecimal 8d ago

You hit the nail on the head. Apple’s manual export.xml is easily the most frustrating part of the Apple Health ecosystem — it takes forever to generate, produces giant 1GB+ XML files, and nobody wants to manually export a zip file every week.

The reason desktop tools face this is that Apple intentionally sandboxes HealthKit strictly to iOS/watchOS with zero public cloud REST API (iCloud Health data is end-to-end encrypted with no web endpoints), so a Python desktop server can't directly read HealthKit without a native iOS intermediary.

That said, there are two ways to automate this right now so you don't have to touch manual exports:

  1. iOS Shortcuts Automation (Built-in & Free): You can set up an automated Apple Shortcut (e.g., triggered daily when connecting to power at night) that pulls the day's HealthKit samples (steps, sleep, HRV, resting HR, workouts) and saves a small JSON/CSV file directly to an iCloud Drive folder synced to your Mac/PC.
  2. Companion Auto-Export Apps: Apps like Health Auto Export run natively on iOS with HealthKit permissions and automatically sync daily exports to iCloud Drive or a local webhook in the background.

We just opened a GitHub issue to build a ready-made 1-click Apple Shortcut template and explore an open-source companion sync app so the entire sync is completely hands-off:
https://github.com/Thecimal/quantified-self-mcp/issues/78

Would you prefer an official downloadable Apple Shortcut recipe, or a lightweight open-source companion app? Would love your thoughts!