Skip to main content
Glama

Strava MCP Server

A Model Context Protocol (MCP) server that provides full access to the Strava API v3. Connect Claude (or any MCP client) to your Strava fitness data — activities, athletes, clubs, segments, routes, streams, gear, and more.

Features

  • 30+ tools covering all major Strava API v3 endpoints

  • Auto token refresh — OAuth2 tokens are refreshed and cached automatically

  • Formatted responses — distances in km, times in minutes, speeds in km/h

  • Convenience tools — weekly/monthly summaries, filter by sport type

Available Tools

Category

Tools

Activities

Create, get details, comments, kudos, laps, list, zones, update

Athletes

Profile, zones, stats, update weight

Clubs

List, details, members, admins, activities

Gear

Get gear details (bikes & shoes)

Routes

List, details, GPX export, TCX export

Segments

Explore, starred, details, star/unstar

Segment Efforts

List efforts, effort details

Streams

Activity, route, effort, segment time-series data

Uploads

Upload status

Summaries

Weekly summary, monthly summary, filter by sport type, filter by date

Related MCP server: Strava MCP Server

Prerequisites

  • Python 3.12+

  • uv (Python package manager)

  • A Strava account

  • A Strava API application (see setup below)

Setup

1. Create a Strava API Application

  1. Go to https://www.strava.com/settings/api

  2. Create a new application:

    • Application Name: anything (e.g. "MCP Server")

    • Category: choose any

    • Website: http://localhost

    • Authorization Callback Domain: localhost

  3. Note your Client ID and Client Secret

2. Clone and Install

git clone https://github.com/manojanasuri16/strava-mcp-server.git
cd strava-mcp-server
uv sync

3. Configure Environment

Create a .env file in the project root:

STRAVA_CLIENT_ID=<your_client_id>
STRAVA_CLIENT_SECRET=<your_client_secret>
STRAVA_REFRESH_TOKEN=<your_refresh_token>

To get your refresh token, follow the OAuth Authorization steps below.

4. OAuth Authorization (Getting Your Refresh Token)

Strava uses OAuth2. You need to authorize the app once to get a refresh token.

Step 1: Authorize in browser

Open this URL in your browser (replace YOUR_CLIENT_ID):

https://www.strava.com/oauth/authorize?client_id=YOUR_CLIENT_ID&response_type=code&redirect_uri=http://localhost&scope=read_all,activity:read_all,activity:write,profile:read_all,profile:write

Step 2: Grab the authorization code

After you click "Authorize", Strava redirects to:

http://localhost?code=AUTHORIZATION_CODE&scope=...

Copy the code value from the URL. This code is single-use and expires in minutes, so proceed quickly.

Step 3: Exchange code for tokens

On Linux/macOS (bash):

curl -X POST https://www.strava.com/api/v3/oauth/token \
  -d client_id=YOUR_CLIENT_ID \
  -d client_secret=YOUR_CLIENT_SECRET \
  -d code=AUTHORIZATION_CODE \
  -d grant_type=authorization_code

On Windows (PowerShell):

Invoke-RestMethod -Method Post -Uri "https://www.strava.com/api/v3/oauth/token" -Body @{
  client_id = "YOUR_CLIENT_ID"
  client_secret = "YOUR_CLIENT_SECRET"
  code = "AUTHORIZATION_CODE"
  grant_type = "authorization_code"
}

Step 4: Save the refresh token

The response will include access_token, refresh_token, and expires_at. Copy the refresh_token value into your .env file.

The server will automatically refresh the access token when it expires using this refresh token.

Usage

Test with MCP Inspector

The MCP Inspector provides a web UI to test your tools:

uv run mcp dev strava_server.py
  1. Open the Inspector URL shown in the terminal

  2. Click Connect

  3. Go to the Tools tab

  4. Try running a tool like get_athlete_profile or get_recent_activities

Use with Claude Code (CLI)

From your project directory, register the server:

claude mcp add strava -- uv run strava_server.py

Then start a new Claude Code session and ask things like:

  • "How was my running this week?"

  • "Show me my last 10 activities"

  • "What are my all-time cycling stats?"

  • "Find popular running segments near Bangalore"

  • "Create a manual yoga activity for today"

Use with Claude Desktop

uv run mcp install strava_server.py

Or manually add to your config file:

  • Windows: %APPDATA%\Claude\claude_desktop_config.json

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json

{
  "mcpServers": {
    "strava": {
      "command": "uv",
      "args": ["run", "strava_server.py"],
      "cwd": "/path/to/strava-mcp-server"
    }
  }
}

