garmin-mcp

garmin-mcp

Provides read-only access to authenticated Garmin Connect data through MCP, including profile and connection status. It supports secure linking without exposing Garmin credentials as tool arguments.

Category
访问服务器

README

Garmin MCP

Project status (2026-08-23): personal-tunnel implementation; local smoke tests pass. Do not enable friend access or public MCP ingress. Real Garmin credentials remain blocked until the operator explicitly approves the separate public HTTPS link-web tunnel and completes the live-test checklist in PERSONAL_TUNNEL_RUNBOOK.md.

Multi-user, read-only MCP resource server that wraps cyberjunky/python-garminconnect. It exposes authenticated Garmin data without accepting a user ID as a tool argument.

Security model

The bullets below describe the original design intent. They are not yet all proven by the current implementation; the known gaps and required acceptance tests are tracked in DESIGN_DRAFT.md.

  • MCP bearer tokens are verified separately from Garmin authentication. Production OIDC validates signature, issuer, audience, expiry, required scopes, and uses the verified sub claim.
  • Garmin email, password, and MFA codes exist only during their request. They are not persisted or logged. Uvicorn access logging is disabled.
  • Only python-garminconnect's serialized session JSON is stored, encrypted with AES-256-GCM and authenticated against the owning principal so ciphertext cannot be moved between users.
  • MFA clients are process-local, single-use, owner-bound, and expire after five minutes.
  • Connection URLs place their signed one-time state in the fragment. External JavaScript clears the fragment and moves state into a POST body, keeping it out of HTTP and proxy access logs.
  • Disconnect deletes the local encrypted tokens. This does not revoke a token already issued by Garmin; revoke access in Garmin account security settings if compromise is suspected.

Personal ChatGPT tunnel mode

The personal setup deliberately uses two listeners:

  • SERVER_ROLE=mcp on loopback port 3000. Only OpenAI Secure MCP Tunnel may reach this port.
  • SERVER_ROLE=link-web on loopback port 3001. A separate HTTPS tunnel may expose only this listener so a phone can enter Garmin credentials without exposing the MCP endpoint.

AUTH_MODE=tunnel has one configured TUNNEL_PRINCIPAL_ID; it is not a multi-user mode. The OpenAI tunnel is the authentication boundary, and the server refuses combined mode or a non-loopback bind unless container isolation is explicitly enabled. See PERSONAL_TUNNEL_RUNBOOK.md for the end-to-end setup.

Run locally

For a Windows setup covering every dependency, both tunnels, ChatGPT, and troubleshooting, see INSTALLATION_HANDBOOK.md.

After the one-time setup on this Windows PC, start the local services and OpenAI tunnel with:

.\start-garmin-mcp.cmd

The launcher is safe to run again: healthy services are left running instead of duplicated. The OpenAI Runtime API key is requested in a separate window and kept only in process memory. Useful commands are status, restart, and stop:

.\start-garmin-mcp.cmd status
.\start-garmin-mcp.cmd restart
.\start-garmin-mcp.cmd stop

It deliberately does not expose the Garmin credential page. If the Garmin session must be linked again, first open a temporary HTTPS tunnel to port 3001 and then run:

.\start-garmin-mcp.cmd restart -LinkPublicBaseUrl https://<fresh-hostname>

Requires Python 3.12+, PostgreSQL 17, and uv.

cp .env.example .env
# Fill secrets, then for local-only bearer authentication set AUTH_MODE=development.
uv sync --all-extras
psql "$DATABASE_URL" -f migrations/001_initial.sql
uv run garmin-mcp

Or run docker compose up --build after creating .env. Compose publishes both application ports to 127.0.0.1 only and does not publish PostgreSQL. The MCP endpoint is /mcp; the health endpoint is /healthz. In development mode the bearer value itself is the local user ID. Never expose development mode beyond loopback.

MCP tools

  • get_connection_status
  • connect_garmin — returns a ten-minute, single-use browser URL
  • get_profile
  • get_sleep, get_daily_summary, get_steps, get_heart_rate, get_hrv
  • get_body_battery, get_stress, get_training_readiness
  • list_activities, get_activity
  • all 106 public get_*/count_* methods from pinned garminconnect==0.3.11, registered as explicit tools under their upstream names
  • list_garmin_data_operations and get_garmin_data — discovery and bounded generic fallback
  • download_activity_file, download_health_snapshot, download_workout_file — bounded file exports returned as MCP embedded resources
  • disconnect_garmin

Garmin data tools are read-only. disconnect_garmin mutates only local connection state by deleting the stored session. Account credentials are entered only into the browser linking page, never supplied as MCP tool arguments. The running server exposes 122 tools. See API_COVERAGE.md for upstream coverage, validation bounds, and deliberate exclusions.

Validation

uv run ruff check .
uv run mypy src
uv run pytest
uv build
uv run pip-audit

Do not put real Garmin credentials in CI. Any future live test must use a dedicated account and an explicit integration-test marker.

推荐服务器

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

官方
精选