claudex-strava-mcp
Connects Claude to your Strava fitness data, enabling natural language queries about your training history such as activities, stats, and routes.
README
claudex-strava-mcp
A Model Context Protocol (MCP) server that connects Claude to your Strava fitness data. Ask Claude questions about your real training history in plain English — no dashboards, no manual exports.
Built with TypeScript, the MCP SDK, and Zod schema validation. Automatic OAuth token refresh included.
What you can ask Claude
- "How many walks did I do this month?"
- "Where were my last 3 activities?"
- "How do my 2025 and 2026 activity counts compare?"
- "Which of my activities had the most stop time?"
- "Am I hitting my Zone 2 training targets?"
Prerequisites
- Node.js 18+
- A Strava account with activities
- A Strava API app (create one here)
- Claude Desktop (or any MCP-compatible client)
Setup
1. Clone and install
git clone https://github.com/your-username/claudex-strava-mcp
cd claudex-strava-mcp
npm install
2. Create your Strava API app
Go to strava.com/settings/api and create an app. Set the Authorization Callback Domain to localhost.
You'll receive a Client ID and Client Secret — keep these safe.
3. Get your refresh token
Copy the example env file and fill in your Client ID and Secret:
cp .env.example .env
# Edit .env and add your STRAVA_CLIENT_ID and STRAVA_CLIENT_SECRET
Then run the OAuth helper:
npx tsx scripts/get-token.ts
This will:
- Print an authorization URL — open it in your browser
- Ask you to authorize the app on Strava
- Redirect to localhost and exchange the code for tokens
- Print your
STRAVA_REFRESH_TOKENin the terminal
Copy the printed refresh token into your .env:
STRAVA_CLIENT_ID=your_client_id
STRAVA_CLIENT_SECRET=your_client_secret
STRAVA_REFRESH_TOKEN=your_refresh_token
4. Build the server
npm run build
This compiles TypeScript to dist/.
5. Configure Claude Desktop
Add the following to your Claude Desktop config 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/claudex-strava-mcp/dist/index.js"],
"env": {
"STRAVA_CLIENT_ID": "your_client_id",
"STRAVA_CLIENT_SECRET": "your_client_secret",
"STRAVA_REFRESH_TOKEN": "your_refresh_token"
}
}
}
}
Restart Claude Desktop. The Strava tools will appear in Claude's tool list.
Project structure
claudex-strava-mcp/
├── src/
│ ├── index.ts # MCP server entry point
│ ├── strava-client.ts # Strava API client with auto token refresh
│ └── tools.ts # 8 MCP tool definitions (Zod-validated)
├── scripts/
│ └── get-token.ts # One-time OAuth token helper
├── .env.example # Template — copy to .env and fill in values
├── .gitignore
├── package.json
└── tsconfig.json
Available tools
| Tool | Description |
|---|---|
get_athlete_profile |
Your Strava profile and preferences |
get_athlete_stats |
All-time, YTD, and recent totals by sport |
list_activities |
Paginated activity list with date filters |
get_activity |
Detailed stats for a single activity |
get_activity_laps |
Lap-by-lap breakdown |
get_activity_zones |
Heart rate zone distribution |
list_routes |
Your saved routes |
get_route |
Detailed route info |
How it works
The server uses the MCP SDK's McpServer class and registers tools using Zod schemas for runtime validation. The Strava client handles OAuth token refresh automatically — if your access token is within 60 seconds of expiring, it refreshes using your stored refresh token before making any API call.
Claude prompt
│
▼
MCP Tool Layer (TypeScript)
│
├── list_activities ──► GET /athlete/activities
├── get_activity ──► GET /activities/{id}
├── get_activity_zones ► GET /activities/{id}/zones
└── ...
│
▼
Strava API
│
▼
Structured JSON → Claude reasons → Natural language response
Development
npm run dev # Watch mode — recompiles on save
npm run build # Production build
npm start # Run compiled server
Security notes
- Never commit your
.envfile — it's in.gitignore - Rotate your Strava client secret at strava.com/settings/api if it's ever exposed
- The OAuth scopes requested are
read,activity:read_all, andprofile:read_all— read-only access only
License
MIT
Built by Mostafa Didar Mahdi — Data Scientist, Anthropic-certified AI practitioner, Adelaide.
推荐服务器
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 模型以安全和受控的方式获取实时的网络信息。