{
  "markdown": "<!-- delx-wellness header v2 -->\n<h1 align=\"center\">Wellness CGM MCP</h1>\n\n<h3 align=\"center\">\n  Local-first continuous glucose monitor MCP for AI agents.<br>\n  Dexcom Developer API. <strong>Levels-killer pattern, agent-first, $0.</strong>\n</h3>\n\n<p align=\"center\">\n  <a href=\"https://www.npmjs.com/package/wellness-cgm-mcp\"><img src=\"https://img.shields.io/npm/v/wellness-cgm-mcp?style=for-the-badge&labelColor=0F172A&color=10B981&logo=npm&logoColor=white\" alt=\"npm version\" /></a>\n  <a href=\"https://www.npmjs.com/package/wellness-cgm-mcp\"><img src=\"https://img.shields.io/npm/dm/wellness-cgm-mcp?style=for-the-badge&labelColor=0F172A&color=0EA5A3&logo=npm&logoColor=white\" alt=\"npm downloads\" /></a>\n  <a href=\"LICENSE\"><img src=\"https://img.shields.io/badge/LICENSE-MIT-22C55E?style=for-the-badge&labelColor=0F172A\" alt=\"License MIT\" /></a>\n  <a href=\"https://wellness.delx.ai/connectors/cgm\"><img src=\"https://img.shields.io/badge/SITE-wellness.delx.ai-0EA5A3?style=for-the-badge&labelColor=0F172A\" alt=\"Site\" /></a>\n</p>\n\n<p align=\"center\">\n  <a href=\"https://github.com/davidmosiah/wellness-cgm-mcp/stargazers\"><img src=\"https://img.shields.io/github/stars/davidmosiah/wellness-cgm-mcp?style=for-the-badge&labelColor=0F172A&color=FBBF24&logo=github\" alt=\"GitHub stars\" /></a>\n  <a href=\"https://modelcontextprotocol.io\"><img src=\"https://img.shields.io/badge/BUILT_FOR-MCP-7C3AED?style=for-the-badge&labelColor=0F172A\" alt=\"Built for MCP\" /></a>\n  <a href=\"https://github.com/davidmosiah/delx-wellness-hermes\"><img src=\"https://img.shields.io/badge/HERMES-one--command_setup-10B981?style=for-the-badge&labelColor=0F172A\" alt=\"Hermes\" /></a>\n  <a href=\"https://github.com/davidmosiah/delx-wellness-openclaw\"><img src=\"https://img.shields.io/badge/OPENCLAW-one--command_setup-FB923C?style=for-the-badge&labelColor=0F172A\" alt=\"OpenClaw\" /></a>\n</p>\n\n<p align=\"center\">\n  <strong>🩸 Why this exists:</strong> Levels charges $199/mo to do exactly this — read your CGM, correlate with meals, flag spikes. <code>wellness-cgm-mcp</code> is the same game as a free local-first MCP. Stelo OTC + Dexcom developer API + your agent + <code>wellness-nourish</code> = the full metabolic loop.\n</p>\n\n> ⚡ **One-command install** — pick your runtime:\n> - [Delx Wellness for Hermes](https://github.com/davidmosiah/delx-wellness-hermes): `npx -y delx-wellness-hermes setup`\n> - [Delx Wellness for OpenClaw](https://github.com/davidmosiah/delx-wellness-openclaw): `npx -y delx-wellness-openclaw setup`\n\n---\n\n## HTTP (v2 stateless)\n\nDefault is **stdio**. Optional Streamable HTTP — no session id, JSON responses, loopback only:\n\n```bash\nnpx -y wellness-cgm-mcp --http\n# GET  http://127.0.0.1:3000/health\n# POST http://127.0.0.1:3000/mcp   (sessionless)\n```\n\nEnv: `WELLNESS_CGM_HOST`, `WELLNESS_CGM_PORT`, `WELLNESS_CGM_TRANSPORT=http`.\n\n<!-- /delx-wellness header v2 -->\n\n## Overview\n\nLocal MCP server that exposes CGM data (and synthetic mock data when nothing is configured) to any MCP-aware agent. Two real backends are supported: **Dexcom** (Developer API, sandbox + production) and **FreeStyle Libre** (the OTC sensor — Libre 2 / Libre 3) via **LibreLink Up**. Pick the backend with `CGM_PROVIDER`; it auto-detects Libre when only Libre credentials are set. Both feed the same ADA time-in-range / GMI / hypo / meal-response engine.\n\n## Try It In 60 Seconds (mock mode, zero setup)\n\n```bash\nnpx -y wellness-cgm-mcp doctor       # see env / mode\nnpx -y wellness-cgm-mcp status\n\n# In Claude Desktop / Cursor / etc., add:\n# {\n#   \"mcpServers\": {\n#     \"wellness-cgm\": {\n#       \"command\": \"npx\",\n#       \"args\": [\"-y\", \"wellness-cgm-mcp\"]\n#     }\n#   }\n# }\n```\n\nThe agent now has 10 CGM tools. Without a Dexcom token, every tool returns synthetic readings tagged `mock: true` — perfect for prototyping.\n\n## Live setup (Dexcom Developer)\n\n```bash\n# 1. Sign up at https://developer.dexcom.com (sandbox is free)\n# 2. Create an app, register your redirect URI\nexport DEXCOM_ENV=sandbox\nexport DEXCOM_CLIENT_ID=...\nexport DEXCOM_CLIENT_SECRET=...\nexport DEXCOM_REDIRECT_URI=https://your.callback/redirect\n\n# 3. Get the OAuth URL, open it, grant access, copy the code from the redirect\nnpx -y wellness-cgm-mcp authorize\n\n# 4. Swap code for tokens\nnpx -y wellness-cgm-mcp exchange <auth_code_from_redirect>\n\n# 5. Set DEXCOM_ACCESS_TOKEN to the access_token, restart the MCP — flips from mock to live.\n```\n\n## Live setup (FreeStyle Libre — the OTC sensor)\n\nNo developer program, no app to build — just the **same email/password you use in the LibreLinkUp follower app** (the OTC Libre 2 / Libre 3 sensor works). In the LibreLink app, share your readings; in the LibreLinkUp app, accept the invite. Then:\n\n```bash\nexport CGM_PROVIDER=libre               # or just set the creds below and let it auto-detect\nexport LIBRELINKUP_EMAIL=you@example.com\nexport LIBRELINKUP_PASSWORD=...\n# Optional: region shard if you're not on EU/global, and a pinned sensor:\nexport LIBRELINKUP_REGION=us            # eu (default) | us | de | fr | au | jp ...\n# export LIBRELINKUP_PATIENT_ID=<id>    # only if you follow more than one sensor\n\n# Verify credentials + list the sensor(s) you follow (never prints the token):\nnpx -y wellness-cgm-mcp libre-login\n```\n\nOnce logged in, every glucose tool (`cgm_glucose_now`, `cgm_daily_summary`, `cgm_time_in_range`, `cgm_meal_response`, `cgm_hypo_events`, …) reads from Libre and returns the same ADA TIR / GMI / hypo / meal-response metrics — each response carries a `provider` field so you always know the source. Without any credentials, everything returns synthetic `mock: true` data.\n\n### Libre history limit: ~12h per read\n\nLibreLink Up's graph endpoint takes **no start/end parameter** — it always answers with its own fixed trailing window of roughly **12 hours**. Asking for 24h or 72h does not widen it, so on Libre those extra hours simply do not exist.\n\nEvery windowed payload therefore reports what it actually covered:\n\n```jsonc\n// cgm_daily_summary({ hours: 72 }) on live Libre\n{\n  \"window_hours\": 72,          // what you asked for\n  \"hours_covered\": 12,         // what the numbers below are ACTUALLY computed over\n  \"observed_window\": { \"start\": \"…\", \"end\": \"…\", \"hours\": 12 },\n  \"window_truncated_by_provider\": true,\n  \"notes\": [\"LibreLink Up returns ~12h of graph data per read and ignores wider spans; requested 72h, covered 12h. …\"]\n}\n```\n\nRead `hours_covered`, never the requested `hours` / `window_hours`. A GMI (estimated A1C), CV or time-in-range built on 12h is not a 3-day result. **For multi-day metrics use Dexcom**, whose v3 API takes an explicit start/end and honours the request. Mock mode synthesises the full requested span, so it is never truncated.\n\nThe same applies to `cgm_hypo_events`, which takes an explicit `from`/`to`: \"no hypoglycemia events\" is only a claim about `hours_covered`. A 3-day question answered from a live Libre read is a 12-hour answer, and the payload says so in `hours_covered`, `observed_window.hours`, `window_truncated_by_provider` and `notes`. (`events_per_day` is safe either way — its denominator is the observed span, not the requested one — but the frame around it is not.)\n\n#### `window_truncated_by_provider` is structural, not empirical\n\nIt answers *\"can this provider cover a span this wide?\"* — never *\"did this particular read come back short?\"*. A sensor applied two hours ago answers `cgm_daily_summary({ hours: 12 })` with `hours_covered: 2`, `window_truncated_by_provider: false` and an empty `notes`, because nothing is broken and warning there would be a false alarm. That is deliberate:\n\n> **An empty `notes` means \"no known provider ceiling was hit\", not \"the window was fully covered\".** `hours_covered` is the only number that states the real span — compare it against `hours_requested` before reporting any window.\n\n## Tools (19)\n\n| Tool | Purpose |\n|---|---|\n| `cgm_agent_manifest` | Runtime contract |\n| `cgm_capabilities` | Providers, metrics, privacy modes |\n| `cgm_connection_status` | env, credentials, mode (live vs mock) |\n| `cgm_privacy_audit` | Local storage + outbound destinations |\n| `cgm_data_inventory` | Metric catalog + TIR ranges + GMI formula |\n| **`cgm_glucose_now`** | **Most recent EGV + trend** |\n| `cgm_glucose_window` | All EGVs over last N hours (+ `hours_covered` — see the Libre ~12h limit) |\n| **`cgm_daily_summary`** | **Mean / GMI / CV / 2 TIR profiles — over `hours_covered`, not the requested window** |\n| **`cgm_meal_response`** | **Baseline → peak → return + band** |\n| `cgm_authorize_url` | Dexcom OAuth URL builder |\n| **`cgm_hypo_events`** | **Hypo event detection (ADA Level 1 < 70, Level 2 < 54) — \"no events\" applies to `hours_covered` only** |\n| **`cgm_libre_status`** | **FreeStyle Libre (LibreLink Up) config + region + mode — v0.4** |\n| **`cgm_libre_login`** | **Log in to LibreLink Up + list followed sensors — v0.4** |\n\n> The table omits the shared profile/onboarding/quickstart/demo helpers (`cgm_profile_get`, `cgm_profile_update`, `cgm_onboarding`, `cgm_quickstart`, `cgm_demo`) for brevity — call `cgm_agent_manifest` for the full, always-current list.\n\n## Two Time-In-Range profiles in every summary\n\n- **Diabetic** (70-180 mg/dL) — ADA standard for adults with diabetes.\n- **Metabolic health** (70-140 mg/dL) — Levels-style for non-DM users.\n\nAgents surface BOTH so the user picks the one that fits their context.\n\n## Meal response bands\n\n| Peak Δ from baseline | Band |\n|---|---|\n| < 30 mg/dL | excellent |\n| 30-49 | good |\n| 50-79 | moderate |\n| ≥ 80 | poor |\n\nCombine with `wellness-nourish` to compute \"what did I eat → what happened\" automatically.\n\n## The killer combo\n\n```\nwellness-nourish: meal at 13:15 (rice + chicken)\n       ↓\nwellness-cgm-mcp.cgm_meal_response(meal_time)\n       ↓\n{ peak: 167, peak_delta: 72, band: \"moderate\", peak_time_minutes: 45 }\n       ↓\nwhoop-mcp.recovery: 67%\n       ↓\nAgent: \"That meal hit a moderate spike (peak +72 mg/dL at 45 min)\n        AND recovery is borderline. Try protein-first next time, or\n        swap white rice for lentils — should drop the peak ~30 mg/dL.\"\n```\n\nLevels charges $199/mo for this. Here it is, free, local-first, MCP.\n\n## Privacy\n\n- ✅ **Credentials local only** — `DEXCOM_ACCESS_TOKEN` / `LIBRELINKUP_*` stay in env vars; the LibreLink Up auth token is never returned in tool output.\n- ✅ **Mock mode by default** — every tool returns synthetic data with `mock: true` until a provider is configured.\n- ✅ **No third-party telemetry** — outbound calls go only to your CGM provider (Dexcom or, for Libre, Abbott's LibreLink Up API).\n\nRun `wellness-cgm-mcp doctor` to inspect.\n\n## Roadmap\n\n- ✅ **v0.4** — FreeStyle Libre via LibreLink Up (the OTC sensor). _Shipped._\n- **next** — Refresh-token rotation. Per-meal historical browser (which foods spike YOU?). Threshold alerts (agent notified when glucose holds > X mg/dL for Y minutes). Cross-meal automation with wellness-nourish.\n\n## What this is NOT\n\n- Not medical advice or diagnosis.\n- Not for insulin/medication dosing decisions — defer to clinician.\n- Not affiliated with Dexcom or Abbott.\n\n## 📧 Contact & Support\n\n- 📨 **support@delx.ai** — general questions, integration help, partnerships\n- 🐛 **Bug reports / feature requests** — [GitHub Issues](https://github.com/davidmosiah/wellness-cgm-mcp/issues)\n- 🐦 **Updates** — [@delx369](https://x.com/delx369) on X\n- 🌐 **Site** — [wellness.delx.ai](https://wellness.delx.ai)\n\n\n## License\n\nMIT — see [LICENSE](LICENSE).\n\n<sub>wellness-cgm-mcp is independent open-source software. Dexcom and FreeStyle Libre are trademarks of their respective owners. Neither company is affiliated with or endorses this project.</sub>\n\n## Skill or MCP\n\nSame package, two doors. MCP registers tools on stdio/HTTP. The [skill](skill/SKILL.md) can drive the **same** tools through the CLI when the client has no MCP:\n\n```bash\nnpx -y wellness-cgm call cgm_connection_status --json '{}'\n```\n\nCopy `skill/SKILL.md` into your agent skills dir.\n",
  "bytes": 11927,
  "sha": "e61d026feb2ffa95c13079bb771180216ea94fba562a304f6e89efd60fe07d18",
  "repo_slug": "davidmosiah/wellness-cgm-mcp",
  "fonte": "repo",
  "truncated": false,
  "api": "https://agentalog.com/api/listings/mcp_io_github_davidmosiah_wellness_cgm_mcp_44d93538/readme"
}