Skip to main content
Glama
Strava MCP Server
by gcoombe

Strava MCP Server

A Model Context Protocol (MCP) server for integrating with the Strava API. This server provides comprehensive access to all major Strava API endpoints including activities, athlete data, routes, segments, clubs, and gear.

Transport Modes

This server supports two transport modes per the MCP specification:

Mode

Command

Auth

Use Case

stdio

npm start

Environment tokens

Claude Desktop (single user)

HTTP

npm run start:http

OAuth + JWT

ChatGPT, REST clients (multi-user)

Related MCP server: Strava MCP Server

Features

Activity Management

  • Get athlete activities with filters (date range, pagination)

  • Get detailed activity information

  • Create, update, and delete activities

  • Access activity streams (GPS, heart rate, power, cadence, etc.)

  • Get activity comments and kudos

Athlete Data

  • Get authenticated athlete profile

  • Get athlete statistics and totals

  • Get athlete zones (heart rate and power)

Routes

  • Get athlete routes

  • Get detailed route information

Segments

  • Get starred segments

  • Get segment details

  • Get segment leaderboards with filters

  • Explore segments in geographic areas

Clubs & Social

  • Get athlete clubs

  • Get club details and members

  • Get club activities

Gear

  • Get detailed gear information

Prerequisites

  • Node.js 18+ (LTS recommended)

  • A Strava account

  • Strava API credentials (Client ID and Client Secret)

Installation

  1. Clone this repository:

git clone https://github.com/gcoombe/strava-mcp.git
cd strava-mcp
  1. Install dependencies:

npm install
  1. Copy the example environment file:

cp .env.example .env
  1. Build the project:

npm run build

Strava API Setup

1. Create a Strava Application

  1. Go to Strava API Settings

  2. Create a new application

  3. Fill in the required information:

    • Application Name: Your app name

    • Category: Choose appropriate category

    • Website: Can use http://localhost for testing

    • Authorization Callback Domain: Use localhost for local testing, or your domain for production

  4. Note your Client ID and Client Secret

  5. Add them to your .env file

2. Choose Your Transport Mode

stdio Mode (Claude Desktop)

For single-user use with Claude Desktop:

# Run the interactive setup to get your personal tokens
npm run setup

# Start the server
npm start

The setup script will guide you through the OAuth flow and save tokens to .env.

HTTP Mode (Multi-user)

For multi-user deployments (ChatGPT, REST clients):

# Add HTTP-specific variables to .env:
# OAUTH_CLIENT_ID=<generate with: openssl rand -hex 16>
# OAUTH_CLIENT_SECRET=<generate with: openssl rand -hex 16>
# JWT_SECRET=<generate with: openssl rand -base64 32>
# STRAVA_REDIRECT_URI=http://localhost:3000/auth/strava/callback

# Start the HTTP server
npm run start:http

Users authenticate via OAuth at /auth/authorize and receive a JWT for API access.

ChatGPT Configuration

To use with ChatGPT:

  1. Generate OAuth credentials for your .env:

    echo "OAUTH_CLIENT_ID=$(openssl rand -hex 16)"
    echo "OAUTH_CLIENT_SECRET=$(openssl rand -hex 16)"
  2. Expose your server via ngrok or deploy publicly:

    ngrok http 3000
  3. In ChatGPT, configure your MCP server with:

    • Server URL: https://your-ngrok-url.ngrok-free.dev

    • OAuth Client ID: Value from your .env

    • OAuth Client Secret: Value from your .env

ChatGPT will automatically discover the OAuth endpoints via /.well-known/oauth-authorization-server.

MCP Configuration (stdio Mode)

Claude Desktop

Add this to your Claude Desktop configuration file:

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

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

HTTP API Reference

When running in HTTP mode (npm run start:http), the following endpoints are available:

OAuth 2.0 Endpoints

Endpoint

Method

Description

/.well-known/oauth-authorization-server

GET

OAuth server metadata (RFC 8414)

/auth/authorize

GET

OAuth authorization endpoint (redirects to Strava)

/auth/callback

GET

Internal OAuth callback from Strava

/auth/token

POST

Exchange authorization code for JWT

/auth/me

GET

Get current athlete info (requires JWT)

/auth/logout

POST

Revoke tokens (requires JWT)

Tools

Endpoint

Method

Auth

Description

/tools

GET

-

List all available tools

/tools/:name

GET

-

Get tool schema

/tools/:name

POST

JWT

Execute a tool

Example Usage

# Start the server
npm run start:http

# For ChatGPT: Configure with your server URL and OAuth credentials
# ChatGPT will handle the OAuth flow automatically

