coach-mcp

coach-mcp

An AI training coach MCP server that integrates with Garmin Connect to provide science-based load management, code-enforced injury gates, and persistent coaching memory, keeping data local.

Category
访问服务器

README

coach-mcp

<!-- mcp-name: io.github.snoozelieb/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 (after PyPI release)

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

uvx garmin-coach-mcp

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

Option B: from source

git clone https://github.com/snoozelieb/coach-mcp.git
cd coach-mcp

python -m venv .venv
# Linux/macOS:
source .venv/bin/activate
# Windows:
.venv\Scripts\activate

pip install -r requirements.txt
cp .env.example .env   # then edit: GARMIN_EMAIL, GARMIN_PASSWORD
python 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) and ANTHROPIC_API_KEY (only for the standalone daily_loop.py --llm script). From a source checkout, a .env file works too.

Claude Code

claude mcp add coach-mcp \
  --env GARMIN_EMAIL=you@example.com \
  --env GARMIN_PASSWORD=your_garmin_password \
  -- uvx garmin-coach-mcp

Or in .mcp.json:

{
  "mcpServers": {
    "coach-mcp": {
      "command": "uvx",
      "args": ["garmin-coach-mcp"],
      "env": {
        "GARMIN_EMAIL": "you@example.com",
        "GARMIN_PASSWORD": "your_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):

{
  "mcpServers": {
    "coach-mcp": {
      "command": "uvx",
      "args": ["garmin-coach-mcp"],
      "env": {
        "GARMIN_EMAIL": "you@example.com",
        "GARMIN_PASSWORD": "your_garmin_password",
        "COACH_DATA_DIR": "/path/to/your/coach-data"
      }
    }
  }
}

Cursor

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

{
  "mcpServers": {
    "coach-mcp": {
      "command": "uvx",
      "args": ["garmin-coach-mcp"],
      "env": {
        "GARMIN_EMAIL": "you@example.com",
        "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. From a source checkout, run the interactive wizard:

    python scripts/setup_wizard.py
    

    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:

    echo '{"personal":{"name":null},"injury_history":[],"life_constraints":{}}' > data/athlete.json
    echo '{"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:

    python scripts/garmin_login.py
    

    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.
  4. 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.
  5. Everything persists — decisions, approvals, adaptation patterns, and season lifecycle (race debriefs, phase transitions) live in local JSON and carry across sessions.

MCP surface

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

Category Tools
Coaching core get_coaching_snapshot (canonical, sectioned), get_compliance_report, get_coaching_score
Planning get_weekly_plan, update_weekly_plan, push_plan_to_garmin, get_week_constraints, get_weekly_prescription, get_periodization_status, update_phase
Garmin data query_metrics (kind=fitness/intensity/daily/readiness/personal_records), get_activities_range
Athlete get_athlete, update_athlete, set_ftp, set_threshold_pace, analyze_ftp_test, refresh_athlete_baseline, refresh_fitness_history, get_onboarding_guide
Methodology get_methodology, update_methodology
Races races (action=list/add/update/research), remove_race
Strength sync_strength_session, get_strength_baseline, approve_progression, set_exercise_preference, generate_strength_workout, add_exercise
Injuries diagnose_injury, research_injury, update_injury_status
Research research_exercise, list_exercises, research_sport
Memory log_coaching_decision, get_active_decisions, update_decision_status, record_athlete_response, get_response_patterns, resolve_anomaly
Approvals propose_coaching_action, list_pending_approvals, approve_proposal, reject_proposal
Interactive generate_smart_brief, interactive_check_in

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

5 prompts: weekly_planning, morning_brief, injury_assessment, week_review, onboarding.

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/garmin_tokens.json).
  • 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; and, only if you run daily_loop.py --llm, one request to the Anthropic API.
  • 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

# HTTP / SSE transport instead of stdio
COACH_TRANSPORT=streamable-http FASTMCP_PORT=8000 garmin-coach-mcp

# Code Mode (search/execute meta-tools instead of 48 individual tools)
pip install fastmcp[code-mode]
COACH_CODE_MODE=1 garmin-coach-mcp

# Standalone morning audit
python scripts/daily_loop.py          # template-based brief
python scripts/daily_loop.py --llm    # LLM brief (needs ANTHROPIC_API_KEY)

# Tests (1,260 tests; clean checkouts use committed sanitized fixtures)
pip install -r requirements-dev.txt
python -m pytest -q

Architecture

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.

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

官方
精选