Coach Mcp

io.github.snoozelieb由 GitHub 帳號 snoozelieb 發布v1.4.0更新於 Nov 7, 2026

Adaptive AI training coach MCP server backed by Garmin Connect

概覽

AI 產生的概覽

本機 MCP 伺服器,讓助理以 Garmin Connect 的真實資料擔任訓練教練,開立受負荷與傷害規則約束的訓練計畫。

可以做什麼
  • 讀取 Garmin 資料:體能指標、各項運動歷史、強度、準備度、個人紀錄與活動區間
  • 規劃訓練:每週計畫、多週訓練方案、課表預覽、週期化階段,並把結構化訓練推送到手錶
  • 管理運動員資料:個人檔案、FTP 與閾值配速、基準與體能歷史更新、新手引導
  • 處理賽事、肌力訓練與傷害,包括傷害診斷與狀態更新
  • 保存教練記憶:決策、運動員回饋、異常處理與待核准提案
  • 產生簡報與簽到,並提供規劃、回顧與教練準則的提示詞與資源
適用情境
適合已在 Garmin Connect 記錄訓練、希望助理依實際歷史開立計畫、遵守負荷與傷害限制,並在多次對話間記住過去教練決策的耐力運動愛好者。
執行需求
透過 uvx 或 pip 在本機執行(需 Python 3.12+),也可從原始碼執行。需要免費的 Garmin Connect 帳號,並設定環境變數 GARMIN_EMAIL 與 GARMIN_PASSWORD;可選用 COACH_DATA_DIR 指定資料存放位置。需要 Claude Code、Claude Desktop 或 Cursor 等 MCP 用戶端,且須先以安裝精靈建立運動員檔案,規劃類工具才能使用。
安裝前請注意
Garmin 帳號密碼會以明文透過 GARMIN_PASSWORD 寫入用戶端設定或本機 .env 檔,OAuth 權杖也會快取在磁碟上。伺服器會把計畫與訓練寫入 Garmin,並修改本機 JSON 資料檔。憑證與權杖會傳送給 Garmin 介面,對話內容會傳送給所用的大型語言模型服務商,研究賽事、傷害或動作時還會抓取公開網頁。每個資料目錄僅支援一位運動員。

安裝

在 SourceWeft 中

  1. 開啟 儀表板中的 Coach Mcp,將其新增到工作區。
  2. 為需要使用其工具的對話啟用該服務。

Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。

其他 MCP 客戶端

參照 儲存庫 中的啟動說明。

README

coach-mcp

[CI] [License: MIT]

An opinionated AI training coach as an MCP server. It pulls your real data from Garmin Connect and prescribes with authority — science-based load management (ACWR), code-enforced injury gates (the server rejects plans that violate an active injury restriction, no matter what the LLM says), and persistent coaching memory so decisions, rationale, and your adaptation patterns survive between conversations. It will tell you "no" when your enthusiasm exceeds your capacity.

All health data and credentials stay on your machine — see Security & Privacy.

Quickstart

You need Python 3.12+, a free Garmin Connect account, and an MCP client (Claude Code, Claude Desktop, or Cursor).

Option A: uvx (recommended)

No install step — your MCP client runs the server on demand:

bash
uvx garmin-coach-mcp

Jump to Connect your MCP client and use uvx as the command.

Option B: from source

bash
git clone https://github.com/snoozelieb/coach-mcp.gitcd coach-mcp
python -m venv .venv# Linux/macOS:source .venv/bin/activate# Windows:.venv\Scripts\activate
pip install -r requirements.txtcp .env.example .env   # then edit: GARMIN_EMAIL, GARMIN_PASSWORDpython server.py

Connect your MCP client

The server needs two environment variables: GARMIN_EMAIL and GARMIN_PASSWORD. Optional: COACH_DATA_DIR (where your coaching data lives); COACH_TOKEN_DIR, COACH_TRANSPORT and COACH_CODE_MODE are covered under Security & Privacy and Advanced. From a source checkout, a .env file works too.

To run the server or the helpers from a terminal, set the two variables in that shell first. PowerShell and bash quote differently:

powershell
$env:GARMIN_EMAIL = "[email protected]"$env:GARMIN_PASSWORD = "your-password"
bash
export [email protected] GARMIN_PASSWORD=your-password

Claude Code

bash
claude mcp add coach-mcp \  --env [email protected] \  --env GARMIN_PASSWORD=your_garmin_password \  -- uvx garmin-coach-mcp

Or in .mcp.json (Claude Code expands ${VAR} from your shell environment, so a committed file holds no secret):

