Sandbox
@etweisberg/garmin-connect-mcp

MCP server for Garmin Connect data

This package runs an MCP server that sits between your agent and Garmin Connect. It uses a headless Playwright browser and saved session cookies to work around Garmin’s browser-only authentication checks. Once set up, your agent can query activities, health stats, sleep, workouts, and related Garmin data.

42 stars11 forksTypeScriptUpdated 2mo ago
Who it's for

Builders who want Claude Code or another MCP client to read and manage Garmin Connect data.

What it delivers

You can ask your agent for Garmin health and activity data without logging into the site by hand every time.

What it does

Browser-based authentication

Uses Playwright to log in through a real browser session, capture cookies and a CSRF token, and save them to `~/.garmin-connect-mcp/session.json`.

Activity tools

Lists activities, fetches summaries, details, splits, HR zones, weather, polylines, and original FIT files.

Daily health tools

Returns daily summaries, heart rate, stress, movement, respiration, and intensity minutes.

Sleep and recovery tools

Provides sleep data, body battery, heart rate variability, training readiness, hydration, and sleep stats.

Workout tools

Lists workouts, reads workout details, creates workouts, schedules them, deletes them, and downloads workout FIT files.

MCP server transport

Exposes the Garmin Connect operations over MCP so Claude Code or another MCP client can call them as tools.

How to get it

  1. 1Run
    npm install -g @etweisberg/garmin-connect-mcp
    npx playwright install chromium
  2. 2Then register with Claude Code
    claude mcp add garmin -- npx @etweisberg/garmin-connect-mcp
  3. 3You also need the Playwright MCP server for the login flow
    claude mcp add playwright -- npx @playwright/mcp@latest

README

garmin-connect-mcp

CI Release npm npm downloads License: AGPL-3.0

MCP server for Garmin Connect. Access your activities, health stats, sleep data, FIT files, and more from Claude Code or any MCP client.

Why This Exists

In March 2026, Garmin changed their authentication API, breaking garth and python-garminconnect — the two most popular libraries for accessing Garmin data programmatically. Garth has been officially deprecated. Garmin added Cloudflare TLS fingerprinting that blocks all non-browser HTTP clients (Node.js fetch, Python requests, curl) from their API endpoints.

This project works around that by routing all API calls through a headless Playwright browser, inheriting a real Chrome TLS fingerprint. Authentication uses browser cookies captured from a manual login session.

Install

npm install -g @etweisberg/garmin-connect-mcp
npx playwright install chromium

Then register with Claude Code:

claude mcp add garmin -- npx @etweisberg/garmin-connect-mcp

You also need the Playwright MCP server for the login flow:

claude mcp add playwright -- npx @playwright/mcp@latest

Prerequisites

  • Node.js 18+
  • Playwright MCP server (for browser-based login)
  • A Garmin Connect account with a synced device

Setup

1. Login

In Claude Code, call the garmin-login tool. It will walk you through:

  1. Opening Garmin Connect in the Playwright browser
  2. Logging in manually
  3. Extracting cookies and CSRF token
  4. Saving the session to ~/.garmin-connect-mcp/session.json

2. Verify

Call the check-session tool to confirm authentication works.

Session cookies expire after a few hours. Re-run the login flow when they do.

Available Tools

Session & Auth

ToolDescription
garmin-loginReturns login instructions for the Playwright MCP browser
check-sessionValidates the saved session is still active
run-testsReturns a test plan to verify all tools work

Activities

ToolDescription
list-activitiesList activities with pagination
get-activityFull activity summary (distance, duration, HR, calories)
get-activity-detailsTime-series metrics (HR, cadence, elevation over time)
get-activity-splitsLap/split data
get-activity-hr-zonesHeart rate time-in-zone breakdown
get-activity-polylineFull-resolution GPS track
get-activity-weatherWeather conditions during activity
download-fitDownload original FIT file

Daily Health

ToolDescription
get-daily-summarySteps, calories, distance, intensity minutes
get-daily-heart-rateHeart rate data throughout the day
get-daily-stressStress levels throughout the day
get-daily-summary-chartCombined wellness chart data
get-daily-intensity-minutesIntensity minutes for a date
get-daily-movementMovement/activity data
get-daily-respirationRespiration rate data

Sleep / Body Battery / HRV

ToolDescription
get-sleepSleep score, duration, stages, SpO2
get-body-batteryBody battery charged/drained values
get-hrvHeart rate variability data

Training & Recovery

ToolDescription
get-training-readinessTraining readiness score (sleep, recovery, load)
get-sleep-statsSleep statistics over a date range
get-hydrationDaily hydration/water intake data

Weight / Records / Fitness