Restart Claude Desktop after saving.

Use with ChatGPT Desktop

  1. Open ChatGPT Desktop app

  2. Go to Settings > MCP

  3. Add a new server with:

    • Name: strava

    • Command: uv run strava_server.py

    • Working directory: /path/to/strava-mcp-server

Restart ChatGPT Desktop after adding.

Use with Cursor / VS Code

Add to .cursor/mcp.json or .vscode/mcp.json in your workspace:

{
  "servers": {
    "strava": {
      "command": "uv",
      "args": ["run", "strava_server.py"],
      "cwd": "/path/to/strava-mcp-server"
    }
  }
}

Run Standalone

uv run strava_server.py

Troubleshooting

401 Unauthorized Error

This is the most common issue. It means your access token is invalid.

Cause 1: Stale cached tokens

The server caches tokens at ~/.strava-mcp-tokens.json. If this file contains expired/invalid tokens, the server will keep using them.

Fix:

# Linux/macOS
rm ~/.strava-mcp-tokens.json

# Windows (PowerShell)
Remove-Item "$HOME\.strava-mcp-tokens.json" -ErrorAction SilentlyContinue

Then restart the server.

Cause 2: Invalid refresh token

Your refresh token in .env may be expired or revoked. This happens if:

  • You re-authorized the app and got a new refresh token (old one is invalidated)

  • You revoked the app's access in Strava settings

  • The token was never obtained properly

Fix: Redo the OAuth Authorization steps to get a fresh refresh token.

Cause 3: Wrong client credentials

Double-check your STRAVA_CLIENT_ID and STRAVA_CLIENT_SECRET in .env match what's shown at https://www.strava.com/settings/api.

429 Rate Limit

Strava limits API requests to:

  • 100 requests per 15 minutes

  • 1,000 requests per day

The server returns a helpful error message when rate-limited. Wait a few minutes and try again.

Token Refresh Fails on Startup

If the server crashes immediately with a token error, make sure:

  1. Your .env file exists in the project root

  2. All three variables are set (STRAVA_CLIENT_ID, STRAVA_CLIENT_SECRET, STRAVA_REFRESH_TOKEN)

  3. There are no extra spaces or quotes around the values

Missing Scopes

Some tools require specific OAuth scopes:

  • activity:read_all — needed for activity details, streams

  • activity:write — needed for creating/updating activities

  • profile:read_all — needed for athlete zones

  • profile:write — needed for updating weight

If a tool returns a 403 Forbidden error, you may need to re-authorize with the correct scopes. Use the authorization URL in Step 1 above (it includes all scopes).

Project Structure

strava-mcp-server/
├── strava_server.py              # Entry point (thin wrapper)
├── src/
│   └── strava_mcp/
│       ├── __init__.py           # Package exports
│       ├── server.py             # FastMCP instance & logging
│       ├── auth.py               # OAuth2 token management
│       ├── client.py             # HTTP helpers (GET, POST, PUT)
│       ├── formatters.py         # Response formatting utilities
│       └── tools/
│           ├── __init__.py       # Auto-imports all tool modules
│           ├── activities.py     # Activity CRUD, laps, zones, comments, kudos
│           ├── athletes.py       # Profile, stats, zones, weight
│           ├── clubs.py          # Clubs, members, admins, activities
│           ├── gear.py           # Bike & shoe details
│           ├── routes.py         # Routes, GPX/TCX export
│           ├── segments.py       # Segments, efforts, explore, star
│           ├── streams.py        # Time-series data streams
│           └── extras.py         # Summaries, filters, upload status
├── pyproject.toml                # Project config and dependencies
├── uv.lock                       # Locked dependencies
├── .env                           # Your Strava credentials (not committed)
└── README.md                      # This file

License

MIT

Available Tools

37 tools
create_activityA

Create a manual activity on Strava. Requires activity:write scope.

Args: name: The name of the activity. sport_type: Sport type, e.g. Run, Ride, Swim, Hike, Walk, MountainBikeRide, GravelRide, TrailRun, Yoga, WeightTraining, Workout, etc. start_date_local: Start time in ISO 8601 format (e.g. 2025-03-07T08:00:00). elapsed_time: Total elapsed time in seconds. description: Optional description. distance: Distance in meters. Optional for non-GPS activities. trainer: Set True if this is a trainer/indoor activity. commute: Set True if this is a commute.

