Strava MCP Server
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.
README
Strava MCP Server
A Model Context Protocol (MCP) server that integrates with the Strava API, allowing AI assistants to access your Strava fitness data.
Features
- Fetch athlete profile and statistics
- List and query activities
- Access segment data and efforts
- Explore segments by geographic area
- View starred segments
Prerequisites
- Node.js 18 or higher
- A Strava account
- Strava API credentials (Client ID and Client Secret)
Installation
- Clone this repository:
git clone https://github.com/juanlarreapm/strava-mcp-server.git
cd strava-mcp-server
- Install dependencies:
npm install
- Build the project:
npm run build
Strava API Setup
Before using this server, you need to create a Strava API application:
- Go to https://www.strava.com/settings/api
- Create a new application
- Set the Authorization Callback Domain to
localhost - Note your Client ID and Client Secret
Getting OAuth Tokens
Run the authentication setup script to obtain your access tokens:
node setup-auth.cjs
This will:
- Prompt you for your Client ID and Client Secret
- Open a browser for Strava authorization
- Display your access token, refresh token, and other credentials
Keep these credentials secure - you'll need them to configure the MCP server.
Configuration
The server requires the following environment variables:
STRAVA_ACCESS_TOKEN- Your Strava access token (required)STRAVA_REFRESH_TOKEN- Your refresh token (optional, for token renewal)STRAVA_CLIENT_ID- Your Strava application Client ID (optional)STRAVA_CLIENT_SECRET- Your Strava application Client Secret (optional)
For Claude Desktop
Add this to your Claude Desktop MCP settings file:
macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
Windows: %APPDATA%\Claude\claude_desktop_config.json
{
"mcpServers": {
"strava": {
"command": "node",
"args": ["/path/to/strava-mcp-server/dist/index.js"],
"env": {
"STRAVA_ACCESS_TOKEN": "your_access_token_here",
"STRAVA_REFRESH_TOKEN": "your_refresh_token_here",
"STRAVA_CLIENT_ID": "your_client_id_here",
"STRAVA_CLIENT_SECRET": "your_client_secret_here"
}
}
}
}
For Other MCP Clients
Create a .env file in the project root (see .env.example):
STRAVA_ACCESS_TOKEN=your_access_token_here
STRAVA_REFRESH_TOKEN=your_refresh_token_here
STRAVA_CLIENT_ID=your_client_id_here
STRAVA_CLIENT_SECRET=your_client_secret_here
Available Tools
The server exposes the following tools:
get_athlete_profile
Get the authenticated athlete's profile information.
get_athlete_stats
Get detailed statistics including totals and recent activity counts.
list_activities
List recent activities with optional pagination and time filtering.
Parameters:
before(number): Unix timestamp to get activities before this timeafter(number): Unix timestamp to get activities after this timepage(number): Page number (default: 1)per_page(number): Items per page (default: 30, max: 200)
get_activity
Get detailed information about a specific activity.
Parameters:
id(string, required): The activity IDinclude_all_efforts(boolean): Include all segment efforts
get_segment
Get information about a specific segment.
Parameters:
id(string, required): The segment ID
list_starred_segments
List segments starred by the athlete.
Parameters:
page(number): Page numberper_page(number): Items per page
explore_segments
Explore segments in a geographic area.
Parameters:
bounds(string, required): Coordinates assw_lat,sw_lng,ne_lat,ne_lngactivity_type(string): Eitherrunningorridingmin_cat(number): Minimum climb category (0-5)max_cat(number): Maximum climb category (0-5)
get_segment_efforts
Get efforts on a specific segment.
Parameters:
segment_id(string, required): The segment IDstart_date_local(string): ISO 8601 formatted start dateend_date_local(string): ISO 8601 formatted end dateper_page(number): Items per page
Development
Build
npm run build
Watch mode
npm run watch
Run locally
npm start
Token Expiration
Strava access tokens expire after 6 hours. To handle token refresh:
- Store your refresh token securely
- Implement token refresh logic using the Strava OAuth token endpoint
- Or run
setup-auth.cjsagain to get fresh tokens
Rate Limits
Strava API has rate limits:
- 100 requests per 15 minutes
- 1000 requests per day
Plan your usage accordingly.
Troubleshooting
"STRAVA_ACCESS_TOKEN environment variable is required"
Make sure you've set the access token in your MCP configuration or environment variables.
"Strava API error: 401"
Your access token may have expired. Run setup-auth.cjs to get a new token.
"Authorization Callback Domain" error
Ensure you've set the callback domain to localhost in your Strava API settings.
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
License
MIT License - see LICENSE file for details
Resources
推荐服务器
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 模型以安全和受控的方式获取实时的网络信息。