Integrations
Uses .ENV files to store and manage authentication credentials and configuration options for the Strava API integration.
Runs as a Node.js application, with the server being launched through the Node runtime in Claude's configuration.
Provides tools for accessing Strava data including recent activities, profile details, athlete stats, activity streams (power, heart rate, cadence), segments management, detailed activity information, route management, and exporting routes in GPX/TCX formats.
Strava MCP Server
This project implements a Model Context Protocol (MCP) server in TypeScript that acts as a bridge to the Strava API. It exposes Strava data and functionalities as "tools" that Large Language Models (LLMs) can utilize through the MCP standard.
Features
- 🏃 Access recent activities, profile, and stats.
- 📊 Fetch detailed activity streams (power, heart rate, cadence, etc.).
- 🗺️ Explore, view, star, and manage segments.
- ⏱️ View detailed activity and segment effort information.
- 📍 List and view details of saved routes.
- 💾 Export routes in GPX or TCX format to the local filesystem.
- 🤖 AI-friendly JSON responses via MCP.
- 🔧 Uses Strava API V3.
Natural Language Interaction Examples
Ask your AI assistant questions like these to interact with your Strava data:
Recent Activity & Profile:
- "Show me my recent Strava activities."
- "What were my last 3 rides?"
- "Get my Strava profile information."
- "What's my Strava username?"
Activity Streams & Data:
- "Get the heart rate data from my morning run yesterday."
- "Show me the power data from my last ride."
- "What was my cadence profile for my weekend century ride?"
- "Get all stream data for my Thursday evening workout."
- "Show me the elevation profile for my Mt. Diablo climb."
Stats:
- "What are my running stats for this year on Strava?"
- "How far have I cycled in total?"
- "Show me my all-time swim totals."
Specific Activities:
- "Give me the details for my last run."
- "What was the average power for my interval training on Tuesday?"
- "Did I use my Trek bike for my commute yesterday?"
Clubs:
- "What Strava clubs am I in?"
- "List the clubs I've joined."
Segments:
- "List the segments I starred near Boulder, Colorado."
- "Show my favorite segments."
- "Get details for the 'Alpe du Zwift' segment."
- "Are there any good running segments near Golden Gate Park?"
- "Find challenging climbs near Boulders Flagstaff Mountain."
- "Star the 'Flagstaff Road Climb' segment for me."
- "Unstar the 'Lefthand Canyon' segment."
Segment Efforts:
- "Show my efforts on the 'Sunshine Canyon' segment this month."
- "List my attempts on Box Hill between January and June this year."
- "Get the details for my personal record on Alpe d'Huez."
Routes:
- "List my saved Strava routes."
- "Show the second page of my routes."
- "What is the elevation gain for my Boulder Loop route?"
- "Get the description for my 'Boulder Loop' route."
- "Export my 'Boulder Loop' route as a GPX file."
- "Save my Sunday morning route as a TCX file."
Advanced Prompt Example
Here's an example of a more advanced prompt to create a professional cycling coach analysis of your Strava activities:
This prompt creates a personalized analysis of your most recent Strava activity, complete with professional coaching feedback and a custom visualization dashboard.
⚠️ Important Setup Sequence
For successful integration with Claude, follow these steps in exact order:
- Install the server and its dependencies
- Configure the server in Claude's configuration
- Complete the Strava authentication flow
- Restart Claude to ensure proper environment variable loading
Skipping steps or performing them out of order may result in environment variables not being properly read by Claude.
Installation & Setup
- Prerequisites:
- Node.js (v18 or later recommended)
- npm (usually comes with Node.js)
- A Strava Account
1. From Source
- Clone Repository:Copy
- Install Dependencies:Copy
- Build the Project:Copy
2. Configure Claude Desktop
Update your Claude configuration file:
Make sure to replace /absolute/path/to/your/strava-mcp/
with the actual path to your installation.
3. Strava Authentication Setup
The setup-auth.ts
script makes it easy to set up authentication with the Strava API. Follow these steps carefully:
Create a Strava API Application
- Go to https://www.strava.com/settings/api
- Create a new application:
- Enter your application details (name, website, description)
- Important: Set "Authorization Callback Domain" to
localhost
- Note down your Client ID and Client Secret
Run the Setup Script
Follow the prompts to complete the authentication flow (detailed instructions in the Authentication section below).
4. Restart Claude
After completing all the above steps, restart Claude Desktop for the changes to take effect. This ensures that:
- The new configuration is loaded
- The environment variables are properly read
- The Strava MCP server is properly initialized
🔑 Environment Variables
Variable | Description |
---|---|
STRAVA_CLIENT_ID | Your Strava Application Client ID (required) |
STRAVA_CLIENT_SECRET | Your Strava Application Client Secret (required) |
STRAVA_ACCESS_TOKEN | Your Strava API access token (generated during setup) |
STRAVA_REFRESH_TOKEN | Your Strava API refresh token (generated during setup) |
ROUTE_EXPORT_PATH | Absolute path for saving exported route files (optional) |
Token Handling
This server implements automatic token refreshing. When the initial access token expires (typically after 6 hours), the server will automatically use the refresh token stored in .env
to obtain a new access token and refresh token. These new tokens are then updated in both the running process and the .env
file, ensuring continuous operation.
You only need to run the scripts/setup-auth.ts
script once for the initial setup.
Configure Export Path (Optional)
If you intend to use the export-route-gpx
or export-route-tcx
tools, you need to specify a directory for saving exported files.
Edit your .env
file and add/update the ROUTE_EXPORT_PATH
variable:
Replace the placeholder with the absolute path to your desired export directory. Ensure the directory exists and the server has permission to write to it.
API Reference
The server exposes the following MCP tools:
get-recent-activities
Fetches the authenticated user's recent activities.
- When to use: When the user asks about their recent workouts, activities, runs, rides, etc.
- Parameters:
perPage
(optional):- Type:
number
- Description: Number of activities to retrieve.
- Default: 30
- Type:
- Output: Formatted text list of recent activities (Name, ID, Distance, Date).
- Errors: Missing/invalid token, Strava API errors.
get-athlete-profile
Fetches the profile information for the authenticated athlete.
- When to use: When the user asks for their profile details, username, location, weight, premium status, etc.
- Parameters: None
- Output: Formatted text string with profile details.
- Errors: Missing/invalid token, Strava API errors.
get-athlete-stats
Fetches activity statistics (recent, YTD, all-time) for the authenticated athlete.
- When to use: When the user asks for their overall statistics, totals for runs/rides/swims, personal records (longest ride, biggest climb).
- Parameters: None
- Output: Formatted text summary of stats, respecting user's measurement preference.
- Errors: Missing/invalid token, Strava API errors.
get-activity-details
Fetches detailed information about a specific activity using its ID.
- When to use: When the user asks for details about a specific activity identified by its ID.
- Parameters:
activityId
(required):- Type:
number
- Description: The unique identifier of the activity.
- Type:
- Output: Formatted text string with detailed activity information (type, date, distance, time, speed, HR, power, gear, etc.), respecting user's measurement preference.
- Errors: Missing/invalid token, Invalid
activityId
, Strava API errors.
list-athlete-clubs
Lists the clubs the authenticated athlete is a member of.
- When to use: When the user asks about the clubs they have joined.
- Parameters: None
- Output: Formatted text list of clubs (Name, ID, Sport, Members, Location).
- Errors: Missing/invalid token, Strava API errors.
list-starred-segments
Lists the segments starred by the authenticated athlete.
- When to use: When the user asks about their starred or favorite segments.
- Parameters: None
- Output: Formatted text list of starred segments (Name, ID, Type, Distance, Grade, Location).
- Errors: Missing/invalid token, Strava API errors.
get-segment
Fetches detailed information about a specific segment using its ID.
- When to use: When the user asks for details about a specific segment identified by its ID.
- Parameters:
segmentId
(required):- Type:
number
- Description: The unique identifier of the segment.
- Type:
- Output: Formatted text string with detailed segment information (distance, grade, elevation, location, stars, efforts, etc.), respecting user's measurement preference.
- Errors: Missing/invalid token, Invalid
segmentId
, Strava API errors.
explore-segments
Searches for popular segments within a given geographical area (bounding box).
- When to use: When the user wants to find or discover segments in a specific geographic area, optionally filtering by activity type or climb category.
- Parameters:
bounds
(required):- Type:
string
- Description: Comma-separated:
south_west_lat,south_west_lng,north_east_lat,north_east_lng
.
- Type:
activityType
(optional):- Type:
string
("running"
or"riding"
) - Description: Filter by activity type.
- Type:
minCat
(optional):- Type:
number
(0-5) - Description: Minimum climb category. Requires
activityType: 'riding'
.
- Type:
maxCat
(optional):- Type:
number
(0-5) - Description: Maximum climb category. Requires
activityType: 'riding'
.
- Type:
- Output: Formatted text list of found segments (Name, ID, Climb Cat, Distance, Grade, Elevation).
- Errors: Missing/invalid token, Invalid
bounds
format, Invalid filter combination, Strava API errors.
star-segment
Stars or unstars a specific segment for the authenticated athlete.
- When to use: When the user explicitly asks to star, favorite, unstar, or unfavorite a specific segment identified by its ID.
- Parameters:
segmentId
(required):- Type:
number
- Description: The unique identifier of the segment.
- Type:
starred
(required):- Type:
boolean
- Description:
true
to star,false
to unstar.
- Type:
- Output: Success message confirming the action and the segment's new starred status.
- Errors: Missing/invalid token, Invalid
segmentId
, Strava API errors (e.g., segment not found, rate limit).
get-segment-effort
Fetches detailed information about a specific segment effort using its ID.
- When to use: When the user asks for details about a specific segment effort identified by its ID.
- Parameters:
effortId
(required):- Type:
number
- Description: The unique identifier of the segment effort.
- Type:
- Output: Formatted text string with detailed effort information (segment name, activity ID, time, distance, HR, power, rank, etc.).
- Errors: Missing/invalid token, Invalid
effortId
, Strava API errors.
list-segment-efforts
Lists the authenticated athlete's efforts on a given segment, optionally filtered by date.
- When to use: When the user asks to list their efforts or attempts on a specific segment, possibly within a date range.
- Parameters:
segmentId
(required):- Type:
number
- Description: The ID of the segment.
- Type:
startDateLocal
(optional):- Type:
string
(ISO 8601 format) - Description: Filter efforts starting after this date-time.
- Type:
endDateLocal
(optional):- Type:
string
(ISO 8601 format) - Description: Filter efforts ending before this date-time.
- Type:
perPage
(optional):- Type:
number
- Description: Number of results per page.
- Default: 30
- Type:
- Output: Formatted text list of matching segment efforts.
- Errors: Missing/invalid token, Invalid
segmentId
, Invalid date format, Strava API errors.
list-athlete-routes
Lists the routes created by the authenticated athlete.
- When to use: When the user asks to see the routes they have created or saved.
- Parameters:
page
(optional):- Type:
number
- Description: Page number for pagination.
- Type:
perPage
(optional):- Type:
number
- Description: Number of routes per page.
- Default: 30
- Type:
- Output: Formatted text list of routes (Name, ID, Type, Distance, Elevation, Date).
- Errors: Missing/invalid token, Strava API errors.
get-route
Fetches detailed information for a specific route using its ID.
- When to use: When the user asks for details about a specific route identified by its ID.
- Parameters:
routeId
(required):- Type:
number
- Description: The unique identifier of the route.
- Type:
- Output: Formatted text string with route details (Name, ID, Type, Distance, Elevation, Est. Time, Description, Segment Count).
- Errors: Missing/invalid token, Invalid
routeId
, Strava API errors.
export-route-gpx
Exports a specific route in GPX format and saves it locally.
- When to use: When the user explicitly asks to export or save a specific route as a GPX file.
- Prerequisite: The
ROUTE_EXPORT_PATH
environment variable must be correctly configured on the server. - Parameters:
routeId
(required):- Type:
number
- Description: The unique identifier of the route.
- Type:
- Output: Success message indicating the save location, or an error message.
- Errors: Missing/invalid token, Missing/invalid
ROUTE_EXPORT_PATH
, File system errors (permissions, disk space), InvalidrouteId
, Strava API errors.
export-route-tcx
Exports a specific route in TCX format and saves it locally.
- When to use: When the user explicitly asks to export or save a specific route as a TCX file.
- Prerequisite: The
ROUTE_EXPORT_PATH
environment variable must be correctly configured on the server. - Parameters:
routeId
(required):- Type:
number
- Description: The unique identifier of the route.
- Type:
- Output: Success message indicating the save location, or an error message.
- Errors: Missing/invalid token, Missing/invalid
ROUTE_EXPORT_PATH
, File system errors (permissions, disk space), InvalidrouteId
, Strava API errors.
get-activity-streams
Retrieves detailed time-series data streams from a Strava activity, perfect for analyzing workout metrics, visualizing routes, or performing detailed activity analysis.
- When to use: When you need detailed time-series data from an activity for:
- Analyzing workout intensity through heart rate zones
- Calculating power metrics for cycling activities
- Visualizing route data using GPS coordinates
- Analyzing pace and elevation changes
- Detailed segment analysis
- Parameters:
id
(required):- Type:
number | string
- Description: The Strava activity identifier to fetch streams for
- Type:
types
(optional):- Type:
array
- Default:
['time', 'distance', 'heartrate', 'cadence', 'watts']
- Available types:
time
: Time in seconds from startdistance
: Distance in meters from startlatlng
: Array of [latitude, longitude] pairsaltitude
: Elevation in metersvelocity_smooth
: Smoothed speed in meters/secondheartrate
: Heart rate in beats per minutecadence
: Cadence in revolutions per minutewatts
: Power output in wattstemp
: Temperature in Celsiusmoving
: Boolean indicating if movinggrade_smooth
: Road grade as percentage
- Type:
resolution
(optional):- Type:
string
- Values:
'low'
(100 points),1000 points),'medium'
('high'
(~10000 points) - Description: Data resolution/density
- Type:
series_type
(optional):- Type:
string
- Values:
'time'
or'distance'
- Default:
'distance'
- Description: Base series type for data point indexing
- Type:
page
(optional):- Type:
number
- Default: 1
- Description: Page number for paginated results
- Type:
points_per_page
(optional):- Type:
number
- Default: 100
- Special value:
-1
returns ALL data points split into multiple messages - Description: Number of data points per page
- Type:
- Output Format:
- Metadata:
- Available stream types
- Total data points
- Resolution and series type
- Pagination info (current page, total pages)
- Statistics (where applicable):
- Heart rate: max, min, average
- Power: max, average, normalized power
- Speed: max and average in km/h
- Stream Data:
- Formatted time-series data for each requested stream
- Human-readable formats (e.g., formatted time, km/h for speed)
- Consistent numeric precision
- Labeled data points
- Metadata:
- Example Request:Copy
- Special Features:
- Smart pagination for large datasets
- Complete data retrieval mode (points_per_page = -1)
- Rich statistics and metadata
- Formatted output for both human and LLM consumption
- Automatic unit conversions
- Notes:
- Requires activity:read scope
- Not all streams are available for all activities
- Older activities might have limited data
- Large activities are automatically paginated
- Stream availability depends on recording device and activity type
- Errors:
- Missing/invalid token
- Invalid activity ID
- Insufficient permissions
- Unavailable stream types
- Invalid pagination parameters
get-activity-laps
Retrieves the laps recorded for a specific Strava activity.
- When to use:
- Analyze performance variations across different segments (laps) of an activity.
- Compare lap times, speeds, heart rates, or power outputs.
- Understand how an activity was structured (e.g., interval training).
- Parameters:
id
(required):- Type:
number | string
- Description: The unique identifier of the Strava activity.
- Type:
- Output Format:
A text summary detailing each lap, including:
- Lap Index
- Lap Name (if available)
- Elapsed Time (formatted as HH:MM:SS)
- Moving Time (formatted as HH:MM:SS)
- Distance (in km)
- Average Speed (in km/h)
- Max Speed (in km/h)
- Total Elevation Gain (in meters)
- Average Heart Rate (if available, in bpm)
- Max Heart Rate (if available, in bpm)
- Average Cadence (if available, in rpm)
- Average Watts (if available, in W)
- Example Request:Copy
- Example Response Snippet:Copy
- Notes:
- Requires
activity:read
scope for public/followers activities,activity:read_all
for private activities. - Lap data availability depends on the recording device and activity type (e.g., manual activities may not have laps).
- Requires
- Errors:
- Missing/invalid token
- Invalid activity ID
- Insufficient permissions
- Activity not found
get-athlete-zones
Retrieves the authenticated athlete's configured heart rate and power zones.
- When to use: When the user asks about their heart rate zones, power zones, or training zone settings.
- Parameters: None
- Output Format:
Returns two text blocks:
- A formatted summary detailing configured zones:
- Heart Rate Zones: Custom status, Zone ranges, Time Distribution (if available)
- Power Zones: Zone ranges, Time Distribution (if available)
- The complete raw JSON data as returned by the Strava API.
- A formatted summary detailing configured zones:
- Example Response Snippet (Summary):Copy
- Notes:
- Requires
profile:read_all
scope. - Zones might not be configured for all athletes.
- Requires
- Errors:
- Missing/invalid token
- Insufficient permissions (Missing
profile:read_all
scope - 403 error) - Subscription Required (Potentially, if Strava changes API access)
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
License
This project is licensed under the MIT License - see the LICENSE file for details. (Assuming MIT, update if different)
You must be authenticated.
remote-capable server
The server can be hosted and run remotely because it primarily relies on remote services or has no dependency on the local environment.
A TypeScript server that acts as a bridge to the Strava API, enabling LLMs to access users' activities, routes, segments, and athlete data through natural language interaction.
- Features
- Natural Language Interaction Examples
- Advanced Prompt Example
- ⚠️ Important Setup Sequence
- Installation & Setup
- 🔑 Environment Variables
- Token Handling
- Configure Export Path (Optional)
- API Reference
- get-recent-activities
- get-athlete-profile
- get-athlete-stats
- get-activity-details
- list-athlete-clubs
- list-starred-segments
- get-segment
- explore-segments
- star-segment
- get-segment-effort
- list-segment-efforts
- list-athlete-routes
- get-route
- export-route-gpx
- export-route-tcx
- get-activity-streams
- get-activity-laps
- get-athlete-zones
- Contributing
- License
Related MCP Servers
- -securityFlicense-qualityA TypeScript-based server that provides a memory system for Large Language Models (LLMs), allowing users to interact with multiple LLM providers while maintaining conversation history and offering tools for managing providers and model configurations.Last updated -20JavaScript
- AsecurityAlicenseAqualityA Model Context Protocol server that provides language models with access to Strava API data, allowing them to query and analyze athlete activities from Strava.Last updated -43PythonMIT License
- -securityAlicense-qualityA Model Context Protocol server that enables language models to interact with Strava data, including activities, athlete statistics, routes, achievements, and social features.Last updated -2PythonMIT License
- AsecurityAlicenseAqualityA TypeScript server that enhances AI assistants' capabilities when working with Starwind UI components, providing tools for project initialization, component installation, documentation access, and more.Last updated -615TypeScriptMIT License