garmin-connect-mcp-server

garmin-connect-mcp-server

A read-only MCP server that gives Claude Desktop access to your Garmin Connect data — daily health metrics, sleep, activities, training status, and body composition.

Category
访问服务器

README

garmin-connect-mcp-server

A read-only Model Context Protocol (MCP) server that gives Claude Desktop access to your Garmin Connect data — daily health metrics, sleep, activities, training status, and body composition.

Non-technical? Follow the step-by-step QUICKSTART instead.

Why this exists

Garmin's official APIs (Health API, Activity API) are only available through the Garmin Connect Developer Program, which is gated to approved businesses. This server instead uses the well-established unofficial garminconnect Python library, which signs in with your own Garmin account using the same OAuth flow as the official Garmin Connect mobile app. No developer program membership, no API keys — you log in once and the long-lived tokens refresh themselves on use.

Unlike most Garmin MCP servers (which expose 60–110 thin endpoint wrappers), this one follows Anthropic's tool-design guidance: six consolidated, purpose-built tools that return compact tables designed for an LLM's context window.

Tools

Tool What it returns
garmin_get_daily_summary Per-day steps, resting HR, overnight HRV + status, Body Battery high/low, stress, intensity minutes, active calories (≤31 days/call)
garmin_get_sleep Per-night sleep score, quality, stage durations (deep/light/REM/awake), overnight HRV, SpO2, resting HR (≤31 days/call)
garmin_list_activities Activity list with IDs, distance, duration, HR, pace/speed, elevation, training effect; filterable by type (≤90 days/call)
garmin_get_activity_detail One activity in depth: pace/power/cadence/calories, plus lap splits and HR-zone breakdown in detailed mode
garmin_get_training_status Training readiness, training status, acute load, VO2max, HRV status, and 5K/10K/half/marathon race predictions in one call
garmin_get_body_composition Weight, body fat %, muscle mass, body water, BMI from a Garmin Index scale or manual entries (≤90 days/call)

All tools are read-only and marked with readOnlyHint — nothing is ever written to your Garmin account. Tools degrade gracefully: an account with no watch data returns clearly-empty tables rather than errors (activity-only accounts, e.g. from a Tacx trainer, still get full activity data).

Requirements

  • Python 3.12+ (required by garminconnect 0.3.x)
  • A free Garmin Connect account (no device required to test auth; data appears once a device or app syncs to the account)
  • Claude Desktop to use the tools (optional for development)

Install

With uv (recommended):

uv sync

Without uv (plain venv + pip) — macOS/Linux:

python3 -m venv .venv
.venv/bin/pip install -r requirements.txt

Windows (PowerShell):

py -m venv .venv
.venv\Scripts\pip install -r requirements.txt

Both paths create the environment in .venv/, so the Claude Desktop config below is identical either way.

Authenticate (one time)

uv run python login.py            # or: .venv/bin/python login.py

Enter your Garmin email and password (plus MFA code if enabled). OAuth tokens are saved to ~/.garminconnect and refresh themselves on use. Your password is never stored — only the tokens are. Re-run the same command whenever tokens expire, or with --force to switch to a different Garmin account.

To store tokens somewhere else, set the GARMINTOKENS env var — but note it must then be set in both places: in your shell when running login.py, and in the Claude Desktop config's env block (GUI apps don't inherit your shell environment):

"garmin": {
  "command": "...",
  "args": ["..."],
  "env": { "GARMINTOKENS": "/path/to/tokens" }
}

Test locally (optional)

uv run fastmcp dev inspector server.py      # or: .venv/bin/fastmcp dev inspector server.py

This opens the MCP Inspector in your browser to exercise each tool by hand.

Install in Claude Desktop

Prefer not to hand-edit JSON? The QUICKSTART has a copy-paste prompt that asks Claude (Claude Code, or Claude Desktop with file access) to write this config for you.

Edit claude_desktop_config.json:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%\Claude\claude_desktop_config.json

(Claude Desktop → Settings → Developer → Edit Config opens it for you.) Add:

{
  "mcpServers": {
    "garmin": {
      "command": "/ABSOLUTE/PATH/TO/garmin-connect-mcp-server/.venv/bin/python",
      "args": ["/ABSOLUTE/PATH/TO/garmin-connect-mcp-server/server.py"]
    }
  }
}

On Windows, command is C:\\...\\garmin-connect-mcp-server\\.venv\\Scripts\\python.exe. No env block or secrets are needed — auth comes from the token store. Fully quit and reopen Claude Desktop (it reads the config only on launch), then try: "What were my Garmin workouts this month?"

Troubleshooting

  • 429 / rate limited during login — Garmin rate-limits its SSO endpoint by IP. Don't retry in a loop; wait 30–60 minutes or switch networks (a phone hotspot changes your IP) and run login.py again.
  • Authentication failed / token errors — re-run the login script (uv run python login.py or .venv/bin/python login.py); tokens die if you change your Garmin password or Garmin revokes them. The running server picks up fresh tokens on the next tool call — no restart needed.
  • Tools return empty tables / all - — the account has no synced data for that range. Health metrics (sleep, HRV, Body Battery, training status) require a Garmin watch; activities can come from any source that syncs to Garmin Connect (trainer, Zwift, phone app).
  • Login suddenly breaks for everyone — Garmin occasionally changes their SSO flow, which temporarily breaks the unofficial library until it's patched. Update with uv sync --upgrade (or .venv/bin/pip install -U garminconnect) and retry.
  • Claude Desktop doesn't show the tools — check the config file for JSON errors (a trailing comma breaks the whole file), verify both paths are absolute and the .venv exists, then fully quit and reopen the app.

How it works

Claude Desktop ──stdio──> server.py (FastMCP, 6 read-only tools)
                              │
                              ├── reads OAuth tokens from ~/.garminconnect
                              │      (written once by login.py; auto-refreshed)
                              │
                              └── garminconnect (unofficial lib, >= 0.3.6)
                                     └── Garmin Connect private web API
  • server.py — the MCP server; never sees your password, only reads tokens.
  • login.py — one-time interactive sign-in (handles MFA); saves tokens.

Fair warning

This uses Garmin Connect's private web API via your personal account — technically a gray area under Garmin's ToS, though it's the same approach used for years by Home Assistant integrations and many other community projects without issue. Use reasonable request volumes and your own account. This project is not affiliated with or endorsed by Garmin.

Development

uv run python -m compileall server.py login.py   # syntax check
uv run fastmcp dev inspector server.py           # manual tool testing

Tool design notes: tools are namespaced garmin_* to compose cleanly with sibling health MCP servers (Oura, Strava, …); outputs are compact markdown tables (roughly 40 tokens/day-row); date ranges are capped per call with actionable error messages.

License

MIT

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选