trainingpeaks-mcp

作者 JamsusMaximus已验证

TrainingPeaks MCP server for Claude Desktop, Code and Cowork. No API approval needed - works with any account. Query workouts, CTL/ATL/TSB fitness data, power PRs via natural language.

141
Stars
68
Forks
Python
语言
2026/8/23
添加时间

⚠️ 第三方软件声明

本 Skill 为第三方开源软件,独立托管于 GitHub。SkillTip 仅为信息目录,不控制或维护底层仓库。所显示的安全检查为自动化且范围有限,安装前请自行审查源码。

阅读服务条款

安装

添加到你的 Claude Code skills 目录:

# Add to your Claude Code skills
git clone https://github.com/JamsusMaximus/trainingpeaks-mcp

快速入门

使用 trainingpeaks-mcp 等 Skills 的指南。

安全报告

已验证

上次扫描:—

{
  "status": "PASSED",
  "issues": []
}

README.md

TrainingPeaks MCP Server

TrainingPeaks MCP server

Connect TrainingPeaks to Claude and other AI assistants via the Model Context Protocol (MCP). Query workouts, build structured intervals, manage your calendar, track fitness trends, and control your training through natural conversation.

No API approval required. The official Training Peaks API is approval-gated, but this server uses secure cookie authentication that any user can set up in minutes. Your cookie is stored in your system keyring, never transmitted anywhere except to TrainingPeaks.

What You Can Do

Example conversation with Claude using TrainingPeaks MCP

Ask your AI assistant things like:

  • "Build me a 4x8min threshold session for Tuesday with warm-up and cool-down"
  • "Schedule my mobility session for April 14, 2026 at 16:45"
  • "Compare my FTP progression this year vs last year"
  • "Copy last week's long ride to this Saturday"
  • "Log my weight at 74.5kg and sleep at 7.5 hours"
  • "What's my weekly TSS so far? Am I on track for my ATP target?"
  • "Show my race calendar and how many weeks until my A race"
  • "Set my FTP to 310 and update my power zones"
  • "Add a calendar note for next Monday: rest day, travel"

Tools (84)

Workouts

ToolDescription
tp_get_workoutsList workouts in a date range (max 90 days)
tp_get_workoutGet full details for a single workout
tp_create_workoutCreate a workout with optional interval structure, auto-computed IF/TSS, and optional planned start time
tp_update_workoutUpdate any field of an existing workout, including structured intervals and planned start time
tp_delete_workoutDelete a workout
tp_copy_workoutCopy a workout to a new date (preserves structure and planned fields)
tp_reorder_workoutsReorder workouts on a given day
tp_pair_workoutPair a completed workout with a planned workout (merges into one)
tp_unpair_workoutUnpair a workout (splits into separate completed and planned workouts)
tp_validate_structureValidate interval structure without creating a workout
tp_get_workout_commentsGet comments on a workout
tp_add_workout_commentAdd a comment to a workout
tp_get_workout_noteGet the private workout note for a workout
tp_set_workout_noteSet or update the private workout note
tp_upload_workout_fileUpload a FIT/TCX/GPX file to a workout
tp_download_workout_fileDownload a workout's device file
tp_delete_workout_fileDelete an attached file from a workout

Analysis & Performance

ToolDescription
tp_analyze_workoutDetailed analysis with time-series data, zones, and laps
tp_get_peaksPower PRs (5s-90min) and running PRs (400m-marathon)
tp_get_workout_prsPRs set during a specific session
tp_get_fitnessCTL, ATL, and TSB trend (fitness, fatigue, form)
tp_get_weekly_summaryCombined workouts + fitness for a week with totals
tp_get_atpAnnual Training Plan - weekly TSS targets, periods, races

Athlete Settings

ToolDescription
tp_get_athlete_settingsGet FTP, thresholds, zones, profile
tp_update_ftpUpdate FTP for a sport's power set (bike default; preserves the set's calculation method)
tp_update_hr_zonesUpdate HR threshold/max/resting for a sport (general/bike/run/swim), preserving the method
tp_update_speed_zonesUpdate run/swim threshold pace, preserving the method
tp_create_zonesCreate a NEW per-sport zone set from scratch (choose the calculation method); errors if one already exists
tp_get_zone_methodsList available zone-calculation methods per metric (power/HR/pace) with each method's zone count and labels
tp_update_nutritionUpdate daily planned calories
tp_get_pool_length_settingsGet pool length options

Zone updates — how they work & one limitation. The zone setters target the right per-sport zone set (by workoutTypeId) and recompute the bands with TrainingPeaks' own zone calculator (the same call the web UI's Calculate makes), so the athlete's calculation method (%LTHR, Karvonen, Andy Coggan, …) is honoured exactly. They update a threshold (FTP / LTHR / threshold pace).

Limitation — test-based (Distance/Time) methods. A zone set whose method derives its threshold from a test result (Speed/Pace Distance / Time) cannot have a threshold set directly — there is no stable value to set. These tools detect that case and return TEST_BASED_METHOD (writing nothing) rather than storing a wrong threshold; configure such a set via a test in the TrainingPeaks UI. This is deliberate: the connector owns threshold-anchored zones; test-protocol setup stays in the UI.

Health Metrics

ToolDescription
tp_log_metricsLog weight, HRV, sleep, steps, SpO2, pulse, RMR, injury
tp_get_metricsGet health metrics for a date range
tp_get_nutritionGet nutrition data for a date range

Equipment

ToolDescription
tp_get_equipmentList bikes and shoes with distances
tp_create_equipmentAdd a bike or shoe
tp_update_equipmentUpdate equipment details, retire
tp_delete_equipmentDelete equipment

Events & Calendar

ToolDescription
tp_get_focus_eventGet A-priority focus event with goals
tp_get_next_eventGet nearest future event
tp_get_eventsList events in a date range
tp_create_eventAdd a race/event with priority (A/B/C) and CTL target
tp_update_eventUpdate event details, attach workouts as legs (multisport)
tp_delete_eventDelete an event
tp_create_noteCreate a calendar note
tp_list_notesList calendar notes for a date range
tp_get_noteGet a calendar note by ID
tp_update_noteUpdate title, description, date or visibility of a note
tp_delete_noteDelete a calendar note
tp_get_note_commentsList all comments on a note
tp_add_note_commentAdd a comment to a note
tp_get_availabilityList unavailable/limited periods
tp_create_availabilityMark dates as unavailable or limited
tp_delete_availabilityRemove availability entry

Workout Library

ToolDescription
tp_get_librariesList workout library folders
tp_get_library_itemsList templates in a library
tp_get_library_itemGet full template details including structure
tp_create_libraryCreate a library folder
tp_delete_libraryDelete a library folder
tp_create_library_itemSave a workout template
tp_update_library_itemEdit a template
tp_schedule_library_workoutSchedule a template to a calendar date, for one athlete or (coach accounts) several at once via athletes

Strength Workouts

