Garmin MCP Server

Garmin MCP Server

Enables LLMs and MCP clients to securely access your Garmin Connect health and running data, including daily wellness metrics, activity details, training status, and race predictions, for personalized coaching and analysis.

Category
访问服务器

README

Garmin MCP Server

An MCP server that exposes your Garmin Connect health and running data as tools — so an LLM like DeepSeek can analyze your watch data daily and coach you like a running/health coach that adapts to your actual numbers.

Garmin watch ──sync──▶ Garmin Connect ──▶ garmin-mcp (this server)
                                                │  MCP tools (stdio / HTTP)
                                                ▼
                       DeepSeek (via scripts/deepseek_chat.py) or any MCP client
                       (Claude Desktop, Cherry Studio, Cursor, Claude Code, ...)

Features

  • Daily health digest — one call returns sleep (duration/score/stages), resting HR, HRV (last night + weekly), body battery, stress, SpO2, respiration, steps, calories, intensity minutes, morning training readiness and any workouts for a day.
  • Run coaching data — get_run_analysis aggregates volume, weighted pace, HR, cadence, elevation, training load and weekly trends across a date range; get_activity_detail drills into per-lap splits.
  • 18 tools covering daily metrics, series data, activities, training status/readiness, VO2max, race predictions, lactate threshold, HR zones, body composition, personal records and profile.
  • Token-based auth — log in once (MFA-capable) and sessions are saved to disk; the server resumes automatically, no password prompts.
  • Mock mode — GARMIN_MOCK=true serves deterministic synthetic data so you can test the whole pipeline before connecting a real account.
  • Built-in DeepSeek bridge — scripts/deepseek_chat.py gives DeepSeek the tools directly (function calling), interactive or one-shot for cron.

Requirements

  • Python 3.10+ (developed on 3.13)
  • A Garmin Connect account (free). Two-factor enabled accounts are supported.

Setup

cd /Users/jai/Documents/garmin_mcp_app

# 1. Create the virtualenv and install dependencies
python3 -m venv .venv
.venv/bin/pip install -r requirements.txt

# 2. Configure credentials
cp .env.example .env        # then edit .env: GARMIN_EMAIL, GARMIN_PASSWORD

Log in once (interactive, handles MFA)

.venv/bin/python -m garmin_mcp.login_cli --verify

This authenticates with Garmin Connect, prompts for the one-time MFA code if your account uses two-factor auth, saves the OAuth tokens to ~/.garminconnect (owner-only permissions), and pulls a few real data points to confirm everything works. From then on the server needs no password.

Troubleshooting login: Garmin sometimes throws a bot/captcha challenge. Fix: log into connect.garmin.com once in your browser, then retry the login script. If you get rate-limited (429), wait a few minutes before retrying.

Test without a real account (mock mode)

GARMIN_MOCK=true .venv/bin/python scripts/smoke_test.py

Boots the server over stdio and exercises every tool as a real MCP client — 19 checks, all expected to pass with synthetic data.

Connect to an MCP client

Point your client at the launcher script ./garmin-mcp-server (it resolves the venv and PYTHONPATH automatically):

Claude Desktop — add to claude_desktop_config.json (or use the example in config/claude_desktop_config.example.json):

{
  "mcpServers": {
    "garmin": {
      "command": "/Users/jai/Documents/garmin_mcp_app/garmin-mcp-server",
      "type": "stdio"
    }
  }
}

Cherry Studio (DeepSeek-friendly desktop chat): Settings → MCP Servers → Add: Name garmin, type stdio, command /Users/jai/Documents/garmin_mcp_app/garmin-mcp-server, and select your DeepSeek provider as the model. Credentials come from the project .env, so no env vars are needed in the client.

Claude Code / Cursor / Cline: mcp add garmin -- /Users/jai/Documents/garmin_mcp_app/garmin-mcp-server

MCP Inspector (debugging): npx @modelcontextprotocol/inspector and point it at the command above — or run the server over HTTP:

./garmin-mcp-server --transport streamable-http --port 8000

Connect DeepSeek directly (optional bridge)

DeepSeek's chat API speaks OpenAI-style function calling, so this repo includes a small bridge that starts the Garmin server, hands DeepSeek its tools, and lets it decide what to query:

.venv/bin/pip install -r requirements-deepseek.txt   # adds 'openai'
# add DEEPSEEK_API_KEY to .env (see .env.example)

# interactive coach chat (uses prompts/coach.md as the system prompt)
.venv/bin/python scripts/deepseek_chat.py