Inputs: name (required), sport_type (required), start_date_local (required), elapsed_time (required), +4 more.

explore_segmentsA

Find popular segments within a geographic bounding box.

Args: south_west_lat: South-west corner latitude. south_west_lng: South-west corner longitude. north_east_lat: North-east corner latitude. north_east_lng: North-east corner longitude. activity_type: "riding" or "running" (default "riding"). min_cat: Minimum climb category 0-5 (default 0). max_cat: Maximum climb category 0-5 (default 5).

Inputs: south_west_lat (required), south_west_lng (required), north_east_lat (required), north_east_lng (required), +3 more. Returns: result

export_route_gpxB

Export a route as GPX XML data for use in GPS devices or other apps.

Args: route_id: The Strava route ID.

Inputs: route_id (required). Returns: result

export_route_tcxC

Export a route as TCX XML data for use in GPS devices or other apps.

Args: route_id: The Strava route ID.

Inputs: route_id (required). Returns: result

get_activities_by_dateA

Get activities within a specific date range.

Args: after: Start date in YYYY-MM-DD format (inclusive). before: End date in YYYY-MM-DD format (inclusive). count: Max activities to return (1-200, default 50).

Inputs: after (required), before (required), count. Returns: result

get_activities_by_typeA

Get recent activities filtered by sport type.

Args: sport_type: Run, Ride, Swim, Walk, Hike, TrailRun, MountainBikeRide, GravelRide, VirtualRide, Yoga, etc. count: Number of recent activities to search through (max 200).

Inputs: sport_type (required), count. Returns: result

get_activityA

Get full details for a specific activity including splits, segment efforts, laps, gear, description, and map data.

Args: activity_id: The numeric Strava activity ID. include_all_efforts: If True, include all segment efforts (not just notable ones).

Inputs: activity_id (required), include_all_efforts.

get_activity_commentsA

Get comments on a specific activity.

Args: activity_id: The Strava activity ID. page_size: Number of comments per page (default 30).

Inputs: activity_id (required), page_size. Returns: result

get_activity_kudoersC

Get the list of athletes who gave kudos on an activity.

Args: activity_id: The Strava activity ID. page: Page number (default 1). per_page: Items per page (default 30).

Inputs: activity_id (required), page, per_page. Returns: result

get_activity_lapsA

Get lap-by-lap breakdown for a specific activity. Useful for interval workouts and structured training sessions.

Args: activity_id: The numeric Strava activity ID.

Inputs: activity_id (required). Returns: result

get_activity_streamsA

Get time-series stream data for an activity. Returns arrays of second-by-second data for heart rate, speed, power, cadence, altitude, GPS coordinates, temperature, and grade.

Args: activity_id: The Strava activity ID. keys: Comma-separated stream types. Available: time, distance, latlng, altitude, velocity_smooth, heartrate, cadence, watts, temp, moving, grade_smooth. Defaults to all.

Inputs: activity_id (required), keys.

get_activity_zonesA

Get heart rate and power zones for a specific activity. Shows time spent in each zone. Requires Strava Summit.

Args: activity_id: The Strava activity ID.

Inputs: activity_id (required). Returns: result

get_athlete_profileA

Get the authenticated athlete's full Strava profile. Returns name, bio, location, weight, FTP, bikes, shoes, premium status, and measurement preferences.

Inputs: no named parameters.

get_athlete_statsA

Get all-time and recent statistics for the authenticated athlete. Includes totals for running, cycling, and swimming broken down by recent (last 4 weeks), year-to-date, and all-time.

Inputs: no named parameters.

get_athlete_zonesA

Get the authenticated athlete's heart rate and power zones. Returns zone boundaries and distribution data. Requires profile:read_all scope.

Inputs: no named parameters. Returns: result

get_clubC

Get detailed information about a specific club.

Args: club_id: The Strava club ID.

Inputs: club_id (required).

get_club_activitiesB

List recent activities posted by members of a specific club.

Args: club_id: The Strava club ID. page: Page number (default 1). per_page: Items per page (default 30).

Inputs: club_id (required), page, per_page. Returns: result

get_club_adminsB

List administrators of a specific club.

Args: club_id: The Strava club ID. page: Page number (default 1). per_page: Items per page (default 30).

Inputs: club_id (required), page, per_page. Returns: result

get_club_membersB

List members of a specific club.

Args: club_id: The Strava club ID. page: Page number (default 1). per_page: Items per page (default 30).

Inputs: club_id (required), page, per_page. Returns: result