json
{  "mcpServers": {    "coach-mcp": {      "command": "uvx",      "args": ["garmin-coach-mcp"],      "env": {        "GARMIN_EMAIL": "[email protected]",        "GARMIN_PASSWORD": "${GARMIN_PASSWORD}",        "COACH_DATA_DIR": "/path/to/your/coach-data"      }    }  }}

Running from source instead: claude mcp add coach-mcp -- python /full/path/to/coach-mcp/server.py

Claude Desktop

In claude_desktop_config.json (Settings → Developer → Edit Config):

json
{  "mcpServers": {    "coach-mcp": {      "command": "uvx",      "args": ["garmin-coach-mcp"],      "env": {        "GARMIN_EMAIL": "[email protected]",        "GARMIN_PASSWORD": "your_garmin_password",        "COACH_DATA_DIR": "/path/to/your/coach-data"      }    }  }}

Cursor

In .cursor/mcp.json (project) or ~/.cursor/mcp.json (global):

json
{  "mcpServers": {    "coach-mcp": {      "command": "uvx",      "args": ["garmin-coach-mcp"],      "env": {        "GARMIN_EMAIL": "[email protected]",        "GARMIN_PASSWORD": "your_garmin_password",        "COACH_DATA_DIR": "/path/to/your/coach-data"      }    }  }}

If you installed with pip install garmin-coach-mcp instead of uvx, use "command": "garmin-coach-mcp" with no args in any of the blocks above.

First run

  1. Create your profile. Run the interactive wizard (installed copies have the console script; a source checkout can run the script):

    bash
    garmin-coach-setup                 # pip / uvx installpython scripts/setup_wizard.py     # source checkout

    Until a profile exists the server runs in setup mode: plan, program and push writes answer setup_required and name the data directory they looked in.

    It creates your athlete profile, training config, and empty plan/memory files in the data directory. Alternatively, create the two required files by hand and let the coach fill in the rest via conversation:

    bash
    echo '{"personal":{"name":null},"injury_history":[],"life_constraints":{}}' > data/athlete.jsonecho '{"events":[],"current_block":{"phase":"base"}}' > data/training_config.json
  2. Pull your Garmin baseline. In your MCP client, say:

    "Run refresh_athlete_baseline and set up my training."

    The coach pulls your name, weight, age, HR data, and training capacity from Garmin, then starts the onboarding conversation — goals, constraints, injury history, race calendar.

  3. Garmin MFA / expired session. Garmin logins are token-cached. If tools start returning AUTH_REQUIRED, recover with:

    bash
    garmin-coach-login                 # pip / uvx installpython scripts/garmin_login.py     # source checkout

    It does a fresh credential login, prompts for the MFA code if Garmin asks, and saves new tokens. Restart the MCP server afterwards.

How it works

  1. Snapshot first — every coaching conversation starts from get_coaching_snapshot(): current time context, 7-day week grid (rest days explicit), fitness metrics, plan adherence, open anomalies, injuries, sleep gate.
  2. Load hierarchy before prescribing — overall ACWR (injury gate, 0.8–1.3 sweet spot), then sport-specific ACWR (spike detection), then sport-specific CTL (race readiness).
  3. Hard gates are code, not vibes — update_weekly_plan and push_plan_to_garmin reject sessions that violate an active injury's restricted activities, and every non-rest session must carry a purpose or the save is refused. Multi-week programs (training_program) are rejected if their starting capacity contradicts your actual history.
  4. Grounded in what you've actually done — prescriptions are anchored to your demonstrated per-sport capacity from recent sessions, not template numbers; a weekly plan that outruns that history comes back with grounding_warnings.
  5. Curiosity with memory — planned-vs-actual anomalies (missed session, type mismatch, activity on a rest day) register once with a lifecycle (open → asked → resolved); the coach asks you what happened instead of silently assuming.
  6. Everything persists — decisions, approvals, adaptation patterns, and season lifecycle (race debriefs, phase transitions) live in local JSON and carry across sessions.

MCP surface

52 tools — you don't call them directly; the coach uses them during conversation:

