Strava MCP Server
Connects Claude or any MCP client to the Strava API v3, enabling access to fitness data such as activities, athletes, clubs, segments, routes, and streams.
README
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 |
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
- Go to https://www.strava.com/settings/api
- Create a new application:
- Application Name: anything (e.g. "MCP Server")
- Category: choose any
- Website:
http://localhost - Authorization Callback Domain:
localhost
- 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
- Open the Inspector URL shown in the terminal
- Click Connect
- Go to the Tools tab
- Try running a tool like
get_athlete_profileorget_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
- Open ChatGPT Desktop app
- Go to Settings > MCP
- Add a new server with:
- Name:
strava - Command:
uv run strava_server.py - Working directory:
/path/to/strava-mcp-server
- Name:
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:
- Your
.envfile exists in the project root - All three variables are set (
STRAVA_CLIENT_ID,STRAVA_CLIENT_SECRET,STRAVA_REFRESH_TOKEN) - 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, streamsactivity:write— needed for creating/updating activitiesprofile:read_all— needed for athlete zonesprofile: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
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。