stravamcp
by didikz
README.md
# stravamcp
Single-user Strava MCP server on Cloudflare Workers. Connects one Strava account and exposes read-only athlete, activity, route, segment, stream, and gear data through the Model Context Protocol.
## Tools
| Tool | Description |
| --- | --- |
| `list_activities` | Recent activities with optional sport_type / commute filters |
| `get_activity` | Activity detail by id or id_str |
| `get_activity_streams` | Time-series streams by key |
| `get_activity_zones` | HR and power time-in-zone distribution |
| `summarize_activity_streams` | Compact summary; full arrays stay on the server |
| `get_athlete` | Connected athlete profile |
| `get_athlete_stats` | YTD, recent, and all-time totals |
| `get_athlete_zones` | HR / power zone ranges |
| `list_athlete_routes` | Saved routes |
| `get_route` | Route detail by id_str |
| `list_starred_segments` | Starred segments |
| `get_segment` | Segment detail by id |
| `list_segment_efforts` | Your efforts on a segment |
| `get_gear` | Bike / shoe detail by id |
IDs are accepted as strings (`id_str`) or numbers. Use `id_str` for routes and any large id to avoid JavaScript 64-bit precision loss.
## Local setup
1. Copy the env template and fill in the credentials:
```sh
cp .dev.vars.example .dev.vars
```
2. Apply the local D1 migration:
```sh
npx wrangler d1 migrations apply stravamcp
```
3. Start the dev server:
```sh
npm run dev
```
Local MCP endpoint: `http://localhost:8787/mcp`
`GET /` serves a landing page describing the server and its tools.
## Cloudflare deployment
1. Create a Strava API app at `https://www.strava.com/settings/api`.
2. Set the Authorization Callback Domain to your domain, e.g. `stravamcp.didiktrisusanto.dev`.
3. Apply the remote migration and secrets:
```sh
npx wrangler d1 migrations apply stravamcp --remote
npx wrangler secret put STRAVA_CLIENT_ID
npx wrangler secret put STRAVA_CLIENT_SECRET
npx wrangler secret put MCP_SECRET
npx wrangler secret put SETUP_TOKEN
npx wrangler deploy
```
Generate random secrets with `openssl rand -hex 32`.
4. Connect the Strava account once:
```text
https://stravamcp.didiktrisusanto.dev/authorize?token=<SETUP_TOKEN>
```
5. Use the MCP endpoint with `MCP_SECRET`:
```json
{
"url": "https://stravamcp.didiktrisusanto.dev/mcp",
"headers": {
"Authorization": "Bearer <MCP_SECRET>"
}
}
```
## Verification
```sh
npm run typecheck
npm test
npx wrangler deploy --dry-run
```
Cache entries expire by TTL. No write tools or webhooks are enabled.
This server cannot be deployed
Maintenance
ActivityMaintained
ResponsivenessNo issues