garmin-mcp
Enables Claude to access and query your Garmin Connect data, including sleep, activities, training load, and health metrics, through a set of read-only MCP tools.
README
garmin-mcp
A remote MCP (Model Context Protocol) server that exposes your Garmin Connect data to Claude as tools. Add it once as a custom connector in Claude.ai (web, desktop, mobile) and you can ask questions like "how did I sleep last night?" or "summarise my training load this week" without copy-pasting screenshots from the Garmin app.
It is single-user, read-only, and designed to deploy to Google Cloud Run for under one dollar a month.
What it does
The server logs into Garmin Connect on your behalf using the unofficial garminconnect Python library, caches the session tokens, and exposes a fixed set of tools over the MCP streamable-HTTP transport. Claude calls those tools when you ask a question that needs Garmin data.
Tools
| Tool | What it returns |
|---|---|
get_sleep |
Sleep duration, stages (deep / light / REM / awake), score, overnight HRV. |
get_recent_activities |
List of recent activities with type, duration, distance, average heart rate. |
get_activity_details |
Full metrics for one activity, including splits, HR zones, and power. |
get_training_load |
Daily training load with acute (ATL), chronic (CTL), and current status. |
get_hrv_status |
Current HRV status, baseline range, and the last 7 nights of readings. |
get_body_battery |
Body battery values across the day with min, max, charged, drained. |
get_steps_and_calories |
Daily step count, distance, calories, floors, and intensity minutes. |
get_resting_heart_rate |
Resting heart rate trend and average over the requested window. |
get_stress |
Stress levels across the day and time-in-zone breakdown. |
Every response is a Pydantic model serialised to JSON, with null for fields Garmin did not record.
Quick start (local)
Requirements: Python 3.12 or later and uv.
# 1. Install dependencies
uv sync
# 2. Configure credentials
cp .env.example .env
# edit .env with your Garmin login
# 3. Inspect the tools in the MCP dev inspector
uv run mcp dev src/garmin_mcp/server.py
mcp dev runs the server over stdio and opens the MCP inspector in your browser. From there you can call any tool and see the JSON it returns. Auth is skipped in stdio mode, so you only need the Garmin credentials set.
To run the production HTTP server locally:
uv run python -m garmin_mcp
# server listens on http://localhost:8080/mcp
Deploying
See DEPLOY.md for the full Cloud Run walkthrough, including building the container, configuring environment variables, and adding the deployed URL as a custom connector in Claude.
How auth works
The server is its own OAuth 2.1 authorisation server. When you add the connector in Claude, Claude registers itself with the server using RFC 7591 Dynamic Client Registration, then sends you through a PKCE-protected authorisation flow. You enter the password you set as MCP_AUTH_PASSWORD, and the server issues a 24-hour JWT access token plus a refresh token that rotates on every use.
This is intentionally minimal: one password, one user. If someone has the password they can read your Garmin data.
Security caveats
- Garmin credentials live in environment variables on Cloud Run. They never leave the server, but anyone with access to the Cloud Run console can read them. Use a Garmin account that does not double as anything important. Disabling MFA on Garmin is required for unattended login.
- The OAuth password is stored as a plain env var and compared with
secrets.compare_digest. Pick a long, random one (32+ bytes). - The unofficial
garminconnectlibrary can break when Garmin changes their internal API. If a tool starts returning empty data, check that package's changelog. - In-memory state (registered clients, refresh tokens) is wiped on every cold start. You will be re-prompted to authorise after the server has been idle for a while; this is expected.
- This server is read-only. It does not write activities, edit profile fields, or upload anything to Garmin.
Project layout
garmin-mcp/
├── pyproject.toml
├── Dockerfile
├── .env.example
├── README.md
├── DEPLOY.md
├── src/
│ └── garmin_mcp/
│ ├── __init__.py
│ ├── __main__.py # python -m garmin_mcp -> HTTP server
│ ├── server.py # FastMCP app, tools, login UI
│ ├── garmin_client.py # garminconnect wrapper
│ ├── auth.py # OAuth 2.1 provider
│ ├── cache.py # TTL cache
│ └── models.py # Pydantic response models
└── tests/
├── test_cache.py
└── test_tools.py
Running tests and lints
uv run pytest # unit tests
uv run ruff check . # lint
uv run ruff format --check .
uv run mypy src tests # type check
Acknowledgements
garminconnectby cyberjunky for doing the hard work of reverse-engineering the Garmin Connect API.- The Model Context Protocol team for the SDK.
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。