Charlotte, NC
ProjectsApril 9, 2026

Garmin MCP Server

Tap to enlarge, then pinch to zoom
The Garmin MCP Server is an open-source Model Context Protocol server that connects your Garmin wearable data to any AI assistant. It exposes 34 tools covering daily health metrics, workout history, training readiness, body composition, sleep trends, and multi-day comparative reports. Ask your AI "how did I sleep last night?" or "compare my stress this week vs last week" and get real answers from real data. The project started because I wanted my AI tools to have access to my health data without building custom integrations for every client. MCP is the protocol that makes this work. One server, any compatible client. Garmin Connect has a mobile app and a web dashboard, but neither is designed for the kind of questions I actually want to ask. Things like "what's my HRV trend over the last two weeks and how does it correlate with my training load?" or "show me every strength training session this month with sets and reps" require clicking through multiple screens and mentally assembling the picture yourself. The Garmin Connect API exists, but it's undocumented and session-based. The garminconnect Python library wraps it nicely, but that still leaves you writing scripts for every question. MCP turns the API into something any AI assistant can use conversationally. I build data pipelines that make information queryable. This is the same pattern scaled down to a single person's health data: take a data source that's hard to query directly, wrap it in an interface that an AI can navigate, and let natural language do the rest. The server is a Python application built on FastMCP that authenticates with Garmin Connect via OAuth and exposes health data as MCP tools over Streamable HTTP. Garmin Connect uses OAuth 1.0a tokens that persist for roughly a year. Getting them is the awkward part, so there are four ways in:
  1. Stored tokens. The server loads existing OAuth tokens from ~/.garminconnect/.
  2. Environment variables. With no stored tokens, it logs in with GARMIN_EMAIL and GARMIN_PASSWORD and saves the tokens it gets back.
  3. Interactive script. garmin_auth.py handles first-time setup, including the MFA prompt.
  4. Browser-assisted fallback. garmin_browser_auth.py covers the case where Cloudflare blocks the scripted login.