# For manual testing with curl:
# 1. List tools (no auth required)
curl http://localhost:3000/tools

# 2. After completing OAuth flow, use the JWT for API calls
TOKEN="your-jwt-token"

# Get athlete profile
curl -X POST http://localhost:3000/tools/get_athlete \
  -H "Authorization: Bearer $TOKEN"

# Get recent activities
curl -X POST http://localhost:3000/tools/get_activities \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"per_page": 10}'

Available Tools

Activities

  • get_activities - List athlete activities with filters

  • get_activity - Get detailed activity information

  • create_activity - Create a new manual activity

  • update_activity - Update an existing activity

  • delete_activity - Delete an activity

  • get_activity_streams - Get activity data streams

  • get_activity_comments - Get activity comments

  • get_activity_kudos - Get activity kudos

Athlete

  • get_athlete - Get authenticated athlete profile

  • get_athlete_stats - Get athlete statistics

  • get_athlete_zones - Get athlete training zones

Routes

  • get_routes - List athlete routes

  • get_route - Get route details

Segments

  • get_starred_segments - List starred segments

  • get_segment - Get segment details

  • get_segment_leaderboard - Get segment leaderboard

  • explore_segments - Explore segments in an area

Clubs

  • get_athlete_clubs - List athlete clubs

  • get_club - Get club details

  • get_club_members - Get club members

  • get_club_activities - Get club activities

Gear

  • get_gear - Get gear details

Environment Variables

Variable

Required

Mode

Description

STRAVA_CLIENT_ID

Yes

Both

Strava API client ID

STRAVA_CLIENT_SECRET

Yes

Both

Strava API client secret

STRAVA_ACCESS_TOKEN

Yes

stdio

User's access token

STRAVA_REFRESH_TOKEN

Yes

stdio

User's refresh token

STRAVA_EXPIRES_AT

Yes

stdio

Token expiration timestamp

OAUTH_CLIENT_ID

Yes

HTTP

OAuth client ID for ChatGPT (you create this)

OAUTH_CLIENT_SECRET

Yes

HTTP

OAuth client secret for ChatGPT (you create this)

JWT_SECRET

Yes

HTTP

Secret for signing JWTs

JWT_EXPIRES_IN

No

HTTP

JWT expiration (default: 7d)

STRAVA_REDIRECT_URI

Yes

HTTP

OAuth callback URL

DATABASE_PATH

No

HTTP

SQLite path (default: ./data/strava-mcp.db)

HTTP_PORT

No

HTTP

Server port (default: 3000)

Development

Scripts

  • npm run build - Build the TypeScript project

  • npm run dev - Watch mode for development

  • npm run lint - Lint the codebase

  • npm test - Run tests

  • npm start - Start MCP server (stdio mode)

  • npm run start:http - Start HTTP server

  • npm run setup - Interactive OAuth setup

Project Structure

strava-mcp/
├── src/
│   ├── index.ts              # Entry point (mode selection)
│   ├── auth.ts               # Strava OAuth handling
│   ├── strava-client.ts      # Strava API client
│   ├── http-server.ts        # Express HTTP server
│   ├── create-tools.ts       # Tool initialization
│   ├── db.ts                 # SQLite database (HTTP mode)
│   ├── auth/                 # HTTP auth module
│   │   ├── jwt.ts            # JWT utilities
│   │   ├── middleware.ts     # Auth middleware
│   │   └── routes.ts         # OAuth endpoints
│   ├── types/
│   │   └── strava.ts         # TypeScript definitions
│   ├── tools/                # MCP tool implementations
│   │   ├── activities.ts
│   │   ├── athlete.ts
│   │   ├── routes.ts
│   │   ├── segments.ts
│   │   ├── clubs.ts
│   │   └── gear.ts
│   └── utils/
│       └── data-reducer.ts   # Response optimization
├── data/                     # SQLite database (HTTP mode)
├── package.json
├── tsconfig.json
├── .env.example
└── README.md

Token Refresh

The server automatically refreshes access tokens when they expire:

  • stdio mode: Tokens are refreshed in memory

  • HTTP mode: Refreshed tokens are persisted to SQLite

Rate Limiting

Strava has rate limits:

  • 100 requests per 15 minutes

  • 1,000 requests per day

The server does not currently implement rate limiting, so use responsibly.

Troubleshooting

"No tokens available" error (stdio mode)

  • Ensure all STRAVA_* environment variables are set in .env

  • Run npm run setup to obtain new tokens