get_gearB

Get details about a specific piece of gear (bike or shoes). Gear IDs start with 'b' for bikes and 'g' for shoes.

Args: gear_id: The gear ID (e.g. "b12345" for a bike, "g12345" for shoes).

Inputs: gear_id (required).

get_my_clubsA

List all clubs the authenticated athlete is a member of.

Args: page: Page number (default 1). per_page: Items per page (default 30).

Inputs: page, per_page. Returns: result

get_my_routesA

List the authenticated athlete's saved routes.

Args: page: Page number (default 1). per_page: Items per page (default 30).

Inputs: page, per_page. Returns: result

get_recent_activitiesA

Get the most recent activities from your Strava account.

Args: count: Number of activities to return (1-200, default 10).

Inputs: count. Returns: result

get_routeC

Get detailed information about a specific route.

Args: route_id: The Strava route ID.

Inputs: route_id (required).

get_route_streamsC

Get stream data for a route (distance, altitude, latlng).

Args: route_id: The Strava route ID.

Inputs: route_id (required).

get_segmentB

Get detailed info about a segment: distance, grade, elevation, location, star count, effort count, and your PR.

Args: segment_id: The Strava segment ID.

Inputs: segment_id (required).

get_segment_effortB

Get detailed information about a specific segment effort.

Args: effort_id: The segment effort ID.

Inputs: effort_id (required).

get_segment_effortsA

List your efforts on a specific segment. Optionally filter by date range.

Args: segment_id: The Strava segment ID. start_date_local: Optional start date (ISO 8601, e.g. 2025-01-01T00:00:00Z). end_date_local: Optional end date (ISO 8601). per_page: Items per page (default 30).

Inputs: segment_id (required), start_date_local, end_date_local, per_page. Returns: result

get_segment_effort_streamsB

Get time-series stream data for a specific segment effort.

Args: effort_id: The segment effort ID. keys: Comma-separated stream types (same as activity streams).

Inputs: effort_id (required), keys.

get_segment_streamsC

Get stream data for a segment (distance, altitude, latlng).

Args: segment_id: The Strava segment ID.

Inputs: segment_id (required).

get_starred_segmentsB

List the authenticated athlete's starred segments.

Args: page: Page number (default 1). per_page: Items per page (default 30).

Inputs: page, per_page. Returns: result

get_upload_statusA

Check the processing status of an activity upload.

Args: upload_id: The upload ID returned from a previous upload.

Inputs: upload_id (required).

monthly_summaryA

Summary of all activities from the past 30 days. Total distance, time, elevation, and calories by sport type.

Inputs: no named parameters.

star_segmentC

Star or unstar a segment.

Args: segment_id: The Strava segment ID. starred: True to star, False to unstar.

Inputs: segment_id (required), starred (required).

update_activityA

Update an existing activity. Requires activity:write scope. Only provide the fields you want to change.

Args: activity_id: The Strava activity ID to update. name: New name for the activity. sport_type: New sport type (e.g. Run, Ride, Swim). description: New description. trainer: Set True/False for trainer flag. commute: Set True/False for commute flag. gear_id: ID of gear to associate (e.g. "b12345"). Use "none" to remove.

Inputs: activity_id (required), name, sport_type, description, +3 more.

update_athlete_weightC

Update the authenticated athlete's weight.

Args: weight_kg: Athlete's weight in kilograms.

Inputs: weight_kg (required).

weekly_summaryA

Summary of all activities from the past 7 days. Total distance, time, elevation, and calories by sport type.

Inputs: no named parameters.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    B3.3/5.0

    Scored across 37 tools

    Disambiguation5/5

    Each tool targets a distinct resource and action, with clear separation between activities, segments, routes, clubs, athlete profiles, and summaries. Even similar tools like get_recent_activities and get_activities_by_date have unambiguous differences in filtering.

    Naming Consistency4/5

    Most tools follow a consistent verb_noun pattern (e.g., create_activity, get_activity, update_activity), but a few like monthly_summary and weekly_summary deviate from this pattern, using noun_adjective instead.

    Tool Count2/5

    With 37 tools, the server is on the heavy side. While it covers a broad domain, this number exceeds the recommended range and may overwhelm agents, making selection and navigation more difficult.

    Completeness4/5

    The tool set covers most CRUD operations for activities, segments, routes, clubs, and athlete data, plus exports and summaries. A notable gap is the absence of a delete activity tool, but overall the surface is comprehensive.

    Maintenance

    ActivityInactive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers