Access Strava Athlete Activity Data
A Strava MCP server that lets an AI assistant query the authenticated athlete's activities and stats.
Why it matters
Connect language models to the Strava API to retrieve and analyze athlete activity data. Enables querying recent activities, activities by date range, and detailed activity information.
Outcomes
What it gets done
Retrieve recent athlete activities from Strava.
Query activities within specified date ranges.
Fetch detailed information for specific activities.
Manage Strava API authentication credentials securely.
Install
Add it to your toolbox
Run in your project directory:
curl -fsSL https://spark.entire.vc/get/vb-strava-api | bash Capabilities
Tools your agent gets
Get recent activities of the authenticated athlete with optional limit parameter
Get activities within a specific date range with start_date and end_date parameters
Get detailed information about a specific activity by activity_id
Get activities from the last X days with optional days and limit parameters
Overview
Strava API MCP Server
A Strava MCP server exposing four tools for querying the authenticated athlete's recent, date-ranged, or single activities with distance, speed, elevation, and calorie data. Use when someone wants an AI assistant to answer questions about their own Strava training history instead of opening the Strava app.
What it does
Strava API MCP Server is a Model Context Protocol server that gives an AI assistant access to the Strava API so it can query the authenticated athlete's activities - recent runs, rides, and other workouts - directly from a conversation.
When to use - and when NOT to
Use this when someone wants to ask an AI assistant natural-language questions about their Strava activity history, such as their recent activities, activities from a specific date range, their longest run in the past month, or details of their latest cycling session, instead of opening the Strava app or website. Requires the user's own Strava API application credentials and a refresh token, so it only works for the athlete who owns those credentials.
Capabilities
Four tools: get_activities(limit) returns the authenticated athlete's recent activities up to a limit (default 10); get_activities_by_date_range(start_date, end_date, limit) returns activities between a start and end date in ISO format (YYYY-MM-DD), defaulting to a limit of 30; get_activity_by_id(activity_id) returns detailed information about one specific activity; and get_recent_activities(days, limit) returns activities from the past N days (default 7). Every activity is returned with consistent field names and units: name, sport_type, start_date (ISO 8601), distance_metres, elapsed_time_seconds, moving_time_seconds, average_speed_mps, max_speed_mps, total_elevation_gain_metres, elev_high_metres, elev_low_metres, calories, and start/end latlng coordinates. The server also returns human-readable error messages for invalid date formats, API authentication errors, and network connectivity problems, rather than raw API error payloads. Typical example queries once connected include "What are my recent activities?", "Show me my activities from last week", "What was my longest run in the past month?", and "Get details about my latest cycling activity."
How to install
Requires Python 3.10. First create a Strava API application at strava.com/settings/api to get a Client ID and Client Secret, setting the Authorization Callback Domain to localhost. Then generate a refresh token by running the included script:
python get_strava_token.py
which walks through authorization and saves the resulting tokens to a .env file. Add the server to Claude Desktop's claude_desktop_config.json:
{
"mcpServers": {
"strava": {
"command": "uvx",
"args": ["strava-mcp-server"],
"env": {
"STRAVA_CLIENT_ID": "YOUR_CLIENT_ID",
"STRAVA_CLIENT_SECRET": "YOUR_CLIENT_SECRET",
"STRAVA_REFRESH_TOKEN": "YOUR_REFRESH_TOKEN"
}
}
}
}
For Claude Web, run the server locally and connect it via the MCP extension.
Who it's for
Athletes and developers who want an AI assistant to answer natural-language questions about their own Strava training history - runs, rides, elevation, pace, calories - without switching to the Strava app, released under the MIT license.
Source README
Strava MCP Server
A Model Context Protocol (MCP) server that provides access to the Strava API. It allows language models to query athlete activities data from the Strava API.
Available Tools
The server exposes the following tools:
Activities Queries
get_activities(limit: int = 10): Get the authenticated athlete's recent activitiesget_activities_by_date_range(start_date: str, end_date: str, limit: int = 30): Get activities within a specific date rangeget_activity_by_id(activity_id: int): Get detailed information about a specific activityget_recent_activities(days: int = 7, limit: int = 10): Get activities from the past X days
Dates should be provided in ISO format (YYYY-MM-DD).
Activity Data Format
The server returns activity data with consistent field names and units:
| Field | Description | Unit |
|---|---|---|
name |
Activity name | - |
sport_type |
Type of sport | - |
start_date |
Start date and time | ISO 8601 |
distance_metres |
Distance | meters |
elapsed_time_seconds |
Total elapsed time | seconds |
moving_time_seconds |
Moving time | seconds |
average_speed_mps |
Average speed | meters per second |
max_speed_mps |
Maximum speed | meters per second |
total_elevation_gain_metres |
Total elevation gain | meters |
elev_high_metres |
Highest elevation | meters |
elev_low_metres |
Lowest elevation | meters |
calories |
Calories burned | kcal |
start_latlng |
Start coordinates | [lat, lng] |
end_latlng |
End coordinates | [lat, lng] |
Authentication
To use this server, you'll need to authenticate with the Strava API. Follow these steps:
Create a Strava API application:
- Go to Strava API Settings
- Create an application to get your Client ID and Client Secret
- Set the Authorization Callback Domain to
localhost
Get your refresh token:
- Use the included
get_strava_token.pyscript:
python get_strava_token.py- Follow the prompts to authorize your application
- The script will save your tokens to a
.envfile
- Use the included
Set environment variables:
The server requires the following environment variables:STRAVA_CLIENT_ID: Your Strava API Client IDSTRAVA_CLIENT_SECRET: Your Strava API Client SecretSTRAVA_REFRESH_TOKEN: Your Strava API Refresh Token
Usage
Claude for Desktop
Update your claude_desktop_config.json (located in ~/Library/Application\ Support/Claude/claude_desktop_config.json on macOS and %APPDATA%/Claude/claude_desktop_config.json on Windows) to include the following:
{
"mcpServers": {
"strava": {
"command": "uvx",
"args": [
"strava-mcp-server"
],
"env": {
"STRAVA_CLIENT_ID": "YOUR_CLIENT_ID",
"STRAVA_CLIENT_SECRET": "YOUR_CLIENT_SECRET",
"STRAVA_REFRESH_TOKEN": "YOUR_REFRESH_TOKEN"
}
}
}
}
Claude Web
For Claude Web, you can run the server locally and connect it using the MCP extension.
Example Queries
Once connected, you can ask Claude questions like:
- "What are my recent activities?"
- "Show me my activities from last week"
- "What was my longest run in the past month?"
- "Get details about my latest cycling activity"
Error Handling
The server provides human-readable error messages for common issues:
- Invalid date formats
- API authentication errors
- Network connectivity problems
FAQ
Common questions
Discussion
Questions & comments · 0
Sign In Sign in to leave a comment.