Strava MCP server

Integrates with Strava's API to access and analyze fitness data, retrieve athlete profiles, activities, segments, routes, and clubs, with features for exporting routes in GPX/TCX formats for training insights and route planning.
Back to servers
Setup instructions
Provider
R Huijts
Release date
Apr 07, 2025
Language
TypeScript
Stats
154 stars

The Strava MCP server acts as a bridge between Large Language Models (LLMs) and your Strava data, allowing AI assistants to access your activities, segments, routes, and other fitness information through the Model Context Protocol (MCP) standard.

Installation & Setup

Prerequisites

  • Node.js (v18 or later recommended)
  • npm (usually comes with Node.js)
  • A Strava Account

From Source

  1. Clone Repository:

    git clone https://github.com/r-huijts/strava-mcp.git
    cd strava-mcp
    
  2. Install Dependencies:

    npm install
    
  3. Build the Project:

    npm run build
    

Configure Claude Desktop

Update your Claude configuration file:

{
  "mcpServers": {
    "strava-mcp-local": {
      "command": "node",
      "args": [
        "/absolute/path/to/your/strava-mcp/dist/server.js"
      ]
    }
  }
}

Make sure to replace /absolute/path/to/your/strava-mcp/ with the actual path to your installation.

Strava Authentication Setup

Create a Strava API Application

  1. Go to https://www.strava.com/settings/api
  2. 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

# In your strava-mcp directory
npx tsx scripts/setup-auth.ts

Follow the prompts to complete the authentication flow.

Restart Claude

After completing all the above steps, restart Claude Desktop for the changes to take effect.

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.

Configure Export Path (Optional)

If you intend to use the route export tools, you need to specify a directory for saving exported files.

Edit your .env file and add/update the ROUTE_EXPORT_PATH variable:

# Optional: Define an *absolute* path for saving exported route files (GPX/TCX)
# Example: ROUTE_EXPORT_PATH=/Users/your_username/strava-exports
ROUTE_EXPORT_PATH=

Usage Examples

Here are some example prompts you can use with your AI assistant:

Basic Queries

  • "Show me my recent Strava activities."
  • "What's my Strava username?"
  • "What are my running stats for this year on Strava?"

Activity 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?"

Segments

  • "List the segments I starred near Boulder, Colorado."
  • "Show my favorite segments."
  • "Star the 'Flagstaff Road Climb' segment for me."

Routes

  • "List my saved Strava routes."
  • "Get the description for my 'Boulder Loop' route."
  • "Export my 'Boulder Loop' route as a GPX file."

Advanced Prompt Example

You are Tom Verhaegen, elite cycling coach and mentor to world champion Mathieu van der Poel. Analyze my most recent Strava activity. Provide a thorough, data-driven assessment of the ride, combining both quantitative insights and textual interpretation.

Begin your report with a written summary that highlights key findings and context. Then, bring the raw numbers to life: build an interactive, visually striking dashboard using HTML, CSS, and JavaScript. Use bold, high-contrast colors and intuitive, insightful chart types that best suit each metric (e.g., heart rate, power, cadence, elevation).

Embed clear coaching feedback and personalized training recommendations directly within the visualization. These should be practical, actionable, and grounded solely in the data provided—no assumptions or fabrications.

As a bonus, sprinkle in motivational quotes and cheeky commentary from Mathieu van der Poel himself—he's been watching my rides with one eyebrow raised and a smirk of both concern and amusement.

Available MCP Tools

Activity Data

  • get-recent-activities: Fetches your recent activities
  • get-activity-details: Gets detailed information about a specific activity
  • get-activity-streams: Retrieves time-series data like heart rate, power, and GPS
  • get-activity-laps: Gets lap information for an activity

Profile & Stats

  • get-athlete-profile: Fetches your profile information
  • get-athlete-stats: Gets your activity statistics (recent, YTD, all-time)
  • get-athlete-zones: Retrieves your configured heart rate and power zones
  • list-athlete-clubs: Lists the clubs you belong to

Segments

  • list-starred-segments: Lists your starred segments
  • get-segment: Gets detailed information about a segment
  • explore-segments: Searches for segments in a geographic area
  • star-segment: Stars or unstars a segment
  • get-segment-effort: Gets details about a specific segment effort
  • list-segment-efforts: Lists your efforts on a segment

Routes

  • list-athlete-routes: Lists your saved routes
  • get-route: Gets detailed information about a route
  • export-route-gpx: Exports a route as a GPX file
  • export-route-tcx: Exports a route as a TCX file

Each tool has specific parameters and capabilities, and your AI assistant will choose the appropriate tool based on your query.

How to install this MCP server

For Claude Code

To add this MCP server to Claude Code, run this command in your terminal:

claude mcp add-json "strava-mcp-local" '{"command":"node","args":["/absolute/path/to/your/strava-mcp/dist/server.js"]}'

See the official Claude Code MCP documentation for more details.

For 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 > Tools & Integrations and click "New MCP Server".

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

{
    "mcpServers": {
        "strava-mcp-local": {
            "command": "node",
            "args": [
                "/absolute/path/to/your/strava-mcp/dist/server.js"
            ]
        }
    }
}

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 explicitly ask the agent to use the tool by mentioning the tool name and describing what the function does.

For Claude Desktop

To add this MCP server to Claude Desktop:

1. Find your configuration file:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%\Claude\claude_desktop_config.json
  • Linux: ~/.config/Claude/claude_desktop_config.json

2. Add this to your configuration file:

{
    "mcpServers": {
        "strava-mcp-local": {
            "command": "node",
            "args": [
                "/absolute/path/to/your/strava-mcp/dist/server.js"
            ]
        }
    }
}

3. Restart Claude Desktop for the changes to take effect

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