Skip to main content
Glama
README.md
# strava-coach-mcp

> Talk to Claude about your runs. Get AI coaching from your actual Strava data.

![Python](https://img.shields.io/badge/python-3.10+-blue) ![MCP](https://img.shields.io/badge/MCP-server-orange) ![License](https://img.shields.io/badge/license-MIT-green) ![Strava](https://img.shields.io/badge/Strava-free%20API-FC4C02)

---

## What is this?

`strava-coach-mcp` is a [Model Context Protocol](https://modelcontextprotocol.io/) server that connects your Strava account to Claude Desktop. Once set up, you can ask Claude anything about your training — no dashboards, no exports, just chat.

```
You:    How was my training this week?

Claude: You ran 3 times this week — 38.4 km total. Your Tuesday tempo run
        was your strongest (5:12/km avg pace). Volume is up 18% vs last week.
        Consider an easy recovery run before your next hard effort.

You:    What should I focus on next month based on my recent runs?

Claude: Based on your last 4 weeks: your aerobic base looks solid but long
        run distance has stagnated at ~14 km. I'd suggest one progressive
        long run per week, targeting 90 min by end of month. Your pace has
        improved 8 seconds/km over the period — keep the easy days easy.
```

**No Strava Premium required.** The Strava API is free for all registered users.

---

## Tools exposed to Claude

| Tool | Description |
|------|-------------|
| `get_recent_runs` | Last N runs with pace, HR, elevation, distance |
| `get_weekly_stats` | Total km, time, avg pace for any week |
| `get_monthly_stats` | Monthly mileage with week-by-week breakdown |
| `get_coaching_summary` | Structured training load for AI coaching analysis |
| `get_athlete_profile` | Your Strava profile and all-time run totals |

---

## Setup — ~5 minutes, one time

### 1. Create a free Strava API app

Go to [strava.com/settings/api](https://www.strava.com/settings/api) and create an app.

- **Application Name**: anything (e.g. `My Coach`)
- **Category**: Data Importer
- **Authorization Callback Domain**: `localhost`

Copy your **Client ID** and **Client Secret**.

### 2. Clone and install

```bash
git clone https://github.com/supreetsingh672/strava-coach-mcp.git
cd strava-coach-mcp
pip install -e .
```

### 3. Configure credentials

```bash
cp .env.example .env
```

Edit `.env`:
```
STRAVA_CLIENT_ID=your_client_id_here
STRAVA_CLIENT_SECRET=your_client_secret_here
```

### 4. Authorize with Strava (one time only)

```bash
python scripts/auth.py
```

This opens your browser, you click **Authorize**, and your tokens are saved locally at `~/.strava_coach_tokens.json`. The server auto-refreshes tokens after that — you never need to do this again.

### 5. Add to Claude Desktop

Edit your Claude Desktop config file:

- **macOS**: `~/Library/Application Support/Claude/claude_desktop_config.json`
- **Windows**: `%APPDATA%\Claude\claude_desktop_config.json`

```json
{
  "mcpServers": {
    "strava-coach": {
      "command": "python",
      "args": ["/absolute/path/to/strava-coach-mcp/src/strava_coach/server.py"]
    }
  }
}
```

Replace `/absolute/path/to/strava-coach-mcp` with your actual path. On Mac you can find it by running `pwd` inside the project folder.

### 6. Restart Claude Desktop

That's it. You should see `strava-coach` appear in Claude's tools. Start chatting.

---

## Example prompts

```
How was my training this week?
Show me my mileage for the last 4 weeks
Am I overtraining? Compare this week to last week
What should my focus be next month based on my recent runs?
How has my pace improved over the last 30 days?
Give me a coaching plan for next week based on my current load
What was my longest run this month?
How many km did I run in March vs February?
```

---

## Project structure

```
strava-coach-mcp/
├── src/
│   └── strava_coach/
│       ├── server.py       # MCP server + all tool definitions
│       ├── strava.py       # Strava API client + token refresh
│       └── __init__.py
├── scripts/
│   └── auth.py             # One-time OAuth setup
├── .env.example
├── requirements.txt
├── setup.py
└── README.md
```

---

## Privacy

- Tokens are stored locally on your machine only (`~/.strava_coach_tokens.json`)
- No data is sent anywhere except Strava's API and Claude (via MCP)
- The `.gitignore` ensures `.env` and token files are never committed

---

## Contributing

PRs welcome. Ideas for next features:

- [ ] Segment performance tracking
- [ ] Race predictor (5K/10K/half marathon)
- [ ] Heart rate zone breakdown
- [ ] Shoe mileage tracker
- [ ] Compare to same period last year

---

## License

MIT — see [LICENSE](LICENSE)

---

Built by [@supreetsingh672](https://github.com/supreetsingh672)