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
116 stars

The Strava MCP Server provides a bridge between Large Language Models and the Strava API, allowing AI assistants to access and interact with your Strava data through the Model Context Protocol (MCP) standard. With this server, you can query your activities, analyze workout data, manage segments, and export routes - all through natural language conversations.

Installation & Setup

Prerequisites

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

Installing 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
    

Configuring 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)
    • Set "Authorization Callback Domain" to localhost
    • Note down your Client ID and Client Secret

Run the Setup Script

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.

Configuring Export Path (Optional)

If you want to use the route export tools, specify a directory for saving exported files:

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

# Example: ROUTE_EXPORT_PATH=/Users/your_username/strava-exports
ROUTE_EXPORT_PATH=

Replace the placeholder with the absolute path to your desired export directory.

Usage Examples

Querying Recent Activities and Profile

You can ask questions like:

  • "Show me my recent Strava activities."
  • "What were my last 3 rides?"
  • "Get my Strava profile information."
  • "What's my Strava username?"

Analyzing Activity Data

For detailed workout analysis:

  • "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?"
  • "Show me the elevation profile for my Mt. Diablo climb."

Viewing Statistics

To see your performance stats:

  • "What are my running stats for this year on Strava?"
  • "How far have I cycled in total?"
  • "Show me my all-time swim totals."

Managing Segments

For segment exploration and management:

  • "List the segments I starred near Boulder, Colorado."
  • "Show my favorite segments."
  • "Get details for the 'Alpe du Zwift' segment."
  • "Find challenging climbs near Boulder's Flagstaff Mountain."
  • "Star the 'Flagstaff Road Climb' segment for me."

Working with Routes

For route management and export:

  • "List my saved Strava routes."
  • "What is the elevation gain for my Boulder Loop route?"
  • "Export my 'Boulder Loop' route as a GPX file."
  • "Save my Sunday morning route as a TCX file."

Advanced Features

Token Handling

The server implements automatic token refreshing. When the initial access token expires (typically after 6 hours), the server will automatically use the refresh token to obtain new tokens, ensuring continuous operation.

Activity Streams

You can retrieve detailed time-series data for deep analysis:

Get the power and heart rate streams from my last ride with high resolution.

This allows you to analyze specific metrics throughout your activity, perfect for visualizing performance or identifying patterns.

Activity Laps

For structured workouts, you can analyze lap data:

Show me the laps from my interval training yesterday. What was my average heart rate for each interval?

This helps you understand performance variations across different segments of your workout.

Available Tools

The server provides numerous tools including:

  • get-recent-activities: Fetches your recent Strava activities
  • get-athlete-profile: Retrieves your profile information
  • get-athlete-stats: Shows activity statistics
  • get-activity-details: Gets details for a specific activity
  • get-activity-streams: Retrieves time-series data (heart rate, power, etc.)
  • explore-segments: Searches for segments in a geographical area
  • list-athlete-routes: Shows your saved routes
  • export-route-gpx/export-route-tcx: Exports routes to GPX/TCX format

Each tool is designed to work seamlessly with natural language queries through your AI assistant.

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