Skip to main content
Glama
kritsanan1

Garmin MCP Server

by kritsanan1
README.md
# ๐Ÿƒ Garmin MCP Server

**OpenClaw Platform ยท Port 8422**

FastMCP server for Garmin Connect โ€” live GPS tracking, health metrics, and activity data for AI agents.

---

## โšก Quick Start

```bash
# 1. Clone / enter project
cd garmin-mcp

# 2. Install dependencies
pip install -r requirements.txt

# 3. Configure credentials
cp .env.example .env
# Edit .env โ†’ set GARMIN_EMAIL and GARMIN_PASSWORD

# 4. Run server
python server.py
```

Server starts at: `http://localhost:8422`

**First run** logs into Garmin Connect and caches the session token at `~/.garmin_mcp_tokens`.
Subsequent runs reuse the cached token (no re-login needed).

---

## ๐Ÿ› ๏ธ Tools (12 total)

| # | Tool | Description |
|---|------|-------------|
| 1 | `garmin_get_daily_summary` | Steps, HR, stress, calories, sleep, distance |
| 2 | `garmin_get_heart_rate` | Resting/max HR + time-series timeline |
| 3 | `garmin_get_steps` | 15-min interval step breakdown |
| 4 | `garmin_get_sleep` | Deep/light/REM/awake stages + score |
| 5 | `garmin_get_stress` | Avg/max stress + ASCII chart |
| 6 | `garmin_get_body_battery` | Energy levels over 1โ€“7 day range |
| 7 | `garmin_list_activities` | Recent activities with IDs for drill-down |
| 8 | `garmin_get_activity_details` | Full activity stats + lap splits |
| 9 | `garmin_get_gps_track` | GPS coordinates from recorded activity |
| 10 | `garmin_get_livetrack` | **Real-time** position via LiveTrack polling |
| 11 | `garmin_get_hrv` | HRV last-night + weekly average |
| 12 | `garmin_get_training_readiness` | Today's readiness score + factors |

---

## ๐Ÿ“ก LiveTrack Real-time GPS

1. On your Garmin device โ†’ start activity โ†’ enable **LiveTrack**
2. Garmin sends a share URL to your contacts, e.g.:
   `https://livetrack.garmin.com/session/abc123.../token/xyz...`
3. Extract the **session token** (between `/session/` and `/token/`)
4. Call `garmin_get_livetrack` with that token โ€” positions update ~every 4 seconds

---

## ๐Ÿ”Œ OpenClaw Integration

Add to your OpenClaw config:

```yaml
skills:
  - name: garmin-health
    transport: streamable-http
    url: http://localhost:8422
```

Or connect via MCP protocol URL in Claude Desktop:
```
http://localhost:8422/sse
```

---

## ๐Ÿ” Auth Notes

- Uses the unofficial `garminconnect` Python library (no Garmin Developer Program approval needed)
- Tokens cached at `~/.garmin_mcp_tokens` โ€” delete this file to force re-login
- Garmin may prompt for 2FA on first login in some regions
- Rate limiting: avoid calling more than ~100 times/hour to prevent IP blocks

---

## ๐Ÿ“ Project Structure

```
garmin-mcp/
โ”œโ”€โ”€ server.py          # FastMCP server (12 tools)
โ”œโ”€โ”€ garmin_client.py   # Auth + session wrapper
โ”œโ”€โ”€ models.py          # Pydantic v2 input models
โ”œโ”€โ”€ utils.py           # Markdown/JSON formatters
โ”œโ”€โ”€ requirements.txt
โ”œโ”€โ”€ .env.example
โ””โ”€โ”€ README.md
```

---

## ๐ŸŒ Response Formats

All tools support `response_format`:
- `"markdown"` (default) โ€” human-readable tables, great for chat UIs
- `"json"` โ€” raw Garmin API data, great for downstream processing

---

*Built for the Dr. Arty+ Team ยท OpenClaw Platform ยท 2026*

Maintenance

ActivityStale
ResponsivenessNo issues