# one-shot — cron-friendly ("daily analysis" job)
.venv/bin/python scripts/deepseek_chat.py --once "How was my recovery today? What should today's run be?"

Write your own coaching persona in prompts/coach.md and pass it with --system-prompt prompts/coach.md (it's the default). A starter prompt is included.

Note: the DeepSeek web/chat app doesn't support MCP itself; the bridge above is the way to use DeepSeek with this server. Any MCP-capable client (Claude Desktop, Cherry Studio, Cursor, Claude Code) also works with your own DeepSeek API key.

Web app (dashboard + chat)

A browser front end is included — no MCP client needed:

.venv/bin/pip install -r requirements-web.txt    # fastapi + uvicorn
./garmin-web                                     # http://127.0.0.1:8080
./garmin-web --mock                              # try it with synthetic data
./garmin-web --port 9000                         # different port

It shows:

  • Today cards — sleep score/duration, HRV, body battery, resting HR, stress, steps vs goal, training readiness, workouts.
  • Charts (last 7/14/28 days) — resting HR + HRV, sleep, body battery, steps, weekly stress, weekly run distance.
  • Recent runs table — distance, pace, HR, cadence, elevation, training effect, load.
  • Coach chat panel — ask questions in natural language; DeepSeek answers using your live Garmin data (add DEEPSEEK_API_KEY to .env). The dashboard itself works without a key.

The web app keeps one MCP session to the Garmin server open for its whole lifetime, so it reuses the exact same tools and auth as every other client. The charts use the Chart.js CDN, so the browser needs internet access.

Available tools

Tool Returns
get_health_snapshot(date) Full daily digest: sleep, HR, HRV, body battery, stress, SpO2, readiness, activities
get_daily_summary(date) Steps/goal, distance, calories, floors, intensity minutes, HR, stress, SpO2, respiration
get_steps(date) / get_heart_rate(date) / get_stress(date) / get_body_battery(date) Daily series with hourly averages
get_sleep(date) Duration, score, qualifier, stage breakdown, sleep SpO2
get_hrv(date) Last-night avg/min/max, weekly average, status
get_resting_heart_rate(start, end) Daily RHR series over a range
get_health_series(start, end) Aligned per-date rows (RHR, body battery, sleep, HRV, steps, runs) + weekly stress — powers the dashboard charts
get_activities(start, end, activity_type?) Activity list with pace, HR, cadence, TE, VO2max, load
get_activity_detail(activity_id) Single activity + per-lap splits
get_run_analysis(start, end) Coach rollup: volume, weighted pace, weekly trends, per-run rows
get_training_status(date) / get_training_readiness(date) Garmin training load/status, morning readiness + subscores
get_fitness_metrics() VO2max, race predictions, lactate threshold, HR zones
get_body_composition(start, end) Weight/BMI/body-fat/muscle/bone/water history
get_personal_records() / get_profile() PRs and account profile

All outputs are JSON strings; {"ok": true, ...} on success, {"ok": false, "error": ...} on failure. Dates are YYYY-MM-DD (local time).

Project layout

src/garmin_mcp/
  server.py          MCP server (tools, transports, CLI)
  garmin_client.py   real Garmin Connect client (token resume, cache) + mock
  formatters.py      raw Garmin payloads → compact LLM-friendly JSON
  config.py          env / .env settings
  login_cli.py       one-time interactive login (MFA-capable)
  deepseek.py        shared DeepSeek ↔ MCP chat core (CLI + web app)
scripts/
  smoke_test.py      end-to-end MCP client test (mock by default)
  deepseek_chat.py   DeepSeek ↔ MCP bridge (interactive or --once)
  web_app.py         FastAPI backend for the web dashboard + chat
web/                 frontend (index.html, app.js, style.css)
garmin-mcp-server    executable launcher for MCP clients
garmin-web           executable launcher for the web app
config/              Claude Desktop config example
prompts/coach.md     your coach system prompt (edit me)

Notes & caveats

  • This uses Garmin's unofficial (web/device) endpoints via the community garminconnect library. Garmin can change these at any time; the formatters are written defensively so missing fields degrade gracefully.
  • Token files contain long-lived refresh tokens — keep them private (~/.garminconnect, written 0600).
  • The server caches responses for GARMIN_CACHE_TTL seconds (default 600) to avoid hammering Garmin when the LLM asks overlapping questions.
  • The web dashboard charts load Chart.js from a CDN — the browser needs internet access for the charts (cards and the table still work offline).
  • Not affiliated with Garmin. For personal use.

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 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

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

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

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

官方
精选
Python
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 模型以安全和受控的方式获取实时的网络信息。

官方
精选