Strava MCP server

Integrates with the Strava API to retrieve and analyze athlete activities data, enabling fitness tracking and performance monitoring over time.
Back to servers
Provider
Tomek Korbak
Release date
Mar 01, 2025
Language
Python
Stats
13 stars

This MCP server allows you to connect Strava activity data to language models like Claude, enabling them to query and analyze your workout information through the Strava API. The server provides tools to fetch activities with standardized data formats so Claude can understand your exercise history.

Installation

Prerequisites

Before using the Strava MCP server, you need to:

  1. 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
  2. Get your refresh token using the included script:

    python get_strava_token.py
    
    • Follow the prompts to authorize your application
    • The script will save your tokens to a .env file

Environment Variables

The server requires the following environment variables:

  • STRAVA_CLIENT_ID: Your Strava API Client ID
  • STRAVA_CLIENT_SECRET: Your Strava API Client Secret
  • STRAVA_REFRESH_TOKEN: Your Strava API Refresh Token

Usage

Setting Up with Claude for Desktop

  1. Update your Claude Desktop configuration file:

    • On macOS: Located at ~/Library/Application\ Support/Claude/claude_desktop_config.json
    • On Windows: Located at %APPDATA%/Claude/claude_desktop_config.json
  2. Add the following configuration:

    {
        "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"
                }
            }
        }
    }
    

Setting Up with Claude Web

For Claude Web, run the server locally and connect it using the MCP extension.

Available Tools

Activities Queries

The server provides the following query tools:

  • Get Recent Activities

    get_activities(limit: int = 10)
    

    Fetches the authenticated athlete's most recent activities

  • Get Activities by Date Range

    get_activities_by_date_range(start_date: str, end_date: str, limit: int = 30)
    

    Retrieves activities within a specific date range (dates in ISO format: YYYY-MM-DD)

  • Get Activity by ID

    get_activity_by_id(activity_id: int)
    

    Obtains detailed information about a specific activity

  • Get Recent Activities by Days

    get_recent_activities(days: int = 7, limit: int = 10)
    

    Fetches activities from the past X days

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]

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

How to add this MCP server to Cursor

There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json file so that it is available in all of your projects.

If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json file.

Adding an MCP server to Cursor globally

To add a global MCP server go to Cursor Settings > MCP and click "Add new global MCP server".

When you click that button the ~/.cursor/mcp.json file will be opened and you can add your server like this:

{
    "mcpServers": {
        "cursor-rules-mcp": {
            "command": "npx",
            "args": [
                "-y",
                "cursor-rules-mcp"
            ]
        }
    }
}

Adding an MCP server to a project

To add an MCP server to a project you can create a new .cursor/mcp.json file or add it to the existing one. This will look exactly the same as the global MCP server example above.

How to use the MCP server

Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.

The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.

You can also explictly ask the agent to use the tool by mentioning the tool name and describing what the function does.

Want to 10x your AI skills?

Get a free account and learn to code + market your apps using AI (with or without vibes!).

Nah, maybe later