Skip to main content
Glama
Garmin Stats MCP Server

Garmin Stats MCP Server

by jwiderberg
README.md
# Garmin Stats for Claude and Codex

Ask Claude or Codex about your own Garmin data, all of it: sleep, HRV, heart
rate, stress, Body Battery, SpO2, respiration, steps, workouts (with laps, HR zones
and the original FIT files), training status and load, Training Readiness,
VO2max, race predictions, personal records, weight, blood pressure, hydration
and cycle tracking.

I wanted to ask *"am I recovered enough for a hard session?"* and get an answer
grounded in my own numbers, not a generic one. It's my data, so I want all of
it. Garmin's official Personal API leaves out training status, Training
Readiness, blood pressure and race predictions, so this takes the same route
the Garmin Connect app does. It copies everything to your Mac every hour and
lets Claude or Codex query that copy.

Works in the Claude desktop app (Cowork), Claude Code and the Codex CLI. They
all use the same skill and the same data. macOS only.

## Install

1. Open **Terminal** (⌘ Space, type *Terminal*, Return).
2. Paste this and press Return:

   ```
   curl -fsSL https://raw.githubusercontent.com/jwiderberg/garminkollen/main/install.sh | bash
   ```

3. Sign in to Garmin in the window that pops up. If Garmin emails you a code,
   enter that too.
4. Pick how much history you want, from 30 days to 5 years. You'll see each
   day arrive as it's saved.
5. Add it to the app you use. You can use more than one.

**Claude Code and Codex.** If you have either, the installer adds the plugin for
you. Start a new session and it's there.

**The Claude app.** It needs one manual step:

1. A Finder window opens with **Garmin-Stats.zip**. In Claude: **Settings →
   Plugins**, scroll down to **Browse plugins**, then **Add** (top right) →
   **Upload plugin**. Drag the zip in and click **Upload**.
2. Claude warns that *"This plugin includes local MCP servers"*. That's
   expected: the server is the helper you just installed, reading the data on
   your Mac. Click **Continue**.

Then ask *"How did I sleep last night?"*

The import is deliberately slow, about half a minute per day (30 days takes
roughly 15 minutes, 90 days about 40), because it fetches everything and
hammering Garmin gets you blocked. You can close Terminal at any point;
whatever's left carries on in the background.

Pick a year or more and you get the last 30 days straight away. The hourly sync
fetches the rest, newest first, 14 days at a time. Five years takes five or six
days with your Mac awake and roughly 0.5 GB of disk. See [Years of
history](#years-of-history) for what Garmin still has.

You don't need Python or developer tools: the installer explains each step and
sets up everything itself.

## What you can ask

- *How did I sleep this week compared with last?*
- *Is my HRV trending down?*
- *Summarise my running since September.*
- *What does Garmin say my training status is, and is my load ramping too fast?*
- *Plot my weight and resting heart rate since January.*
- *How does this autumn compare with the last three?*
- *Get five years of my Garmin history.*

## How it works

- **Sync.** A background job on your Mac pulls the latest from Garmin Connect
  every hour. Requests are spaced at least a second apart, with some random
  jitter. If Garmin still says slow down, it backs off and tries again later
  rather than pushing.
- **Cache.** Everything lands in one SQLite file in `~/.garmin-stats-skills/`.
  Claude and Codex read that file, so answers are instant and don't touch Garmin.
- **Skill.** The plugin adds six tools (status, SQL query, raw payload,
  sync now, keep more history, sign in). None of them can change anything in
  Garmin. It also adds a skill that explains the data, including
  the parts that are easy to get wrong: a missing day is a gap, not a zero, and
  last night's sleep is filed under today.

## Years of history

Ask Claude or Codex *"get five years of my Garmin history"*, or run:

```
~/.local/bin/garmin-stats history 5y    # or 90d, 2y...
~/.local/bin/garmin-stats history       # how far it's got
```

Interruptions are fine. If your Mac sleeps or loses its connection, the next
sync carries on from there. Keeping less history deletes the older days from
your Mac, so the plugin's tools can't do that, and the command makes you add
`--delete-older`.

Garmin doesn't keep everything for ever. On my account, daily totals, sleep, HRV
and workouts go back years (as far as the watch recorded them), but
minute-by-minute heart rate and stress were missing on most of the days I
checked that were over three months old. Once a detail is in your cache it
stays there for as long as you keep that day, so start early.

Five years of data doesn't get loaded into the chat. Claude or Codex writes a query, SQLite does the
sums on your Mac, and only the result comes back: 60 monthly averages, say, not
1,826 days. Results are capped, and the reply says when one has been cut short.

## Your data

- Your password goes to Garmin once and is never stored. Only Garmin's sign-in
  token is kept on your Mac, readable by you alone.
- The cache stays on your Mac, and nothing is ever written back to Garmin. When
  you ask a question, your question and the query results go to Anthropic
  (Claude) or OpenAI (Codex), like anything else in the chat.
- When the hourly sync is switched on, macOS shows *"garmin-stats can run in
  the background"*. That's expected. You can turn it off under System
  Settings → General → Login Items & Extensions.
- If Garmin signs you out, you get a notification. Tell Claude or Codex *"reconnect my
  Garmin"* and the sign-in window comes back.

This uses the same unofficial sign-in as the Garmin Connect app, via
[python-garminconnect](https://github.com/cyberjunky/python-garminconnect).
Garmin can change that whenever it likes. Use it for your own account.

## Settings

`~/.garmin-stats-skills/config.toml` (in Finder: ⌘⇧G, paste the path):

| Setting | Default | |
|---|---|---|
| `history_days` | your choice at install | how much history to keep, up to 1826 (5 years); **lowering it deletes older days from your Mac** |
| `backfill_per_run` | `14` | older days fetched per sync; higher is faster, but more likely to get you blocked |
| `refresh_days` | `3` | recent days fetched again on every sync, because Garmin revises them |
| `detail` | `full` | `full` = everything Garmin keeps; `core` = sleep, HRV, daily totals, training (about 3× faster) |
| `download_fit` | `true` | save each workout's original recording in `activities/` |
| `request_delay_seconds` | `1.0` | minimum gap between Garmin requests (don't go lower) |
| `sync_interval_minutes` | `60` | how often to sync (then run `garmin-stats schedule`) |
| `store_raw` | `true` | keep Garmin's full detail: minute-level sleep, HR samples, splits |
| `db_path` | `~/.garmin-stats-skills/garmin.db` | where the cache lives |

## Update, uninstall

To **update**, run the install line again. That updates Claude Code and Codex
too; start a new session afterwards. For the Claude app, upload the new zip. If
you'd rather have its plugin updates arrive on their own, add it as a
marketplace instead: **Settings → Plugins → Browse plugins → Add → Add marketplace**, and
paste `https://github.com/jwiderberg/garminkollen`.

To **uninstall**, run this. If you added the plugin to the Claude app, remove it
there too:

```
curl -fsSL https://raw.githubusercontent.com/jwiderberg/garminkollen/main/uninstall.sh | bash
```

## Under the hood

A local stdio MCP server (`garmin-stats mcp`), a launchd agent running
`garmin-stats sync`, and a skill in `skills/garmin-stats`. Claude's manifest is
in `.claude-plugin`, Codex's is in `.codex-plugin`, and both use the same skill
and `.mcp.json`. To add it to Codex by hand, once the helper is installed:

```
codex plugin marketplace add jwiderberg/garminkollen
codex plugin add garmin-stats-skills@garmin-stats-skills
```

The command line is there if you want it:

```
garmin-stats status | history [5y] | sync [--days N] | login | schedule [--off] | plugin-zip | logout
```

```bash
uv sync --extra dev && uv run pytest    # tests
./install.sh --no-setup                 # install this checkout
```

Releases attach `Garmin-Stats.zip`.

## Licence and credits

MIT. See [LICENSE](LICENSE). Not affiliated with or endorsed by Garmin.

Built on other people's good work:

- [python-garminconnect](https://github.com/cyberjunky/python-garminconnect)
  by Ron Klinkien and contributors (MIT): all the hard work of talking to
  Garmin Connect
- [curl_cffi](https://github.com/lexiforest/curl_cffi) (MIT), which
  garminconnect uses to sign in
- [MCP Python SDK](https://github.com/modelcontextprotocol/python-sdk) (MIT):
  the server Claude and Codex talk to
- [uv](https://github.com/astral-sh/uv) by Astral (MIT/Apache-2.0): installs
  the helper and its Python

The full dependency list, with licences, is in
[THIRD_PARTY_NOTICES.md](THIRD_PARTY_NOTICES.md).