strava mcp server
A Model Context Protocol server that provides language models with access to Strava API data, allowing them to query and analyze athlete activities from Strava.
A Model Context Protocol server that provides language models with access to Strava API data, allowing them to query and analyze athlete activities from Strava.
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.
The server exposes the following tools:
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 daysDates should be provided in ISO format (YYYY-MM-DD
).
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] |
To use this server, you'll need to authenticate with the Strava API. Follow these steps:
Set the Authorization Callback Domain to localhost
Get your refresh token:
get_strava_token.py
script:
python get_strava_token.py
The script will save your tokens to a .env
file
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 TokenUpdate 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"
}
}
}
}
For Claude Web, you can run the server locally and connect it using the MCP extension.
Once connected, you can ask Claude questions like:
The server provides human-readable error messages for common issues:
This project is licensed under the MIT License - see the LICENSE file for details.
[
{
"description": "n Get the authenticated athlete's recent activities.nn Args:n limit: Maximum number of activities to return (default: 10)nn Returns:n Dictionary containing activities datan ",
"inputSchema": {
"properties": {
"limit": {
"default": 10,
"title": "Limit",
"type": "integer"
}
},
"title": "get_activitiesArguments",
"type": "object"
},
"name": "get_activities"
},
{
"description": "n Get activities within a specific date range.nn Args:n start_date: Start date in ISO format (YYYY-MM-DD)n end_date: End date in ISO format (YYYY-MM-DD)n limit: Maximum number of activities to return (default: 30)nn Returns:n Dictionary containing activities datan ",
"inputSchema": {
"properties": {
"end_date": {
"title": "End Date",
"type": "string"
},
"limit": {
"default": 30,
"title": "Limit",
"type": "integer"
},
"start_date": {
"title": "Start Date",
"type": "string"
}
},
"required": [
"start_date",
"end_date"
],
"title": "get_activities_by_date_rangeArguments",
"type": "object"
},
"name": "get_activities_by_date_range"
},
{
"description": "n Get detailed information about a specific activity.nn Args:n activity_id: ID of the activity to retrievenn Returns:n Dictionary containing activity detailsn ",
"inputSchema": {
"properties": {
"activity_id": {
"title": "Activity Id",
"type": "integer"
}
},
"required": [
"activity_id"
],
"title": "get_activity_by_idArguments",
"type": "object"
},
"name": "get_activity_by_id"
},
{
"description": "n Get activities from the past X days.nn Args:n days: Number of days to look back (default: 7)n limit: Maximum number of activities to return (default: 10)nn Returns:n Dictionary containing activities datan ",
"inputSchema": {
"properties": {
"days": {
"default": 7,
"title": "Days",
"type": "integer"
},
"limit": {
"default": 10,
"title": "Limit",
"type": "integer"
}
},
"title": "get_recent_activitiesArguments",
"type": "object"
},
"name": "get_recent_activities"
}
]