Skip to main content

Model Context Protocol server exposing the full Oura Ring v2 API

Project description

oura-mcp

A Model Context Protocol server that exposes the full Oura Ring v2 API to LLM agents — including period-level sleep data, time-series HR/HRV, hypnogram rendering, SpO2, and derived analytics tools.

Why this exists

Existing community Oura MCP servers return only daily contributor scores — opaque 0–100 numbers from Oura's algorithm (deep_sleep: 11, efficiency: 88). They omit the underlying period data: actual minutes of deep/REM/light sleep, sleep stage timeline, restless periods, breathing rate, SpO2, time-series heart rate and HRV.

For any non-trivial analysis — correlation studies, intervention tracking, hypnogram visualisation, percentile comparisons — the contributor scores are useless. oura-mcp fixes that gap.

Feature Existing MCPs oura-mcp
Daily sleep score
Actual deep/REM/light minutes
Hypnogram (sleep stage timeline)
Time-series HRV / heart rate
SpO2, breathing rate, restless periods
Date-range queries partial ✓ all tools
Percentile & trend analytics
Local cache (reproducible analyses)
Compact mode (token-efficient)

Token safety

Your Oura PAT grants full read access to your biometric history. Treat it like an API key.

If a token is accidentally committed: revoke it immediately at cloud.ouraring.com, then use git filter-repo to purge it from history (a simple delete-and-recommit leaves it in the log forever). See SECURITY.md.


Quickstart

1. Install

pip install oura-ring-mcp

Or for a developer install from source:

git clone https://github.com/jhamblin/oura-mcp.git
cd oura-mcp
pip install -e .

2. Set your PAT

# Option A — environment variable (recommended for Claude Desktop)
export OURA_PAT="your-token-here"

# Option B — config file
mkdir -p ~/.oura-mcp
echo '{"pat": "your-token-here"}' > ~/.oura-mcp/config.json

3. Register with Claude Desktop

Add to ~/Library/Application Support/Claude/claude_desktop_config.json:

{
  "mcpServers": {
    "oura": {
      "command": "oura-ring-mcp",
      "env": {
        "OURA_PAT": "your-token-here"
      }
    }
  }
}

Restart Claude Desktop. Ask it to call oura_personal_info to verify connectivity.

4. (Optional) Enable local cache

export OURA_MCP_CACHE_DIR=~/.oura-mcp/raw

With the cache enabled, past dates are served from disk — analyses are reproducible and don't burn API calls on repeat queries.


Tool reference

Direct API tools

Tool Oura endpoint Notes
oura_personal_info /personal_info Profile (sex, age, height, weight). Connectivity check.
oura_sleep /sleep Primary tool. Period-level data: deep/REM/light minutes, hypnogram, HRV, HR, SpO2, restless periods. Overnight buffer applied automatically.
oura_daily_sleep /daily_sleep Daily sleep score + contributors.
oura_daily_readiness /daily_readiness Readiness score + contributors + temperature deviation.
oura_daily_activity /daily_activity Steps, calories, MET minutes, activity score.
oura_daily_spo2 /daily_spo2 Average SpO2 + breathing disturbance index. Gen 3 / data-dependent.
oura_daily_stress /daily_stress Stress/recovery duration breakdown. Gen 3+.
oura_daily_resilience /daily_resilience Resilience level + contributors. Gen 3+.
oura_daily_cardiovascular_age /daily_cardiovascular_age Estimated vascular age. Gen 3+.
oura_daily_sleep_time /sleep_time Recommended bedtime window + status.
oura_workouts /workout Workout sessions (manual + auto-detected).
oura_sessions /session Meditation / breathwork sessions.
oura_tags /enhanced_tag/tag User tags. Auto-selects enhanced_tag; falls back on 404.
oura_heart_rate /heartrate Time-series HR. Takes ISO datetimes. Compact by default.
oura_rest_mode_period /rest_mode_period Rest mode (sick / recovery) periods.
oura_ring_configuration /ring_configuration Hardware / firmware info.

Derived / analytics tools

