ogerbron/trainingpeaks-mcp-server
If you are the rightful owner of trainingpeaks-mcp-server and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.
The TrainingPeaks MCP Server is a Model Context Protocol server that facilitates interaction with the TrainingPeaks API, allowing for the retrieval of athlete data, workouts, metrics, and calendar events.
get_athlete_profile
Get athlete's profile and training zones.
get_workouts
Retrieve workouts with optional date filtering.
get_workout_details
Get detailed information about a specific workout.
get_calendar_events
Access calendar events within a date range.
get_metrics
Get health metrics (weight, HRV, steps, stress, sleep).
get_planned_workouts
Retrieve upcoming planned workouts.
set_auth_tokens
Set OAuth tokens for API authentication.
TrainingPeaks MCP Server
An MCP (Model Context Protocol) server that enables Claude to interact with the TrainingPeaks API for retrieving athlete data, workouts, metrics, and calendar events.
Features
- Athlete Profile: Get basic profile information and training zones
- Workouts: Retrieve workout history and detailed workout information
- Calendar Events: Access TrainingPeaks calendar events
- Metrics: Get health and fitness metrics (weight, HRV, steps, stress, sleep)
- Planned Workouts: Retrieve upcoming planned workouts (up to 7 days)
- OAuth 2.0 Authentication: Secure authentication with TrainingPeaks API
Prerequisites
- Python 3.8+
- TrainingPeaks API credentials (client_id, client_secret)
- API access approval from TrainingPeaks (required for production use)
Installation
- Clone the repository:
git clone <repository-url>
cd trainingpeaks-mcp-server
- Install dependencies:
pip install -e .
- Copy environment configuration:
cp .env.example .env
- Edit
.env
with your TrainingPeaks API credentials:
TRAININGPEAKS_CLIENT_ID=your_client_id_here
TRAININGPEAKS_CLIENT_SECRET=your_client_secret_here
TRAININGPEAKS_REDIRECT_URI=http://localhost:8080/callback
TRAININGPEAKS_SCOPES=athlete:profile,athlete:workouts
TRAININGPEAKS_ENVIRONMENT=sandbox
Usage
Running the MCP Server
trainingpeaks-mcp-server
Or alternatively:
python -m trainingpeaks_mcp_server.server
To test that the server works:
python test_server.py
Available Tools
- get_athlete_profile: Get athlete's profile and training zones
- get_workouts: Retrieve workouts with optional date filtering
- get_workout_details: Get detailed information about a specific workout
- get_calendar_events: Access calendar events within a date range
- get_metrics: Get health metrics (weight, HRV, steps, stress, sleep)
- get_planned_workouts: Retrieve upcoming planned workouts
- set_auth_tokens: Set OAuth tokens for API authentication
Authentication
Before using the API tools, you need to authenticate:
- Use TrainingPeaks OAuth flow to obtain access and refresh tokens
- Use the
set_auth_tokens
tool to provide tokens to the MCP server - The server will automatically handle token refresh when needed
API Access
Important: TrainingPeaks API access is currently limited to approved commercial applications. To request access:
- Visit https://api.trainingpeaks.com/request-access
- Provide information about your application and use case
- Allow 7-10 days for response
For development/testing, use the sandbox environment.
Configuration
The server supports both production and sandbox environments:
- Sandbox:
TRAININGPEAKS_ENVIRONMENT=sandbox
- Production:
TRAININGPEAKS_ENVIRONMENT=production
Development
Install development dependencies:
pip install -e ".[dev]"
Run tests:
pytest
Format code:
black src/
ruff check src/
License
MIT License - see LICENSE file for details.