fitness-mcp
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@fitness-mcp How hard was my last ride, and am I fresh or fatigued?"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
fitness-mcp
An MCP server and analyzer that lets an LLM answer questions about cycling power data: "How hard was Saturday's ride?", "Am I fresh or fatigued?", "How did this week compare to last?"
All bundled data is synthetic, produced by a seeded generator. No real athlete data is included anywhere in this repository.

Problem
Ride files are raw 1 Hz streams of watts and heart rate. An LLM cannot reliably compute normalized power from 4,000 numbers pasted into a prompt, and it should not have to. This project parses the files, computes the standard training-science metrics deterministically (NP, IF, TSS, and the CTL/ATL/TSB fitness model), and exposes the results as small, typed MCP tools so the model reasons over answers, not streams.
Related MCP server: igpsport-mcp
Architecture
flowchart LR
Files["Ride files<br/>GPX / JSON / CSV / FIT"] --> Parsers["parsers.py"]
Synth["synth.py<br/>seeded generator"] -.writes.-> Files
Parsers --> Activity["Activity model<br/>(parallel streams)"]
Activity --> Metrics["metrics.py<br/>NP / IF / TSS / CTL-ATL-TSB"]
Metrics --> Service["service.py<br/>analysis API"]
Service --> MCP["server.py<br/>MCP tools (stdio)"]
Service --> CLI["cli.py<br/>chart / list / generate"]
MCP --> Client["Claude Desktop,<br/>Claude Code, any MCP client"]
CLI --> PNG["training-load.png"]Quickstart (under 2 minutes)
Requires Python 3.13.
git clone <this repo> fitness-mcp && cd fitness-mcp
python3.13 -m venv .venv && source .venv/bin/activate
pip install -e ".[dev]" # add ",fit" for FIT file support
pytest -q # 32 tests
fitness-cli list | head # NP / IF / TSS per ride
fitness-cli chart --out chart.png
fitness-mcp # starts the MCP server on stdioRegister with an MCP client (example for Claude Code):
claude mcp add fitness -- /absolute/path/to/fitness-mcp/.venv/bin/fitness-mcpConfiguration is by environment variable: FITNESS_MCP_DATA (directory of ride files,
default is the bundled samples) and FITNESS_MCP_FTP (watts, default 250).
Tools
Tool | Purpose |
| Rides with duration, NP, IF, TSS. Use first to discover ids. |
| NP, IF, TSS, variability index, best 5/20 min, HR, elevation. |
| CTL, ATL, TSB per day plus a |
| Side-by-side metrics and deltas. |
| Mon-Sun totals, week-over-week TSS change, end-of-week form. |
Input formats
GPX:
trkptwithtime,ele, and<extensions><power>/<hr>.JSON:
{"name", "start", "interval_s", "power": [...], "heart_rate": [...]}.CSV:
# name:,# start:,# interval_s:header lines, thenpower,heart_rate,altitudecolumns.FIT: via the optional
fitparseextra. Parsing is implemented but not covered by a test fixture (no FIT writer is available to generate a synthetic one).
Regenerate the samples with fitness-cli generate --out data/samples (deterministic, seed
20260101).
Metrics
Metric | Definition |
NP | 4th-root of the mean of the 4th power of the 30 s rolling average power |
IF | NP / FTP |
TSS | duration_s x NP x IF / (FTP x 3600) x 100 (one hour at FTP = 100) |
CTL / ATL | Exponentially weighted daily TSS, time constants 42 and 7 days |
TSB | CTL - ATL from the end of the previous day |
Tests include known values: one hour at FTP is exactly 100 TSS, 75% FTP for an hour is 56.25, the NP of an aligned 100/300 W square wave is 253.04, a single 100 TSS day yields CTL = 100 x (1 - e^(-1/42)), and a long constant load converges to CTL = ATL = that load.
Design decisions
Logic lives in
service.py, not in the MCP layer. The server and CLI are thin wrappers, so everything is testable without a protocol client, and a second transport is cheap. One test still drives the real server through an in-memory MCP client.Compute in code, return small JSON. Tools return rounded summaries rather than raw streams, keeping tool results small and the numbers exact.
Sample interval aware. The NP window is
round(30 / interval_s)samples, so 5 s sampling (used for the bundled data to keep the repo small) and 1 Hz data both work. Real files with dropped samples are treated as uniformly spaced, a deliberate simplification.Standard definitions, stated assumptions. TSB uses the previous day's CTL/ATL, the model is seeded at zero on the first ride (early values understate fitness), and FTP is a parameter, never inferred.
Windowing never resets the model.
training_load(days=28)integrates from the first ride and then slices, so recent values are not distorted by the window.Synthetic-only data, deterministic generator. Safe to publish, reproducible, and rides are structured (sweet spot, VO2, group-ride surges) so the metrics are meaningful.
mcp2.x (MCPServer). Pinned to>=2.3,<3; the olderFastMCPimport path was removed in 2.x.No cache invalidation beyond file mtimes. Parsed activities are cached per directory keyed on file names and mtimes; enough for a local single-user server.
Development
ruff check . && ruff format --check . && pytest -qLicense
MIT
Available Tools
5 toolsactivity_summaryC
Detailed metrics for one ride: NP, IF, TSS, VI, best 5/20 min power, HR, elevation.
Inputs: activity_id (required), ftp.
compare_activitiesB
Side-by-side metrics for two rides, with deltas (b minus a).
Inputs: activity_id_a (required), activity_id_b (required), ftp.
list_activitiesB
List rides (newest last) with NP, IF and TSS. since is an ISO date (YYYY-MM-DD).
Inputs: ftp, limit, since. Returns: result
training_loadC
Fitness (CTL), fatigue (ATL) and form (TSB) for the last days days.
Inputs: ftp, days.
weekly_reportB
Totals for the Mon-Sun week containing week_start (default: latest ride's week).
Inputs: ftp, week_start.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 5 tools
Each tool targets a clearly distinct output: activity listing, single-activity detail, multi-day load trends, pairwise comparison, and weekly aggregation. Overlap between training_load and weekly_report is minimal because one is a rolling CTL/ATL/TSB window and the other is calendar-week totals.
All names use consistent snake_case and are readable, but the verb pattern is mixed: list_ and compare_ are verbs while activity_summary, training_load, and weekly_report are noun phrases. The deviation is minor and does not impede selection.
Five tools is well-scoped for a fitness analytics server, with each tool covering a distinct analytical need. There is no obvious filler or missing high-level operation at this count.
The surface covers core ride analysis: listing, detail, load trends, comparison, and weekly totals. Minor gaps exist around activity streams, segments, or goal tracking, but the stated metrics-focused purpose is well served.
Maintenance
Related MCP Connectors
Convert, validate, and inspect workout files (FIT, TCX, ZWO, Garmin Connect) for AI agents.
tri-train is a training platform for triathletes that syncs activities from Strava and Garmin and exposes them to Claude through a remote MCP server. Ask Claude how your last block went, why your run pace dropped, or whether you are fresh enough for Sunday's race, and it answers from your real data: activities with laps and grade-adjusted pace, weekly load and the performance management chart (CTL/ATL/TSB), sleep, HRV and resting heart rate, and your race calendar with predictions. Claude can also act: create and adjust planned workouts with structured intervals, push them to your Garmin watch, add races and write notes. Every change is journaled and can be undone. Read and write access are separate OAuth scopes, and the server enforces them on every call. Built and hosted in Switzerland by a triathlete; data stays on our own servers (Swiss revDSG / GDPR).
Your own cycling data for your AI assistant: rides, power, climbs and routes. Read-only.
Ask your AI about your fitness: activities and data from Garmin, COROS, Strava, GPX and more
Related MCP Servers
- AlicenseNot gradedqualityCmaintenanceEnables querying workouts, fitness metrics (CTL/ATL/TSB), and power personal records from TrainingPeaks using natural language.2MIT
- AlicenseAqualityDmaintenanceAnalyze iGPSport cycling data with natural language, computing derived training metrics (NP, IF, TSS, CTL, ATL, TSB) locally via MCP.836 PyPI8MIT
- FlicenseNot gradedqualityDmaintenanceEnables LLMs to access and analyze biometric and training data via MCP, supporting queries on sleep, performance, nutrition, and training load to generate adaptive training insights.-
- AlicenseAqualityCmaintenanceMCP server that lets you ask questions about your Garmin training history in plain language. It ingests FIT files into DuckDB locally and exposes typed tools for analyzing activities, streams, and summaries.9MIT