strava-mcp
Exposes your Strava data to Claude, enabling training load analysis, activity comparison, and lap splits via conversation.
README
strava-mcp
A Model Context Protocol (MCP) server that exposes your Strava data to Claude. Ask Claude about your training load, compare blocks, dig into lap splits, or analyze activity streams — all from a conversation.
Prerequisites
- Node.js 18+
- A Strava account with activities
- A Strava API application (free to create)
Strava API setup
- Go to strava.com/settings/api and create an application.
- Note your Client ID and Client Secret.
- Obtain an access token and refresh token using Strava's OAuth flow. The simplest way:
- Visit
https://www.strava.com/oauth/authorize?client_id=YOUR_CLIENT_ID&response_type=code&redirect_uri=http://localhost&approval_prompt=force&scope=read,activity:read_all - Authorize the app and copy the
codefrom the redirect URL. - Exchange it for tokens:
curl -X POST https://www.strava.com/oauth/token \ -d client_id=YOUR_CLIENT_ID \ -d client_secret=YOUR_CLIENT_SECRET \ -d code=YOUR_CODE \ -d grant_type=authorization_code - The response contains
access_token,refresh_token, andexpires_at.
- Visit
Installation
git clone https://github.com/your-username/strava-mcp.git
cd strava-mcp
npm install
Configuration
cp .env.example .env
Edit .env with your credentials:
STRAVA_CLIENT_ID=your_client_id
STRAVA_CLIENT_SECRET=your_client_secret
STRAVA_ACCESS_TOKEN=your_access_token
STRAVA_REFRESH_TOKEN=your_refresh_token
STRAVA_TOKEN_EXPIRES_AT=1234567890 # unix timestamp from token exchange
DEBUG=false # set to "true" for verbose stderr logging
Tokens are held in memory only and auto-refreshed before expiry. Nothing is written back to .env.
Build & run
npm run build # compile TypeScript → build/
npm start # start the MCP server on stdio
For development without a build step:
npm run dev
Claude Desktop integration
Add this server to your Claude Desktop config (~/Library/Application Support/Claude/claude_desktop_config.json on macOS):
{
"mcpServers": {
"strava": {
"command": "node",
"args": ["/absolute/path/to/strava-mcp/build/index.js"],
"env": {
"STRAVA_CLIENT_ID": "your_client_id",
"STRAVA_CLIENT_SECRET": "your_client_secret",
"STRAVA_ACCESS_TOKEN": "your_access_token",
"STRAVA_REFRESH_TOKEN": "your_refresh_token",
"STRAVA_TOKEN_EXPIRES_AT": "0"
}
}
}
}
Restart Claude Desktop after saving.
Available tools
Athlete
| Tool | Description |
|---|---|
get_athlete |
Profile: name, location, weight, FTP, membership type |
get_athlete_stats |
Activity totals (recent / YTD / all-time) for rides, runs, swims |
get_athlete_zones |
Heart rate and power training zones from your Strava settings |
Activities
| Tool | Description |
|---|---|
list_activities |
Recent activities with optional date range and count cap |
get_activity |
Full detail for a single activity by ID |
get_activity_laps |
Lap splits (pace, HR, power) for a single activity |
get_activity_zones |
HR and power zone distributions for a single activity (Strava Summit required) |
search_activities |
Filter recent activities by name keyword and/or sport type |
Analysis
| Tool | Description |
|---|---|
analyze_training_load |
Volume, time, elevation, and weekly breakdown over a date range |
compare_training_blocks |
Side-by-side comparison of two training periods with deltas |
get_training_timeseries |
Week-by-week or day-by-day volume trend over a date range |
get_activity_streams |
Raw sensor data (HR, pace, power, altitude, cadence) with summary stats |
Example prompts
- "How many miles did I run last month?"
- "Compare my training in January vs February."
- "Show me the lap splits for my last long run."
- "What was my average heart rate trend over the past 12 weeks?"
- "Find all my rides over 50 miles this year."
Project structure
src/
index.ts — MCP server entry point
types.ts — TypeScript interfaces and error classes
utils.ts — Unit conversion helpers (imperial: miles, min/mile, feet)
logger.ts — Debug logger (writes to stderr only)
token-manager.ts — In-memory OAuth token lifecycle (refresh, expiry)
strava-client.ts — Authenticated HTTP client with pagination
tools/
athlete.ts — Athlete profile and stats tools
activities.ts — Activity listing and detail tools
analysis.ts — Training load and trend analysis tools
Notes
- Units: All display values are imperial (miles, min/mile, feet). Strava's metric API values are converted via
utils.ts. - Rate limits: Strava enforces 100 requests/15 min and 1,000/day. Tools that fetch large date ranges may hit these limits.
- Pagination: The client handles pagination automatically; pass
maxItemsto cap results. - Logging: Debug output goes to stderr only, so it never corrupts the MCP stdout stream. Enable with
DEBUG=true.
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 模型以安全和受控的方式获取实时的网络信息。