ToolDescription
get-weightWeight measurements over a date range
get-personal-recordsAll personal records with history
get-fitness-statsAggregated activity stats by type
get-vo2maxLatest VO2 Max estimate
get-hr-zones-configHeart rate zone boundaries
get-power-zonesPower zone config for all sports
get-user-profileUser profile and settings

Calendar, Goals & Badges

ToolDescription
get-calendarMonthly calendar with activities and events
get-goalsActive, future, or past fitness goals
get-badgesAll earned badges/achievements
get-badge-leaderboardBadge leaderboard among connections

Workouts

ToolDescription
list-workoutsList saved workouts
get-workoutGet workout details (steps, segments)
create-workoutCreate a new workout (warmup, intervals, cooldown)
schedule-workoutSchedule a workout to a date (syncs to device)
delete-workoutDelete a workout
download-workout-fitDownload a workout as a FIT file

Architecture

Claude Code / MCP Client
        |
        | MCP (stdio)
        v
garmin-connect-mcp server
        |
        | page.evaluate(fetch(...))
        v
Headless Playwright Chromium
        |
        | HTTPS (real Chrome TLS fingerprint)
        v
connect.garmin.com/gc-api/*

All API calls are made from within a headless Chromium browser context via page.evaluate(fetch(...)). This inherits the real Chrome TLS fingerprint, bypassing Cloudflare's detection of non-browser clients.

Auth flow: Cookies + CSRF token are captured from a manual browser login (via the Playwright MCP server) and stored at ~/.garmin-connect-mcp/session.json. The headless browser loads these cookies on startup.

Why not direct HTTP? Cloudflare blocks Node.js fetch, Python requests, and even curl with a 403. Only requests from a real browser TLS stack are accepted.

Development

git clone https://github.com/etweisberg/garmin-connect-mcp.git
cd garmin-connect-mcp
npm install
npx playwright install chromium
npm run build

Scripts

CommandDescription
npm run buildCompile TypeScript
npm run lintRun ESLint
npm run formatFormat with Prettier
npm run typecheckType check without emitting
npm testRun integration tests (requires valid session)

Local Integration Testing

The standalone test suite (npm test) requires a valid Garmin session and hits the real API. Run it locally after authenticating:

npm test

Contributing

  1. Create a feature branch off main
  2. Make your changes
  3. Run checks:
    npm run lint
    npm run format
    npm run typecheck
    npm run build
    
  4. Test via Claude Code: The recommended way to verify your changes is through Claude Code. After building, call the run-tests MCP tool — it returns a test plan that exercises all 27 tools against the live Garmin API. Tell Claude to execute the plan and report results.
  5. Open a PR against main

CI runs lint, format check, typecheck, and build on every PR. Integration tests run locally only (they require Garmin authentication that can't safely run in CI).

Releasing

Releases are fully automated. Every merge to main triggers the release workflow which:

  1. Runs CI (lint, format, typecheck, build)
  2. Bumps the patch version
  3. Publishes to npm with provenance
  4. Creates a GitHub Release

No manual version bumping or tagging needed — just merge your PR.

License

AGPL-3.0

Files in the repo

Repository payload11 top-level entries
  • .github
  • src
  • .gitignore
  • .prettierrc
  • eslint.config.mjs
  • LICENSE
  • NOTICE
  • package-lock.json
  • package.json
  • README.md
  • tsconfig.json

Discussion (0)

Ask about usage, or say what you built with it

Sign in to join the discussion.

No comments yet. Be the first to say what this is good for.

More connectors

Real-time global intelligence dashboard. AI-powered news aggregation, geopolitical monitoring, and infrastructure tracking in a unified situational awareness interface

86k
t8y2/dbxConnectors

20 MB lightweight cross-platform database client for 90+ databases, including MySQL, PostgreSQL, SQLite, Redis, MongoDB, DuckDB, SQL Server, and Dameng. Built-in AI, MCP Server, CLI, desktop and Docker. | 轻量级跨平台数据库管理工具,支持 MySQL、PostgreSQL、SQLite、Redis、MongoDB、达梦等 90+ 数据库,提供桌面端、Docker、CLI、内置 AI 助手和 MCP Server。

19k

The fastest browser for AI agents to run browser automation, built for sharing your logged-in browser state with your AI agents, like Codex or Claude Code, without disturbing you. Zero cost, zero config.

16k
noskillish/
bankmcp

BankMCP™: your AI can now read your bank. Self-hosted, read-only MCP server for your own bank accounts via open banking (Enable Banking). Standard MCP; tested with Claude and Ollama.

177

Open-source auth gateway connecting 1400+ SaaS providers to AI agents through SDK, CLI, MCP, HTTP, and OpenAPI.

5.7k