CategoryTools
Coaching coreget_coaching_snapshot (canonical, sectioned), get_compliance_report, get_coaching_score
Planningget_weekly_plan, update_weekly_plan, preview_workout (render one session the way the watch will show it, or fetch the session contract), push_plan_to_garmin (preview with the step tree per session, then confirm), training_program (action=get/set; multi-week programs, capacity-anchored and injury-gated), get_week_constraints, get_weekly_prescription, get_periodization_status, update_phase
Garmin dataquery_metrics (kind=fitness/sport_history/intensity/daily/readiness/personal_records), get_activities_range
Athleteget_athlete, update_athlete, set_ftp, set_threshold_pace, analyze_ftp_test, refresh_athlete_baseline, refresh_fitness_history, backfill_history, get_onboarding_guide
Methodologyget_methodology, update_methodology
Racesraces (action=list/add/update/research), remove_race
Strengthsync_strength_session, get_strength_baseline, approve_progression, set_exercise_preference, generate_strength_workout, add_exercise
Injuriesdiagnose_injury, research_injury, update_injury_status
Researchresearch_exercise, list_exercises, research_sport
Memorylog_coaching_decision, get_active_decisions, update_decision_status, record_athlete_response, get_response_patterns, resolve_anomaly
Approvalspropose_coaching_action, list_pending_approvals, approve_proposal, reject_proposal
Interactivegenerate_smart_brief, interactive_check_in

Every tool carries MCP annotations (read-only / destructive / idempotent / open-world), enforced by tests.

6 prompts: weekly_planning, morning_brief, injury_assessment, week_review, onboarding, race_program.

6 resources: coach://athlete/profile, coach://plan/current, coach://config/training, coach://coaching/decisions, coach://context/now, coach://coaching/doctrine (the long-form coaching doctrine).

Security & Privacy

Everything stays on your machine:

  • Credentials: GARMIN_EMAIL/GARMIN_PASSWORD live in your MCP client config or a local .env. Garmin OAuth tokens are cached in a local token store (.garth/ in a source checkout, a per-user garmin-tokens directory for installed copies; override with COACH_TOKEN_DIR).
  • Health data: all coaching data (profile, plans, fitness history, sleep, coaching memory) is local JSON in your data directory. There is no backend, no telemetry, no analytics.
  • What leaves your machine: requests to Garmin's own API (your credentials/tokens, sent only to Garmin); whatever your MCP client sends to its LLM as part of the conversation; optional public web-page fetches when the coach researches a race, injury, or exercise. Nothing else: the FastMCP startup banner that would check PyPI for updates is disabled.
  • Single athlete per data directory by design. For multiple athletes, run separate server instances with separate COACH_DATA_DIRs.

See SECURITY.md for details and how to report issues.

Data directory

Resolution order: COACH_DATA_DIR env var → data/ in a source checkout → a per-user data directory (created on first run for installed packages). The only file shipped with the package is methodology.json (safety rules, race templates, personas); everything personal is created locally and never committed.

Advanced

bash
# HTTP transport (streamable-http) instead of stdioCOACH_TRANSPORT=streamable-http FASTMCP_PORT=8000 garmin-coach-mcp
# Code Mode (search/execute meta-tools instead of 52 individual tools)pip install fastmcp[code-mode]COACH_CODE_MODE=1 garmin-coach-mcp
# Standalone morning auditpython scripts/daily_loop.py          # ingest + audit yesterday + template brief (exit 1 if unverified)
# Tests (1,546 tests; clean checkouts use committed sanitized fixtures)pip install -r requirements-dev.txtpython -m pytest -q

Architecture

coach/server.py registers tools from the coach/ package (11 tool modules, pure parsers, a typed pydantic storage layer, CTL/ATL/ACWR fitness math, a Garmin client with token-first auth, and a workout builder that pushes structured workouts to your watch). The project went through a five-phase modernization — auth rebuild, schema layer, hard gates, sectioned snapshot, packaging — whose full history and rationale live in docs/UPGRADE_ROADMAP.md. Development conventions are in CLAUDE.md.

Acknowledgements

All Garmin Connect access — login, MFA, token handling, activity and health data, and workout upload — runs on python-garminconnect by Ron Klinkien (@cyberjunky) and its contributors (MIT). coach-mcp wouldn't exist without it.

License

MIT

來源:README.md,提交 7fb4163

工具

0
SourceWeft 曾在隔離沙箱中以無憑證方式啟動該軟體包一次,以列出其工具,但未能完成:軟體包安裝失敗。

版本歷史

2
  1. v1.3.0Oct 26, 2026
  2. v1.0.0Sep 16, 2026

評分

已滿足適用檢查項的 50%

該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。

  • 近 30 天內可連通25 分

    請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。

  • 已宣告認證方式10 分

    請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。

  • 已列出工具15 分

    請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。

  • 描述必需15 分
  • 圖示10 分
  • 文件15 分
  • 授權條款10 分