Table of contents

Add secure integrations to your products and AI agents with ease via Merge.
Get a demo

How to connect a Strava MCP with Claude Code (4 steps)

Jon Gitlin
Senior Content Marketing Manager
at Merge

Developers building training analysis tools, coaching platforms, or AI fitness agents need that activity history to make any useful recommendations.

But accessing it means wiring up OAuth 2.0 per user, storing access tokens securely, handling Strava's token expiration, and writing API clients before a single agent tool can be invoked.

To help your developers easily pull activity data, athlete profiles, and segment efforts from their terminal, we'll show you how to connect Strava with Merge Agent Handler's Strava MCP server.

How it works

Merge Agent Handler connects Claude Code to the Strava API through a single CLI setup.

You install the Merge CLI, authenticate once with your Merge Agent Handler account, and register the connection with one command.

Merge handles Strava's per-user OAuth tokens and credential storage on your behalf, so you never write token refresh logic or manage authorization state across athlete accounts.

Here's the command that registers the connection:

claude mcp add 
--transport http agent-handler https://ah-api.merge.dev/mcp

Prerequisites

Before getting started, you'll need the following:

  • A Merge Agent Handler account
  • Claude Code installed (run claude --version to confirm)
  • pipx installed (run pipx --version to confirm, or install via pip install pipx)
  • A Strava account with API access (register your application at developers.strava.com to obtain a client ID and secret)

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 with pipx: pipx install merge-api

How to add pipx install merge-api in Claude Code

Then verify the installation: merge --version

Related: How to use the WHOOP MCP in Claude Code

2. Configure the CLI and log in

Run the interactive setup: merge configure

This prompts you for your Merge API key and sets your default workspace preferences, linking the CLI to your Merge Agent Handler account.

Then login: merge login

Once you log in, the CLI can make authorized API requests on your behalf.

3. Add Agent Handler to Claude Code

Register the Agent Handler MCP server with Claude Code:

claude mcp add 
--transport http agent-handler https://ah-api.merge.dev/mcp

Open Claude Code and run: /mcp

agent-handler should appear under Local MCPs with a connected status.

Verifying the connection registered

4. Authenticate Strava

Select agent-handler from the MCP list.

This opens a browser window where you select which integrations to authenticate. Choose Strava and complete the OAuth flow. Merge stores and manages the credentials going forward, including token refresh, so your connection stays live without any maintenance on your end.

The first time you use a Strava tool in a Claude Code session, a Magic Link may appear to complete connector authentication.

Strava auth UI

Once authenticated, you won't need to re-authenticate unless you revoke access.

To confirm the connector is accessible, open a Claude Code session and run a command like "Pull my last 10 activities from Strava and show me distance, average pace, and total elevation gain for each."

You should see an output that looks like the following:

Example of using Strava's MCP in Claude Code

{{this-blog-only-cta}}

Strava MCP FAQ

In case you have more questions on setting up and using the Strava MCP in Claude Code, we've addressed several more commonly-asked questions below.

What can you do once the Strava MCP is connected to Claude Code?

With Strava connected, Claude Code can:

  • Retrieve the authenticated athlete's profile: access activity totals, personal bests, follower and following counts, and account-level stats without opening the Strava UI
  • List recent and historical activities: fetch activity records with distance, moving time, elapsed time, average pace, average heart rate, and elevation gain, enabling agents to analyze training history over any time window
  • Get full activity details: pull granular data for a specific activity including lap splits, zone distributions, gear used, and device metadata, useful for post-workout analysis agents
  • Fetch starred segments: retrieve the segments an athlete has bookmarked as personal benchmarks, letting agents surface performance on key routes without enumerating all segments
  • Query segment efforts: pull an athlete's effort history on a specific segment with elapsed times and achievement ranks, enabling agents to track progress toward PRs over a training block
  • Access club activities: retrieve the activity feed from clubs the athlete belongs to, useful for team coaching tools or group performance dashboards

Why use Merge Agent Handler vs. building directly on the Strava API?

You can build directly on Strava's REST API. The API is well-documented, the OAuth 2.0 flow is standard, and for a single-athlete prototype the initial setup is straightforward: register an application at developers.strava.com, complete the authorization flow, and start making requests.

The challenge arrives when you support multiple users.

Strava issues short-lived access tokens paired with refresh tokens. Every connected athlete needs their own token pair, their own refresh cycle, and their own error handling for expired or revoked credentials. A failed refresh silently breaks data access for that athlete, and at dozens of users you're tracking token health across every active account with no centralized visibility into which connections are functioning.

A self-hosted MCP server on top of Strava's API doesn't change any of that.

You still own the OAuth plumbing, and now you're also maintaining the MCP server itself. Strava doesn't offer an official MCP server, so the only alternatives beyond Merge are community-built implementations with no guarantees on coverage, maintenance cadence, or enterprise-grade access controls.

Merge Agent Handler handles credential storage and token refresh for all connected athletes. You can scope exactly which Strava tools a given agent can call: a training summary agent, for example, can get list_activities and get_activity, but never reach segment leaderboard tools unless those tools are explicitly included.

Merge Agent Handler also logs every tool call with the timestamp, tool name, and inputs. For fitness applications where athletes are trusting an agent with personal performance data, that combination of scoped access and full audit logging is the difference between a responsible deployment and an uncontrolled one.

Why connect Strava to Claude Code?

Strava holds the structured performance data that makes fitness agents genuinely useful: timestamped activity records with pace, distance, heart rate, power output, elevation, and split data going back years. For developers building coaching tools, wellness platforms, or AI training assistants, this is the ground truth that any recommendation has to be anchored to.

Today, working with that data in development means switching between the Strava API docs, a token management layer, and whatever analysis environment you're writing against.

With the Strava MCP connected, Claude Code can query activity history, pull segment efforts, and cross-reference training load directly from the terminal.

This matters most when Strava data drives a downstream step: calculating fatigue based on recent mileage, generating a weekly training summary, flagging a performance regression ahead of a target race, or building a readiness score that accounts for both load and sleep.

Jon Gitlin
Senior Content Marketing Manager
@Merge

Jon Gitlin is the Managing Editor of Merge's blog. He has several years of experience in the integration and automation space; before Merge, he worked at Workato, an integration platform as a service (iPaaS) solution, where he also managed the company's blog. In his free time he loves to watch soccer matches, go on long runs in parks, and explore local restaurants.

Read more

How to connect a BambooHR MCP with Claude Code (4 steps)

MCP gateway: how it works, benefits, and solutions

AI

How to connect Google Sheets MCP with Claude Code (4 steps)

AI

Subscribe to the Merge Blog

Get stories from Merge straight to your inbox

Subscribe

Connect Claude Code to thousands of tools with Merge Agent Handler

Use Merge Agent Handler’s 150+ connectors (including Strava) to power reliable, secure, and powerful agents.

Get started for free
But Merge isn’t just a Unified 
API product. Merge is an integration platform to also manage customer integrations.  gradient text
But Merge isn’t just a Unified 
API product. Merge is an integration platform to also manage customer integrations.  gradient text
But Merge isn’t just a Unified 
API product. Merge is an integration platform to also manage customer integrations.  gradient text
But Merge isn’t just a Unified 
API product. Merge is an integration platform to also manage customer integrations.  gradient text