ToolDescription
tp_search_exercisesSearch the built-in strength exercise library by name (offline)
tp_create_strength_workoutCreate a structured strength/gym workout (blocks of exercises with sets and parameters)
tp_get_strength_summaryGet a strength workout's compliance summary (blocks/prescriptions/sets completed)
tp_get_strength_workoutsList strength/gym workouts in a date range (they don't appear in tp_get_workouts)
tp_get_strength_workoutGet a strength workout's full detail: blocks, exercises, sets, prescribed vs executed weights
tp_update_strength_workoutUpdate a strength workout in place (replace/append blocks, retitle, mark complete) - preserves Garmin TSS and FIT files, so use this rather than delete-and-recreate on device-synced workouts
tp_delete_strength_workoutDelete a strength workout by ID

Athlete Groups (coach accounts)

ToolDescription
tp_list_groupsList the coach's athlete groups (TP tags)
tp_list_athletes_in_groupList the athletes in one group, with names resolved from the roster
tp_create_groupCreate a new athlete group
tp_rename_groupRename an athlete group (default group cannot be renamed)
tp_delete_groupDelete a group - the grouping only, athletes are not deleted
tp_add_athletes_to_groupAdd one or more athletes to a group
tp_remove_athletes_from_groupRemove one or more athletes from a group

Training Plans (multi-week)

ToolDescription
tp_list_training_plansList the coach's authored multi-week training plans
tp_get_training_planSummary of one plan: weeks, per-week duration/distance, sport breakdown
tp_get_training_plan_workoutsAll workouts of a plan laid out by week/day
tp_apply_training_planApply a plan to an athlete's calendar from a start date (safe synthetic copy)

Reference & Auth

ToolDescription
tp_get_workout_typesList all sport types and subtypes with IDs
tp_get_profileGet athlete profile
tp_auth_statusCheck authentication status
tp_list_athletesList athletes (coach accounts)
tp_refresh_authRe-authenticate from browser cookie

MCP Apps (inline charts)

On clients that support the MCP Apps extension (spec 2026-07-28), some tools render an interactive UI inline in the conversation as well as returning their normal text payload. On every other client the tools behave exactly as before - the text answer is always complete on its own.

PMC fitness chart rendered inline

ToolApp
tp_get_fitnessInteractive CTL/ATL/TSB performance-management chart
tp_get_weekly_summaryWeek card: per-day load bars, planned vs completed, totals
tp_get_workoutInterval-profile viewer for structured workouts (summary fallback otherwise)

(Note: as of July 2026, Claude clients still connect to local stdio servers over the pre-2026 protocol, so the apps ship ready but won't render until client support rolls out. The tools' text output is unaffected either way.)

Setup Options

Option A: Auto-Setup with Claude Code

If you have Claude Code, paste this prompt:

Set up the TrainingPeaks MCP server from https://github.com/JamsusMaximus/trainingpeaks-mcp - clone it, create a venv, install it, then walk me through getting my TrainingPeaks cookie from my browser and run tp-mcp auth. Finally, add it to my Claude Desktop config.

Claude will handle the installation and guide you through authentication step-by-step.

Option B: Manual Setup

Step 1: Install

git clone https://github.com/JamsusMaximus/trainingpeaks-mcp.git
cd trainingpeaks-mcp
python3 -m venv .venv
source .venv/bin/activate  # Windows: .venv\Scripts\activate
pip install -e .

Step 2: Authenticate

Option A: Auto-extract from browser (easiest)

If you're logged into TrainingPeaks in your browser:

pip install -e ".[browser]"  # One-time: install browser support
tp-mcp auth --from-browser chrome  # Or: firefox, safari, edge, auto

macOS note: You may see security prompts for Keychain or Full Disk Access. This is normal - browser cookies are encrypted and require permission to read.

Option B: Manual cookie entry

  1. Log into app.trainingpeaks.com
  2. Open DevTools (F12) -> Application tab -> Cookies
  3. Find Production_tpAuth and copy its value
  4. Run tp-mcp auth and paste when prompted

Option C: Environment variable (headless servers, containers, CI)

Set the TP_AUTH_COOKIE environment variable to your Production_tpAuth cookie value (obtained as in Option B):

export TP_AUTH_COOKIE="<Production_tpAuth value>"
tp-mcp serve

Or in your MCP client config, add it under the server's env block. This is a supported, first-class auth method, not a testing-only override - it is the recommended path wherever the keyring and encrypted-file backends don't work: headless Linux boxes without Secret Service, containers that are rebuilt (the encrypted file's key is derived from a machine-specific salt, so it doesn't survive a rebuild), and CI.

Precedence: TP_AUTH_COOKIE is always checked first, before the system keyring, then the encrypted file, so setting it overrides any stored credential.

Security note: the cookie grants full access to your TrainingPeaks account, so treat TP_AUTH_COOKIE like a password. Inject it from a secrets manager or your orchestrator's secret mechanism - never hard-code it in Dockerfiles, compose files, or anything committed to git. Be aware that environment variables are readable by any process running as the same user, and via docker inspect. On desktop setups, the keyring/encrypted-file storage (Options A and B) remains the recommended default; TP_AUTH_COOKIE is for headless and container use.

Other auth commands:

tp-mcp auth-status  # Check if authenticated
tp-mcp auth-clear   # Remove stored cookie

Step 3: Add to Claude Desktop

Run this to get your config snippet:

tp-mcp config

Edit ~/Library/Application Support/Claude/claude_desktop_config.json (macOS) or %APPDATA%\Claude\claude_desktop_config.json (Windows) and paste it inside mcpServers. Example with multiple servers:

{
  "mcpServers": {
    "some-other-server": {
      "command": "npx",
      "args": ["some-other-mcp"]
    },
    "trainingpeaks": {
      "command": "/Users/you/trainingpeaks-mcp/.venv/bin/tp-mcp",
      "args": ["serve"]
    }
  }
}

Restart Claude Desktop. You're ready to go!


Structured Workouts

Create workouts with full interval structure. The server auto-computes duration, IF, and TSS from the structure:

{
  "date": "2026-03-01",
  "sport": "Bike",
  "title": "Sweet Spot Intervals",
  "structure": {
    "primaryIntensityMetric": "percentOfFtp",
    "steps": [
      {"name": "Warm Up", "duration_seconds": 600, "intensity_min": 40, "intensity_max": 55, "intensityClass": "warmUp"},
      {"type": "repetition", "reps": 4, "steps": [
        {"name": "Sweet Spot", "duration_seconds": 480, "intensity_min": 88, "intensity_max": 93, "intensityClass": "active"},
        {"name": "Recovery", "duration_seconds": 120, "intensity_min": 50, "intensity_max": 60, "intensityClass": "rest"}
      ]},
      {"name": "Cool Down", "duration_seconds": 600, "intensity_min": 40, "intensity_max": 55, "intensityClass": "coolDown"}
    ]
  }
}

The LLM builds this JSON naturally from conversation - just say "build me 4x8min sweet spot with 2min rest".

You can use the same simplified structure object with tp_update_workout:

{
  "workout_id": "3658666303",
  "duration_minutes": 57,
  "tss_planned": 62.3,
  "structure": {
    "primaryIntensityMetric": "percentOfThresholdHr",
    "steps": [
      {"name": "Warm-up", "duration_seconds": 900, "intensity_min": 65, "intensity_max": 80, "intensityClass": "warmUp"},
      {"type": "repetition", "name": "4x5min controlled tempo", "reps": 4, "steps": [
        {"name": "Interval", "duration_seconds": 300, "intensity_min": 89, "intensity_max": 94, "intensityClass": "active"},
        {"name": "Jog recovery", "duration_seconds": 180, "intensity_min": 65, "intensity_max": 83, "intensityClass": "rest"}
      ]},
      {"name": "Cool-down", "duration_seconds": 600, "intensity_min": 65, "intensity_max": 80, "intensityClass": "coolDown"}
    ]
  }
}

If duration_minutes and tss_planned are omitted, they are derived from the structure. If you pass them explicitly, they override the derived values.

For advanced round-trip use cases, tp_create_workout and tp_update_workout also accept a native structured_workout payload in TrainingPeaks builder format. When a workout already has a native structure, tp_get_workout returns it as structured_workout.

Workout comments are exposed via tp_get_workout()["workout_comments"] or tp_get_workout_comments(). The older top-level coach_comments and athlete_comments fields are no longer returned by tp_get_workout.

{
  "workout_id": "3658666303",
  "structured_workout": {
    "structure": [],
    "polyline": [],
    "primaryLengthMetric": "duration",
    "primaryIntensityMetric": "percentOfFtp",
    "primaryIntensityTargetOrRange": "range"
  }
}

Use either structure or structured_workout in a single create/update call, not both.

For planned workout scheduling, tp_create_workout and tp_update_workout accept:

  • YYYY-MM-DD for all-day planning on a calendar date
  • YYYY-MM-DDTHH:MM:SS for a planned start time on that date

TrainingPeaks stores planned workout times separately from the calendar day. Internally this means:

  • workoutDay stays at midnight for the selected date
  • startTimePlanned stores the planned start time
  • planned end time is derived from startTimePlanned + totalTimePlanned

Example with a planned start time:

{
  "date": "2026-04-14T16:45:00",
  "sport": "Strength",
  "title": "Core & Mobility",
  "duration_minutes": 60,
  "description": "Core stabilisation and stretching."
}

What is MCP?

Model Context Protocol is an open standard for connecting AI assistants to external data sources. MCP servers expose tools that AI models can call to fetch real-time data, enabling assistants like Claude to access your Training Peaks account through natural language.

Security

TL;DR: Your cookie is encrypted on disk, exchanged for short-lived OAuth tokens, never shown to Claude, and only ever sent to TrainingPeaks. The server has no network ports.

This server is designed with defence-in-depth. Your TrainingPeaks session cookie is sensitive - it grants access to your training data - so we treat it accordingly.

Write access: v2.0 adds full calendar management (create, update, delete workouts, events, notes, equipment, settings). All mutations go through Pydantic validation. The server cannot access billing or payment info.

Cookie Storage

PlatformPrimary StorageFallback
macOSSystem KeychainEncrypted file
WindowsWindows Credential ManagerEncrypted file
LinuxSecret Service (GNOME/KDE)Encrypted file

Your cookie is never stored in plaintext. The encrypted file fallback uses AES-256-GCM authenticated encryption with a PBKDF2-derived key (600,000 iterations) and a machine-specific salt.

Cookie Never Leaks to AI

The AI assistant (Claude) never sees your cookie value. Multiple layers ensure this:

  1. Return value sanitisation: Tool results are scrubbed for any keys containing cookie, token, auth, credential, password, or secret before being sent to Claude
  2. Masked repr(): The BrowserCookieResult and CredentialResult classes override __repr__ to show cookie=<present> instead of the actual value
  3. Sanitised exceptions: Error messages use only exception type names, never full messages that could contain data
  4. No logging: Cookie values are never written to any log

Domain Hardcoding (Cannot Be Changed)

The browser cookie extraction only accesses .trainingpeaks.com:

# From src/tp_mcp/auth/browser.py - HARDCODED, not a parameter
cj = func(domain_name=".trainingpeaks.com")

Claude cannot modify this via tool parameters. The only parameter is browser (chrome/firefox/etc), not the domain. To change the domain would require modifying the source code.

No Network Exposure

The MCP server uses stdio transport only - it communicates with Claude Desktop via stdin/stdout, not over the network. There is no HTTP server, no open ports, no remote access.

Open Source

This server is fully open source. You can audit every line of code before running it. Key security files:

Authentication Flow

The server uses a two-step authentication process:

  1. Cookie to OAuth Token: Your stored cookie is exchanged for a short-lived OAuth access token (expires in 1 hour)
  2. Automatic Refresh: Tokens are cached in memory and automatically refreshed before expiry

This means:

  • You only need to authenticate once with tp-mcp auth
  • API calls use proper Bearer token auth, not cookies
  • If your session cookie expires (typically after several weeks), use tp_refresh_auth in Claude or run tp-mcp auth again

Development

pip install -e ".[dev]"
pytest tests/ -v
mypy src/
ruff check src/

Adding a tool

Every tool automatically gets a display title and behaviour annotations (readOnlyHint / destructiveHint / idempotentHint / openWorldHint), derived from its name by the metadata block at the bottom of src/tp_mcp/server.py. Name your tool by the conventions (tp_get_*/tp_list_* for reads, tp_delete_* for destructive removals, tp_create_*/tp_add_* for creates) and it needs nothing extra; if it doesn't fit the conventions, add it to the exception sets next to that block (_DESTRUCTIVE_TOOLS, _NON_IDEMPOTENT_WRITES, _READ_ONLY_EXTRA, _TITLE_OVERRIDES). tests/test_tool_metadata.py fails with instructions if a tool is misclassified, and the README tool tables above should gain a row.

Licence

MIT

常见问题

What is trainingpeaks-mcp?

trainingpeaks-mcp is an open-source mcp servers skill for AI coding assistants such as Claude Code, Codex CLI, and ChatGPT, built by JamsusMaximus. TrainingPeaks MCP server for Claude Desktop, Code and Cowork. No API approval needed - works with any account. Query workouts, CTL/ATL/TSB fitness data, power PRs via natural language. It has 141 GitHub stars.

Is trainingpeaks-mcp safe to use?

Yes. trainingpeaks-mcp passed SkillsLLM's automated security scan — a dependency vulnerability audit plus prompt-injection heuristics — with no high-severity issues. You can read the full report in the Security Report section on this page.

How do I install trainingpeaks-mcp?

Clone the repository with "git clone https://github.com/JamsusMaximus/trainingpeaks-mcp" and add it to your Claude Code skills directory (see the Installation section above).

What programming language is trainingpeaks-mcp written in?

trainingpeaks-mcp is primarily written in Python. It is open-source under JamsusMaximus on GitHub, so you can review or fork the full source.

Are there alternatives to trainingpeaks-mcp?

Yes. SkillsLLM lists many other MCP Servers skills you can browse and compare side by side. Open the MCP Servers category from the badge at the top of this page, or use the Related Skills and comparison links further down to weigh trainingpeaks-mcp against similar tools.

评论 (0)

暂无评论,成为第一个分享想法的人!

n8n

by n8n-io

12

Fair-code workflow automation platform with native AI capabilities. Combine visual building with custom code, self-host or cloud, 400+ integrations.

201,88160,308TypeScript
MCP 服务器apisai-tools
查看详情

Scrapling

by D4Vinci

🕷️ An adaptive Web Scraping framework that handles everything from a single request to a full-scale crawl!

75,9137,581Python
MCP 服务器
查看详情

TrendRadar

by sansan0

⭐AI-driven public opinion & trend monitor with multi-platform aggregation, RSS, and smart alerts.🎯 告别信息过载,你的 AI 舆情监控助手与热点筛选工具!聚合多平台热点 + RSS 订阅,支持关键词精准筛选。AI 智能筛选新闻 + AI 翻译 + AI 分析简报直推手机,也支持接入 MCP 架构,赋能 AI 自然语言对话分析、情感洞察与趋势预测等。支持 Docker ,数据本地/云端自持。集成微信/飞书/钉钉/Telegram/邮件/ntfy/bark/slack 等渠道智能推送。

61,65224,883Python
MCP 服务器
查看详情

context7

by upstash

Context7 Platform -- Up-to-date code documentation for LLMs and AI code editors

61,0602,938TypeScript
MCP 服务器
查看详情

High-performance code intelligence MCP server. Indexes codebases into a persistent knowledge graph — average repo in milliseconds. 158 languages, sub-ms queries, 99% fewer tokens. Single static binary, zero dependencies.

39,9393,219C
MCP 服务器
查看详情

开发者还喜欢

基于喜欢此 Skill 的开发者投票和收藏

ECC

by affaan-m

10

The agent harness performance optimization system. Skills, instincts, memory, security, and research-first development for Claude Code, Codex, Opencode, Cursor and beyond.

242,21936,702JavaScript
AI 智能体ai-agentsanthropicclaude-code
查看详情
15

An agentic skills framework & software development methodology that works.

234,96620,863Shell
AI 智能体ai-agentsbrainstorming
查看详情

hermes-agent

by NousResearch

10

The agent that grows with you

234,43747,175Python
AI 智能体ai-agentsagent-orchestration
查看详情

n8n

by n8n-io

12

Fair-code workflow automation platform with native AI capabilities. Combine visual building with custom code, self-host or cloud, 400+ integrations.

201,88160,308TypeScript
MCP 服务器apisai-tools
查看详情

The agent harness performance optimization system. Skills, instincts, memory, security, and research-first development for Claude Code, Codex, Opencode, Cursor and beyond.

185,94028,768JavaScript
AI 智能体ai-agentsanthropicclaude-code
查看详情

cc-switch

by farion1231

3

A cross-platform desktop All-in-One assistant for Claude Code, Codex, OpenCode, OpenClaw, Grok Build & Hermes Agent. Only official website: ccswitch.io

128,8688,826Rust
AI 智能体claude-codeai-tools
查看详情