Tool Inputs Returns
oura_render_hypnogram date ASCII sleep stage timeline: █=deep ░=light ▒=REM ·=awake (5 min/char)
oura_percentiles metric, date range, percentiles=[50,75,95] P50/P75/P95 (configurable) for any sleep session field
oura_rolling_average metric, date range, window=7 [{date, value, rolling_avg}] per day
oura_summary_table date range Compact per-night rows: {date, deep_min, rem_min, light_min, awake_min, efficiency, hrv, rhr, sleep_score, readiness_score, cache_status}
oura_cache_rebuild date range Force-refresh cache from API for a date range

Common parameters

All date-keyed tools accept:

  • date: single day YYYY-MM-DD (defaults to today)
  • start_date / end_date: inclusive range (each defaults to today)
  • pat: per-call PAT override (for multi-account use)

date and start_date/end_date are mutually exclusive.


Output modes

Most data-heavy tools support a format parameter:

compact (default)

Strips bulky time-series arrays and replaces them with summaries:

  • heart_rate.items (5-sec samples, 5000+/night) → heart_rate.summary = {min, max, avg, samples}
  • hrv.items (~100 values/night) → hrv.summary = {min, max, avg, samples}
  • sleep_phase_30_sec, movement_30_sec dropped
  • sleep_phase_5_min kept (small; used for hypnogram rendering)

Typical oura_sleep response in compact mode: ~2–3 KB per night.

full

Returns the unmodified Oura API response. Use when you need raw time-series for plotting or custom analysis. Caller is responsible for context budget.


Cache behaviour

Set OURA_MCP_CACHE_DIR to enable the local cache.

  • One JSON file per day: <cache_dir>/<YYYY-MM-DD>.json
  • Cache-first for past dates: if the file exists, the API is not called
  • Today always re-fetched: data is incomplete until ~6 hours after wake
  • cache_status field on every oura_summary_table row: "hit", "miss", or "disabled"
  • oura_cache_rebuild: force-refresh a date range (useful for historical backfills or after Oura revises scores retroactively)

Cache files match the structure of oura_fetch.py's raw/oura/ layout, so existing raw data from that script is compatible.


Implementation notes

Overnight sleep buffer

The Oura /sleep endpoint filters by bedtime_start, not by the logical day field. A sleep starting at 11:30 pm on Apr 12 has day = 2026-04-13 (the wake date). oura_sleep automatically expands the fetch range by ±1 day and filters results in memory by day, so overnight sleeps are never missed. This is regression-tested in tests/test_overnight_filter.py.

Pagination

Oura paginates /sleep, /heartrate, /workout, /session, and others via next_token. All tools that use these endpoints call get_all(), which follows next_token until exhausted.


Contributing

See CONTRIBUTING.md.

Security

See SECURITY.md.

License

MIT. See LICENSE.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

oura_ring_mcp-0.1.0.tar.gz (39.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

oura_ring_mcp-0.1.0-py3-none-any.whl (23.0 kB view details)

Uploaded Python 3

File details

Details for the file oura_ring_mcp-0.1.0.tar.gz.

File metadata

  • Download URL: oura_ring_mcp-0.1.0.tar.gz
  • Upload date:
  • Size: 39.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.8 {"installer":{"name":"uv","version":"0.11.8","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for oura_ring_mcp-0.1.0.tar.gz
Algorithm Hash digest
SHA256 ed9f64fef5dcf433b89a0024ee94aa8b4a1a9bfe221ea1f4d68ee961e686067f
MD5 57e6e717dd63364ae3f6dade4ef84d41
BLAKE2b-256 3e57288e96f7a9d20a39367c75eb6899765cf8f46fcf956ca9be011c2daf985c

See more details on using hashes here.

File details

Details for the file oura_ring_mcp-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: oura_ring_mcp-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 23.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.8 {"installer":{"name":"uv","version":"0.11.8","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for oura_ring_mcp-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 95b151b257f61be21261abb8bc8c25a2bd03692c3d5d6eb9d417222bfebced1c
MD5 0487a5ae544f195b19b826ed81412b25
BLAKE2b-256 d21865f0d4517ea135899cab62f8adc8d98cfe4e1ecea5db36f22fd597ac854a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page