"JWT_SECRET required" error (HTTP mode)

  • Add JWT_SECRET to your .env file

  • Generate one with: openssl rand -base64 32

"No tokens found for user" error (HTTP mode)

  • User needs to re-authenticate at /auth/strava

  • Tokens may have been revoked by Strava

"Failed to refresh token" error

  • Your refresh token may have been revoked

  • Go through the OAuth flow again to get new tokens

Build errors

  • Ensure you're using Node.js 18+ LTS

  • Run npm install to ensure all dependencies are installed

License

MIT

Resources

Available Tools

22 tools
create_activityC

Create a new manual activity

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

delete_activityC

Delete an activity

Inputs: id (required).

explore_segmentsC

Explore segments in a geographic area

Inputs: bounds (required), activity_type, min_cat, max_cat.

get_activitiesA

Get logged-in athlete activities with optional filters. Use minimal=true for large datasets to reduce context usage.

Inputs: before, after, page, per_page, +1 more.

get_activityB

Get detailed information about a specific activity by ID. Use minimal=true to reduce context usage.

Inputs: id (required), include_all_efforts, minimal.

get_activity_commentsC

Get comments for an activity

Inputs: id (required), page, per_page.

get_activity_kudosC

Get kudos for an activity

Inputs: id (required), page, per_page.

get_activity_streamsC

Get activity streams (GPS, heart rate, power, cadence, etc.)

Inputs: id (required), keys, key_by_type.

get_athleteB

Get the authenticated athlete profile

Inputs: no named parameters.

get_athlete_clubsC

Get clubs the authenticated athlete belongs to

Inputs: page, per_page.

get_athlete_statsC

Get athlete statistics (totals and recent activities)

Inputs: athlete_id (required).

get_athlete_zonesB

Get athlete zones (heart rate and power zones)

Inputs: no named parameters.

get_clubC

Get detailed information about a specific club

Inputs: id (required).

get_club_activitiesC

Get recent activities from club members

Inputs: id (required), page, per_page.

get_club_membersC

Get members of a club

Inputs: id (required), page, per_page.

get_gearB

Get detailed information about a specific piece of gear (bike, shoes, etc.)

Inputs: id (required).

get_routeC

Get detailed information about a specific route

Inputs: id (required).

get_routesC

Get athlete routes

Inputs: athlete_id (required), page, per_page.

get_segmentC

Get detailed information about a specific segment

Inputs: id (required).

get_segment_leaderboardC

Get segment leaderboard with optional filters

Inputs: id (required), gender, age_group, weight_class, +5 more.

get_starred_segmentsC

Get athlete starred segments

Inputs: page, per_page.

update_activityC

Update an existing activity

Inputs: id (required), commute, trainer, hide_from_home, +5 more.

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 22 tools

    Disambiguation5/5

    Every tool has a clearly distinct purpose targeting specific resources (activities, athlete, clubs, gear, routes, segments) and actions (get, create, update, delete, explore). There is no overlap or ambiguity between tools, making it easy for an agent to select the correct one.

    Naming Consistency5/5

    All tools follow a consistent verb_noun pattern (e.g., get_activity, create_activity, update_activity) with no deviations. The naming is uniform throughout, using snake_case and clear action-resource combinations.

    Tool Count4/5

    With 22 tools, the count is slightly high but reasonable for the Strava domain, which covers activities, athlete data, clubs, gear, routes, and segments. It provides comprehensive coverage without being excessive, though it borders on the heavy side.

    Completeness5/5

    The tool set offers complete CRUD/lifecycle coverage for key resources like activities (create, get, update, delete) and extensive read operations for athlete, clubs, gear, routes, and segments. There are no obvious gaps, supporting full agent workflows in the Strava ecosystem.

    Maintenance

    ActivityInactive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      B
      quality
      D
      maintenance
      Integrates with the Strava API to allow AI assistants to access fitness data including athlete profiles, activity history, and segment statistics. It enables users to query detailed performance metrics and explore geographic segment data through natural language commands.
      8
      125 npm
      MIT
    • A
      license
      B
      quality
      D
      maintenance
      Enables users to interact with their Strava data through natural language to analyze workouts, track fitness progress, and explore routes. It supports retrieving detailed activity stats, heart rate data, and segment insights directly within AI assistants.
      26
      538 npm
      MIT
    • A
      license
      B
      quality
      D
      maintenance
      Connects Claude to the Strava API to provide direct access to fitness data, including athlete statistics, detailed activity logs, and time-series performance metrics. It enables users to analyze training progress, compare workouts, and retrieve specific segment details through natural language queries.
      8
      125 npm
      ISC