That fourth tier exists because Garmin's Cloudflare configuration now rate-limits the POST /sso/signin endpoint that the garminconnect library uses for scripted login. The GET to the same endpoint still returns 200, but the credential POST gets a 429 regardless of TLS fingerprint or user agent. The browser-assisted flow sidesteps this entirely: you sign in through a real browser (which Cloudflare allows), grab the SSO ticket from the post-login redirect, and the script exchanges it for OAuth tokens via connectapi.garmin.com, a different host that isn't behind the same Cloudflare rules. The result is the same token pair the MCP server already expects. Once authenticated, the token file gets mounted into the Docker container as a read-only volume. No credentials in the image, no secrets in environment variables after initial setup. The server doesn't log in again on its own. It builds one Garmin client on the first tool call and keeps it for the life of the process. If logging in with the stored tokens fails, the tool call fails with an error that says to run garmin_auth.py. A scripted re-login from inside the server would hit the same Cloudflare 429 as the login script, so with tokens that last about a year, a clear error is the more useful failure. The 34 tools fall into four categories: Daily health (14 tools): Steps, heart rate, sleep, stress, body battery, HRV, SpO2, respiration, hydration, floors, goals progress, and detailed stress timelines. Each accepts an optional date parameter (defaults to today). Activities and training (11 tools): Recent workouts, activity details with splits, strength training exercise sets (actual sets, reps, and weight), activity search with filters, training status, training readiness, personal records, badges, and step streaks. Body and composition (2 tools): Current body composition and weight history with trend analysis over configurable time ranges. Trends and reports (7 tools): Weekly summaries, date range queries across selectable metrics, sleep quality trends, recovery metrics, period-over-period comparisons, and a comprehensive weekly health report that returns everything in a single call. The garminconnect library is synchronous, so a naive weekly health report makes every call in sequence. The report covers two weeks, this one and the one before it for the week-over-week comparison, and each day needs six calls: sleep, HRV, stress, body battery, heart rate and steps. That's 84 calls before weight history, training readiness, training status and the exercise sets for up to ten recent strength sessions. The server runs them on thread pools instead. A _parallel_fetch helper takes a list of (function, *args) tuples, runs them on five workers and returns the results in order. A task that raises comes back as None instead of killing the batch, and the report puts an empty day in its place. The weekly report hands _parallel_fetch fourteen day-sets. Each day-set then runs its six calls on its own six-thread pool, so up to 30 requests can be in flight at once, and the supporting data runs afterwards on a separate four-thread pool. The five-worker cap limits how many days are fetched together, not the total number of requests to Garmin. If Garmin ever starts rate-limiting data calls the way it rate-limits logins, the per-day pool is the first thing I'd shrink. All distance values are automatically converted from metric to imperial (miles). This is a small thing, but it means the AI doesn't need to know that Garmin stores everything in kilometers and meters. The response just says "3.2 miles" instead of requiring a follow-up conversion. The compose file builds the image locally. If you'd rather not build it, every push to main that touches the server runs the unit tests and then publishes ghcr.io/bmccarn/garmin-mcp-server, tagged latest and with a sha- tag for the commit. That published image is what I run on my homelab Kubernetes cluster. Flux deploys it as a non-root pod with a read-only root filesystem, and External Secrets copies the two token files from 1Password into a Secret that is mounted read-only, the same contract as the Docker volume. The tests are few, and they cover the kind of bug this project has had. Garmin sometimes sends a metric's key with a null value instead of leaving it out, so daily.get("sleepTimeSeconds", 0) returns None and the arithmetic after it raises. Body Battery arrays have the same problem, with null levels mixed into the samples. The fixes are small (or 0, and a helper that keeps only numeric Body Battery levels), and the tests pin the Body Battery case. Point your client at http://localhost:8000/mcp using Streamable HTTP transport. That's it. Claude Desktop, LiteLLM, or anything else that speaks MCP. Streamable HTTP over stdio. Most MCP examples use stdio transport, which ties the server's lifecycle to the client process. HTTP means the server runs independently as a long-lived service, multiple clients can connect simultaneously, and it deploys naturally in Docker. Thread pools, not an async rewrite. The garminconnect library is synchronous. Rather than forking it or wrapping every call in asyncio.to_thread, short-lived thread pools inside the tools handle the concurrency. It's simpler, and the calls spend their time waiting on Garmin, which threads handle fine. Read-only token mount. The Docker container never writes to the token directory. Auth happens outside the container, tokens get mounted read-only. This keeps the container stateless and means you can rebuild it without losing authentication. 34 tools instead of a generic query interface. Each tool has specific parameters, return types, and docstrings that help the AI understand what's available. A single "query Garmin" tool would technically work but would require the AI to know the API schema. Explicit tools mean the AI can browse capabilities and pick the right one.
  • Python 3.12 with FastMCP (pinned to 2.13.1) for the MCP server framework
  • garminconnect (pinned to 0.2.34, garth-backed) for Garmin Connect API access (OAuth 1.0a)
  • garth for browser-assisted OAuth ticket exchange against connectapi.garmin.com
  • Streamable HTTP transport for client-agnostic connectivity
  • concurrent.futures thread pool for parallel API fetching
  • Docker with health checks and compose for deployment
  • GitHub Actions to run the unit tests and publish the GHCR image
  • MIT licensed and open source
The project is on GitHub under the MIT license. If you wear a Garmin and use AI tools, it's a docker compose up away from connecting the two.

Related projects

Solomon Thrift Store Pricing

A phone-first pricing app for a ministry thrift store, grounded in completed sales and manager review, and simplified after a backtest on real staff prices.

Tracecheck

Evidence-backed code review for AI coding agents, with exact source references, independent Jev judgments, and explicit limits on what a review can prove.

Obsidian Vault RAG

Open-source retrieval for Obsidian vaults, with local search, a shared MCP service, project-scoped profiles, and source-checked citations for AI agents.

Rollo Label Printer

Personal label-printing tool that finds the real shipping label inside messy return PDFs and images, normalizes it to 4x6, and prints through direct IPP.

blakemccarn.dev

Portfolio and blog built with Next.js 16, deployed to AWS via SST v4 with Cloudflare DNS, staging environments, and full IaC.

Charlotte Wire & Cable

Full-stack business website for a specialty wire distributor: searchable catalog, admin dashboard, and serverless AWS infrastructure via SST.

Paperless OCR Enhanced

Open-source Paperless-ngx companion service that uses LLM vision models to repair weak OCR and improve downstream document search.

Paperless Knowledge Graph

A knowledge graph over my Paperless-ngx archive that answers plain-language questions with citations and, in its audited modes, checks every claim against the original OCR.

RapidEPR

I founded RapidEPR, an AI tool that writes military evaluations and award citations for five services, and grew it from a personal project to over 500,000 users.