Personal project · Open source

Hevy Coach MCP

I built an MCP server that connects an AI assistant to my workouts in Hevy. The server calculates the metrics; the assistant uses those results to analyse progress.

Interactive example / Fictional data

Where does that number come from?

“Has my bench press improved?” Inspect the records behind the answer. Then remove some data and see what can still be calculated.

This example runs in your browser, without a Hevy connection or an AI model. It illustrates the project’s calculation rules.

Change in estimated strength

+8.3 %

The best estimate in session B is higher. This is a comparison of two sessions, not a long-term trend.

Session A76 kg
Session B82.3 kg

Epley estimate (e1RM). Not a measured maximum or a recommended load.

Inspect the data and calculation
Session A · bench press
SetkgRepse1RM
160876 kg
260774 kg
360672 kg
Session B · bench press
SetkgRepse1RM
165882.3 kg
265780.2 kg
365678 kg

Epley · weight × (1 + reps / 30)

For example: 60 × (1 + 8 / 30) = 76 kg. We take the highest valid estimate from each session, then calculate (B − A) / A × 100. Values are rounded only for display.

See the project’s calculation (opens in a new tab)

The problem: giving the assistant reliable context

Hevy stores workouts, routines and body measurements. I wanted to analyse that history with an assistant without copying records by hand or relying on it to do the maths. I used Model Context Protocol (MCP) to connect the conversation to tools that query the API and calculate progress, volume and consistency.

The decision: query and calculate before interpreting

The server queries Hevy and performs the calculations. The MCP client receives the results and brings them into the conversation. This lets me check the formulas independently and distinguish the calculation from the assistant’s interpretation.

  • Hevy API: workouts, routines, exercises and measurements.
  • MCP server: separate tools for reading records, calculating metrics and making changes.
  • MCP client: conversation, interpretation and authorisation controls.

There is no local cache or workout database, avoiding a second copy that needs synchronisation. The trade-off is depending on the API’s availability, latency and limits for every query.

What the assistant can change

The project can create and update routines, create folders and log body measurements. It does not write to workout history, which is the basis of its calculations.

Tools carry read or write annotations for the MCP client. These help the client decide when to ask for confirmation; they are not, by themselves, a server-enforced guarantee of consent.

Hevy API keys do not offer granular permissions. It is therefore important to distinguish what the credential allows from the operations this server exposes.

When a failed request may have succeeded

An HTTP error does not always mean an operation did not happen. If a creation reaches Hevy but the response fails, repeating it can create a duplicate. The integration has no delete operation to compensate for this. That constraint changes how writes are prepared and executed.

  • Resolve exercise names before creating a routine. When creating a routine, all exercise names are resolved first. If one is unknown or ambiguous, the tool returns the problem without sending an incomplete routine.
  • Use different retry rules for reads and writes. The client allows bounded retries for 5xx responses on reads, but not on writes. It handles 429 responses separately. Returning an error is preferable to risking a duplicate creation.
  • Read before updating. When the API replaces an entire record, omitting fields can erase them. The tool retrieves the existing state: it preserves unspecified measurements and, when renaming a routine, its exercises’ rest times and rep ranges. Explicitly replacing the exercises remains a destructive operation.

Reading and writing are separate operations: another client could change the record between them. These checks reduce specific risks, but do not guarantee that each operation runs exactly once.

Missing data does not mean zero progress

The calculation engine receives data and returns results without calling the API. This makes it possible to check formulas against known inputs and keep interpretation separate from arithmetic. To estimate one-rep max, sets without valid weight or reps are excluded; if no set qualifies, the result is null. A single bodyweight measurement does not become a trend either.

Filling these gaps with zeros would produce a seemingly more complete answer, but would confuse missing information with a measured result. The assistant must be able to say it has insufficient data.

The tests cover ambiguous names, field preservation, retries and sets without enough valid data for a calculation. They check the server’s rules against controlled inputs; Hevy’s availability and the assistant’s responses need separate checks.

Try it with your workout history

With a Hevy PRO account and an API key configured in a compatible client, you can start by checking the connection and comparing two periods:

Check the connection to Hevy. Compare workout count and volume over the last four weeks with the previous four. Explain which data you used and what you cannot conclude. 

You can adapt this query to your own history. The repository guide explains how to connect the server and which tools are available.

Read the connection guide (opens in a new tab)

What I wanted to get right

Connecting an external API to an assistant means deciding where calculations happen, how to handle missing data and which changes to allow. Those decisions are in the code and tests: they are the part of this project I most want to share.

Public code and tests reviewed on 27 September 2026. Technical links point to commit c3a2326 so the decisions described remain verifiable.