Table of contents
How to connect a Strava MCP with Codex (4 steps)

Developers building fitness or wellness features on top of Strava need to understand real user behavior before writing the feature logic.
Actual activity patterns, training loads, and performance data are what determine whether a workout progress chart is accurate, whether a leaderboard algorithm ranks athletes correctly, or whether a goal-recommendation engine produces targets that reflect how people actually train.
Without live Strava data, Codex generates code against assumed patterns that may not reflect how athletes actually use the platform. The result is a progress visualization built on synthetic fixtures, a periodization module that doesn't account for real training variability, or a maintenance-alert feature calibrated to imaginary gear usage rather than what athletes actually log.
To give Codex direct access to Strava as it works through your coding tasks, we'll show you how to connect Strava with Merge Agent Handler's Strava MCP server.
How it works
Merge Agent Handler connects Codex to the Strava API through the Merge CLI. You install the CLI, authenticate once, and run a single setup command from your project root.
That command writes a Merge CLI section to your project's AGENTS.md file, which tells Codex when to call merge search-tools and merge execute-tool to reach Strava.
Once connected, Merge handles OAuth token storage and refresh on your behalf, so you never embed Strava credentials in your repo or manage per-athlete authorization state yourself.
Related: How to use the Strava MCP in Claude Code
Prerequisites
Before getting started, you'll need the following:
- A Merge Agent Handler account
- Codex access (available via the OpenAI platform)
- pipx installed (run
pipx --versionto confirm, or install viapip install pipx) - A Strava account with API access (register your application at
developers.strava.com)
If you want to connect Merge Agent Handler's Strava MCP with internal or customer-facing agentic products, you can follow the steps in our docs.
1. Install the Merge CLI
Install the CLI with pipx: pipx install merge-api
Verify the installation: merge --version
2. Log in to Merge
Run the following to authenticate the CLI with your Merge Agent Handler account: merge login
This links the CLI to your Merge account and stores your session credentials locally.
3. Add Agent Handler to Codex
From the root of the project where you want Codex to have access to Strava, run:
This writes a Merge CLI section to your project's AGENTS.md file so Codex knows to use the CLI when a task requires Strava data. The command is idempotent, safe to re-run if you need to reset the configuration.
Commit the updated AGENTS.md so the configuration travels with the repo.
Related: A guide to integrating the Strava MCP with Cursor
4. Authenticate Strava
Create a Codex task that requires live Strava data. This can be something like: "Read this athlete's activity history for the past 90 days and generate a workout progress visualization component that plots weekly mileage and average pace over time."
The first time Codex invokes a Strava tool, a Magic Link will appear to complete connector authentication.

Once authenticated, Codex has access to your Strava account through Merge for all subsequent tasks in this project.
{{this-blog-only-cta}}
Strava MCP FAQ
In case you have more questions on setting up and using the Strava MCP with Codex, we've addressed several more commonly-asked questions below.
What can you do once the Strava MCP is connected to Codex?
With Strava connected, Codex can:
- Read an athlete's real activity history before generating a workout progress visualization: pull the actual mileage, pace, and load data from recent months so the visualization component reflects how the athlete actually trains, not a synthetic curve built from assumed progressions
- Pull club activity data before generating a leaderboard algorithm: fetch the real activity feed from a club to understand the distribution of distances, paces, and activity types so the ranking logic handles edge cases that only show up in real usage, like multi-sport entries or outlier efforts
- Read a real athlete's segment PRs before generating a goal-recommendation engine: retrieve the athlete's personal records on their starred segments so the recommended targets are calibrated to their actual baseline performance rather than population averages
- Pull gear usage records before generating a maintenance-alert feature: fetch the gear data attached to recent activities to understand how distance accumulates per shoe or bike in practice, so the alert thresholds and trigger logic reflect real usage patterns
- Read training notes from recent activities before generating a periodization analysis module: retrieve the description and perceived exertion notes logged in actual activity records so the periodization module accounts for how the athlete self-reports recovery and intensity, not just what the metrics show
Why use Merge Agent Handler vs. a self-hosted Strava MCP server?
You can build a self-hosted MCP server on top of Strava's API. For a solo developer working against a single account, the setup is workable: register an application at developers.strava.com, handle the OAuth flow, and write tool schemas for the endpoints your Codex tasks need.
The self-hosted path breaks down when you're supporting multiple athletes or running Codex tasks in CI.
Strava issues short-lived access tokens paired with refresh tokens, and every connected athlete needs their own token pair, their own refresh cycle, and their own handling for revoked credentials. There's no central visibility into which connections are active, and a silent refresh failure means a Codex task silently runs against stale or unavailable data.
A self-hosted MCP server doesn't change any of that. You still own the OAuth plumbing, and now you're also maintaining the server itself. Strava doesn't publish an official MCP server, so community implementations come with no guarantees on endpoint coverage or maintenance cadence.
Merge Agent Handler handles credential storage and token refresh across all connected athletes. You can control exactly which Strava operations each Codex task can reach, and every tool call is logged with the identity, timestamp, and inputs.
For fitness applications where athletes trust an agent with personal performance data, that combination of scoped access and full audit logging is the right foundation.
Why connect Strava to Codex?
Strava holds years of structured training data per athlete: timestamped activity records, gear histories, segment PRs, club feeds, and athlete-authored notes.
Codex tasks that generate training features, analytics dashboards, or coaching logic need that data to produce accurate, grounded code.
The alternative is describing the data in the task prompt. Developer descriptions of training data are always incomplete: they omit the edge cases, underspecify the distributions, and miss the behavioral patterns that only become visible in real records.
Codex writes against the description, not the data, and the feature reflects what the developer imagined rather than what athletes actually do.
Connecting Strava gives Codex the ability to pull the actual records when a task requires them. The activity history before generating a progress chart, the gear logs before generating a maintenance trigger, the segment PRs before generating goal targets: Codex reads the source rather than a summary of it. The output is grounded in how the platform is actually used.
Can I use Merge Agent Handler's Strava MCP with my employees?
Yes, Agent Handler for Employees is built to help organizations provision, secure, and govern how employees connect AI tools like Codex to fitness and activity platforms like Strava.
Common patterns include:
- Provisioning and access control via SCIM with identity providers like Okta and Microsoft Entra ID, so IT can manage which developers can access which athlete accounts or club data by role or team
- DLP and policy enforcement on tool calls, so admins can restrict which activity data or athlete records a Codex task can retrieve, and block queries that would return sensitive health or biometric data before results reach the agent's context
- User-level audit logging so security and IT teams can review which activity records were accessed, which athlete profiles were queried, and which Strava data was used, by which employee identity, and when
In practice, employees can use the Strava MCP to generate training analytics features, build goal-recommendation logic from real segment data, and produce coaching modules grounded in actual athlete behavior, while IT keeps centralized control over which data each developer's agent can reach.
.png)
.png)


.jpg)
.png)