@openpets/strava
v1.0.3
Published
Access your Strava data including activities, segments, clubs, and routes. View workout stats, analyze performance, and interact with the Strava community.
Downloads
19
Maintainers
Readme
Strava Pet
Access your Strava data including activities, segments, clubs, and routes. View workout stats, analyze performance, and interact with the Strava community.
Quick Start
1. Create a Strava API Application
- Go to https://www.strava.com/settings/api
- Create a new API application (or use existing)
- Note your Client ID and Client Secret
2. Get Your Access Token
For quick testing, copy the "Your Access Token" shown on your API settings page.
For production use, implement the OAuth flow:
- Redirect user to:
https://www.strava.com/oauth/authorize?client_id=YOUR_CLIENT_ID&redirect_uri=YOUR_CALLBACK&response_type=code&scope=read,activity:read_all - Exchange the code for tokens at:
POST https://www.strava.com/oauth/token
3. Configure Environment
Copy .env.example to .env and fill in your credentials:
cp .env.example .env# Required
STRAVA_ACCESS_TOKEN=your_access_token_here
# Optional (for auto-refresh)
STRAVA_REFRESH_TOKEN=your_refresh_token_here
STRAVA_CLIENT_ID=your_client_id_here
STRAVA_CLIENT_SECRET=your_client_secret_here4. Test Connection
opencode run "test strava connection"Available Tools
Core Tools (Always Loaded)
| Tool | Description |
|------|-------------|
| strava-test-connection | Test API connection |
| strava-get-logged-in-athlete | Get your athlete profile |
| strava-get-stats | Get athlete statistics |
| strava-get-logged-in-athlete-zones | Get heart rate/power zones |
| strava-get-logged-in-athlete-activities | List your activities |
| strava-get-activity-by-id | Get activity details |
| strava-create-activity | Create manual activity |
| strava-update-activity-by-id | Update an activity |
| strava-get-laps-by-activity-id | Get activity laps |
| strava-get-zones-by-activity-id | Get activity zones |
| strava-get-comments-by-activity-id | Get activity comments |
| strava-get-kudoers-by-activity-id | Get activity kudos |
| strava-get-activity-streams | Get activity data streams |
| strava-refresh-token | Refresh OAuth access token |
Optional Tool Groups
Enable with environment variables:
# Segments
STRAVA_LOAD_SEGMENTS_TOOLS=true
# → strava-get-segment-by-id, strava-explore-segments, strava-star-segment, etc.
# Segment Efforts
STRAVA_LOAD_SEGMENTEFFORTS_TOOLS=true
# → strava-get-efforts-by-segment-id, strava-get-segment-effort-by-id
# Clubs
STRAVA_LOAD_CLUBS_TOOLS=true
# → strava-get-club-by-id, strava-get-club-members-by-id, etc.
# Gear
STRAVA_LOAD_GEARS_TOOLS=true
# → strava-get-gear-by-id
# Routes
STRAVA_LOAD_ROUTES_TOOLS=true
# → strava-get-route-by-id, strava-get-route-as-g-p-x, strava-get-route-as-t-c-x
# Uploads
STRAVA_LOAD_UPLOADS_TOOLS=true
# → strava-create-upload, strava-get-upload-by-id
# Streams (additional)
STRAVA_LOAD_STREAMS_TOOLS=true
# → strava-get-segment-streams, strava-get-route-streams, etc.Example Queries
# Get your profile
opencode run "get my strava athlete profile"
# List recent activities
opencode run "list my recent strava activities"
# Get activity details
opencode run "get strava activity 12345678"
# Get your stats
opencode run "get my strava stats for athlete ID 12345"
# Create a manual activity
opencode run "create a strava activity: 5k run, 25 minutes, today at 8am"Token Refresh
Strava access tokens expire every 6 hours. To enable automatic refresh:
- Set all four environment variables (access token, refresh token, client ID, client secret)
- Use the
strava-refresh-tokentool when you get auth errors - Update your
.envwith the new tokens returned
opencode run "refresh my strava token"OAuth Scopes
| Scope | Access |
|-------|--------|
| read | Read public data |
| read_all | Read all private data |
| activity:read | Read activities |
| activity:read_all | Read all activities including private |
| activity:write | Create/update activities |
| profile:read_all | Read all profile info |
| profile:write | Update profile |
Rate Limits
- 200 requests per 15 minutes
- 2,000 requests per day
FAQ
Q: Why does my token expire? A: Strava access tokens are only valid for 6 hours. Set up refresh token support for automatic renewal.
Q: What scopes do I need?
A: For read-only access: read,activity:read. For full access: read_all,activity:read_all,activity:write.
Q: How do I get activity streams?
A: Use strava-get-activity-streams with the activity ID and specify which data streams you want (time, distance, heartrate, etc.).
