Skip to main content
Glama
Strava MCP Server
by judepd
README.md
# Strava MCP Server

Minimal [Model Context Protocol](https://modelcontextprotocol.io/) server for Strava.

This project connects to Strava using OAuth and exposes athlete/activity tools over MCP stdio transport.

## Strava API Notes

This implementation uses Strava's official APIs:

- Authorization URL: `https://www.strava.com/oauth/authorize`
- Token exchange / refresh: `POST https://www.strava.com/oauth/token`
- API base: `https://www.strava.com/api/v3`

Core endpoints used:

- `GET /athlete`
- `GET /athlete/activities`
- `GET /activities/{id}`
- `GET /activities/{id}/streams`

Docs:

- [Strava Authentication](https://developers.strava.com/docs/authentication/)
- [Strava API Reference](https://developers.strava.com/docs/reference/)

## Exposed MCP Tools

- `strava_get_authorize_url`
- `strava_check_connection`
- `strava_get_athlete`
- `strava_list_activities`
- `strava_get_activity`
- `strava_get_activity_streams`

## Prerequisites

- Node.js 20+
- A Strava API application ([create one here](https://www.strava.com/settings/api))

## Setup

```bash
cp .env.example .env
npm install
```

Set required values in `.env`:

- `STRAVA_CLIENT_ID`
- `STRAVA_CLIENT_SECRET`
- `STRAVA_REFRESH_TOKEN` (recommended), or `STRAVA_ACCESS_TOKEN` + `STRAVA_EXPIRES_AT`

To get a refresh token for the first time:

1. Use `strava_get_authorize_url` and open the URL.
2. Approve scopes and copy the returned `code` query parameter.
3. Exchange code for tokens:

```bash
curl -X POST https://www.strava.com/oauth/token \
  -d client_id="$STRAVA_CLIENT_ID" \
  -d client_secret="$STRAVA_CLIENT_SECRET" \
  -d code="AUTHORIZATION_CODE" \
  -d grant_type="authorization_code"
```

## Development

```bash
npm run dev
```

## Build + Run

```bash
npm run build
npm start
```

## Use with Codex CLI

1. Build the server:

```bash
npm run build
```

2. Add this MCP server to Codex:

```bash
codex mcp add strava \
  --env STRAVA_CLIENT_ID=YOUR_CLIENT_ID \
  --env STRAVA_CLIENT_SECRET=YOUR_CLIENT_SECRET \
  --env STRAVA_REFRESH_TOKEN=YOUR_REFRESH_TOKEN \
  -- node /absolute/path/to/strava-mcp/dist/index.js
```

3. Verify configuration:

```bash
codex mcp list
codex mcp get strava
```

4. Remove it later if needed:

```bash
codex mcp remove strava
```

## Use with another MCP client

Example MCP server config:

```json
{
  "mcpServers": {
    "strava": {
      "command": "node",
      "args": ["/absolute/path/to/strava-mcp/dist/index.js"],
      "env": {
        "STRAVA_CLIENT_ID": "YOUR_CLIENT_ID",
        "STRAVA_CLIENT_SECRET": "YOUR_CLIENT_SECRET",
        "STRAVA_REFRESH_TOKEN": "YOUR_REFRESH_TOKEN"
      }
    }
  }
}
```

## Create GitHub Project

From the `strava-mcp` folder:

```bash
git init
git add .
git commit -m "Initial Strava MCP server"
gh repo create strava-mcp --public --source=. --remote=origin --push
```

If you do not use GitHub CLI:

1. Create an empty repo in GitHub UI.
2. Add remote and push:

```bash
git remote add origin git@github.com:<your-org-or-user>/strava-mcp.git
git branch -M main
git push -u origin main
```

TDQS

B3.2/5.0

Scored across 6 tools

Disambiguation3/5

Most tools target distinct operations (auth URL, activity list, activity detail, streams). However, strava_check_connection and strava_get_athlete both retrieve the authenticated athlete profile, creating genuine overlap an agent could misselect between. The descriptions hint at the difference (auth validation vs. profile fetch) but the boundary is fuzzy.

Naming Consistency5/5

All six tools follow a consistent snake_case strava_verb_noun pattern with a uniform server prefix. Verb choices (get, list, check) are predictable and readable.

Tool Count5/5

Six tools is well-scoped for a focused Strava read integration; each tool earns its place with no filler. The surface is compact and coherent.

Completeness3/5

Read coverage is solid (auth, profile, list/detail activities, streams) but the surface is entirely read-only — no activity upload, update, deletion, athlete stats, or segment endpoints. These are notable gaps for a Strava integration, though agents can still accomplish common read workflows.

Maintenance

ActivityInactive
ResponsivenessNo recent community issues