dotworkout
Builds, validates, and inspects Apple Watch .workout files for the Workout app, supporting 14 activity types with warm-ups, cool-downs, repeats, time/distance goals, and heart-rate, pace, power, and cadence alerts. Hosted links can be opened on iPhone to save workouts into Fitness and sync them to the Watch.
This server has a remotely hosted endpoint. Open its connector listing for connection details, authentication requirements, and setup instructions:
dotworkout
An MCP server that lets Claude, ChatGPT and other agents build custom Apple
Watch workouts. Describe the session in plain language and get back a
.workout file the Workout app actually accepts.
Make me a Norwegian 4×4 — four by four minutes in zone 4 with three minute jogs between. Use dotworkout.
Rather build it yourself? The same workouts can be made by hand in the browser app at https://workout.javierferrersb.dev.
Connect it
Hosted, for anything that cannot run a process — a phone, ChatGPT, or Claude in a browser. Add this as a custom connector; there is nothing to install and no account to make:
https://mcp.javierferrersb.dev/mcpIn Claude that is Settings → Connectors → Add custom connector. In ChatGPT it is Settings → Apps → Advanced → Developer mode.
Local, for Claude Code and other clients
that can spawn one. npx fetches it on first run:
claude mcp add -s user dotworkout -- npx -y @dotworkout/mcp-s user registers it everywhere rather than in the current directory only.
Related MCP server: TrainingPeaks MCP Server
Ask for a workout
End the request with use dotworkout so the model reaches for the tools rather than answering from memory:
Build me a swimming pyramid workout and save it to my desktop. Use dotworkout.
8×50 on 1:00 with the last four as build, then 4×100 on 2:00. Use dotworkout.
What targets does an indoor cycle actually support? Build me a 45 minute session using them. Use dotworkout.
All fourteen activities the Workout app offers custom workouts for — swimming, running, cycling, rowing, HIIT, strength, yoga and the rest — with warm ups, cool downs, repeats, time and distance goals, and heart-rate, pace, power and cadence alerts.
Getting it onto your Watch
Hosted, the server returns a link with the workout encoded inside it. Open it on your iPhone and tap Save the workout; it lands in the Fitness app and syncs to the Watch. Nothing is uploaded and nothing is stored — the link is the workout.
Run locally, it writes the file to a path you give it and prints a QR code that opens the same link on your phone.
The privacy policy covers both the composer and the hosted server.
Why it works
A model cannot write this format from memory. It is undocumented binary protobuf, and nothing says which goals and alerts each sport allows — ask for a power target on a swim and the Watch rejects the file. So the server gives the agent the real answers instead of letting it guess:
Tool | Does |
| Every activity with the goals and alerts it supports |
| One activity in detail, including unverified combinations |
| Check a workout and say exactly what is wrong |
| Build a |
| Decode an existing workout and describe it |
The activity rules were read off a real device and live in
constraints/compatibility.json. The format
itself was worked out from 20 real exports, all of which decode with zero
unknown fields and re-encode byte for byte — details in
spec/FORMAT.md.
Every tool, the client quirks, and how to host your own copy on Cloudflare's
free plan are in packages/mcp/README.md.
Build one by hand in the browser
https://workout.javierferrersb.dev — free, no account, nothing to install. It is also where the server's links open.
Pick a sport and the workout opens as a list of steps — warm up, sets, rests, cool down — under a strip that draws the session's shape. Each step takes a distance or a time, repeats, rest, and a heart-rate, pace, cadence or power target, and only what the Watch supports for that sport is offered.
It is built for the keyboard. S adds a set, each choice is one letter and
Enter moves to the next field, so 8 × 400 m with 90 seconds' rest in zone 4 is
S D 400m 8 90 H Z 4. On a phone every step is a tap.
Download the file on your iPhone and it opens in the Fitness app, or send it
there as a link or a QR code. The workout travels inside the link and nothing
is uploaded. Install the page as an app and it works offline. More in
packages/pwa/README.md.
Using the libraries directly
The server and the app sit on two TypeScript packages you can use on their own.
Package | What it does |
| The MCP server. |
| The browser app. Runs entirely on the client. Not published. |
| Builds and validates workouts. Uses the codec. |
| Decodes and encodes the binary format. Nothing else. |
| Parses sets written as text, like |
npm install @dotworkout/domainThat pulls in the codec. Install @dotworkout/codec on its own if all you want
is to read and write files.
Writing a workout
import { swim } from "@dotworkout/domain";
const bytes = swim("Thursday threshold")
.warmup(400)
.repeat(8)
.of(50)
.rest(30)
.label("Build")
.repeat(4)
.of(100)
.on("2:00")
.cooldown(200)
.toBytes();.on("2:00") is the DISTANCE_TIME goal: leave every two minutes no matter how
fast you finish. Most swim sets are written this way. Only swimming offers it.
Reading and editing one
import { decode, encode } from "@dotworkout/codec";
import { editStepAt, totalDistance } from "@dotworkout/domain";
const workout = decode(bytes);
const totals = totalDistance(workout.customWorkout!);
const edited = editStepAt(
workout,
"custom_workout.interval_blocks[0].interval_steps[0].workout_step",
(step) => {
step.displayName = "Build (fins)";
},
);
encode(edited);Everything you did not touch comes back byte for byte.
Commands
npm testBuilds the packages and runs the suite on Node's test runner. Also:
npm run build— TypeScript only.npm run generate— regenerate the protobuf bindings fromproto/and the compatibility data fromconstraints/compatibility.json. Both outputs are checked in, so a normal build needs neither protoc nor the buf CLI.npm run check— regenerate, then build and test.
Releasing
The Worker at mcp.javierferrersb.dev deploys itself from main once the tests
pass. The npm package goes out in three steps:
In a PR, run
npm version <x.y.z> --workspace @dotworkout/mcp --no-git-tag-versionand setVERSIONinpackages/mcp/src/version.tsand bothversionfields inpackages/mcp/server.jsonto match (a test checks they agree). Merge it.Tag the merge commit and push the tag:
git switch main && git pull git tag mcp-v0.7.0 git push origin mcp-v0.7.0CI runs the tests on the tagged commit, then stages
@dotworkout/mcpon npm with trusted publishing (no npm token is stored). A staged version is not live yet.Approve it on npmjs.com (the package's staged versions, with two-factor), or from a terminal with
npm stage list @dotworkout/mcpandnpm stage approve <stage-id>.npm stage download <stage-id>fetches the tarball to look at first, andnpm stage reject <stage-id>drops it.Once it is live on npm, list the new version in the MCP Registry. The registry checks the npm package's
mcpName, so npm has to come first:cd packages/mcp mcp-publisher login github mcp-publisher publishbrew install mcp-publisherinstalls the CLI;mcp-publisher validatechecksserver.jsonwithout publishing.
The job refuses a tag that is not on main, one that does not match the package
version, a version already on npm, and an @dotworkout/* dependency pinned to a
version npm does not have yet. Run node scripts/check-release.mjs mcp-v0.7.0
to see the same checks locally.
@dotworkout/codec and @dotworkout/domain are still published by hand, before
the mcp release that needs them.
The conformance suite
For each of the 20 files in testdata/, three assertions:
decode(bytes)matches the paired.jsonencode(decode(bytes))is byte-identical to the inputdecoding produces zero unknown fields
The third one is the point. Protobuf keeps fields it does not recognise and
writes them back out, so nine of these files round-trip perfectly against a
schema that is missing fields. Byte-identical output is not evidence of a
correct schema. Checking for unknown fields is — and the check walks the whole
tree, since SpeedAlert.speed_target sits four levels down.
packages/codec/test/unknown-fields.test.ts is the control. It breaks the schema
at runtime in six of the ten ways the upstream schema was actually broken, and
checks that assertion 3 catches each one. Without that, a passing assertion 3
only proves the schema agrees with itself.
Where the rules live
Kind of rule | Lives in |
Wire structure |
|
Which goals and alerts each sport allows |
|
Everything else |
|
The compatibility matrix is read at build time into
packages/domain/src/generated/compatibility-data.ts. It is never restated in
TypeScript or in prose. A test recomputes the source file's SHA-256 and fails if
the JSON changed without regenerating.
Entries carry a confidence level. Confirmed ones are enforced: a power alert on
a swim is an error. Unverified ones warn and are still allowed, because the
matrix came off one device on one day, and a combination nobody tested is not a
combination known to be illegal. Being too permissive costs you a file the Watch
declines to import; being too strict costs you a workout you cannot create at
all. validateWorkout(msg, { downgradeToWarning }) takes a list of issue codes,
so you never have to edit the library when the matrix is wrong.
What this does not do
Convert units. 100 m written as miles is 0.06 mi, which is 96.6 m. Conversion loses data, so authored units are kept as they are.
toMeters()exists for display and is never written back.Count laps. Pool length is chosen on the Watch when the workout starts and is not in the file.
Assume a container.
decode()branches on field 10 (SingleGoalWorkout) against field 11 (CustomWorkout) and fails with a clear message on anything else. Pacer and swim-bike-run workouts probably use further fields; when one turns up, the error asks for a corpus file.
Still unknown
spec/FORMAT.md §9 lists what has not been verified. The two that would change
this library most:
Pacer and swim-bike-run containers. Structure unknown. The decoder fails loudly rather than guess.
PowerAlert.PowerBound.unit. Only ever seen as1, assumed to be watts.
Every question settled so far was settled by exporting another .workout from
the phone and adding it to testdata/.
Credits
The protobuf schema started from
changeforan/DotnetWorkoutKit
(MIT), which covers steps, blocks, activities, locations and the
time/distance/open goals. Ten fields and enum values were missing; those
corrections are listed in spec/FORMAT.md §8. No code was taken.
Not affiliated with Apple.
Licence
MIT. See LICENSE.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
Apple Health training load, recovery, HRV and workout detail for Claude, ChatGPT and any MCP client.
Connect Intervals.icu to Claude and ChatGPT: read training, plan workouts. Training never stored.
Create structured workouts and push them to Apple Watch or Garmin.
Workout journal Claude and ChatGPT write to: log workouts, get a program, see your progress.
Related MCP Servers
- AlicenseNot gradedqualityBmaintenanceEnables users to plan, log, and analyze workouts conversationally through Claude or ChatGPT, with all changes recorded via the official openGym API and synced across their devices.AGPL 3.0
- FlicenseNot gradedqualityAmaintenanceEnables Claude and other AI assistants to query workouts, build structured intervals, manage calendars, track fitness trends, and control training through natural conversation without official API approval.-
- FlicenseNot gradedqualityAmaintenanceEnables Claude, Code, Cowork, and other AI assistants to query workouts, build structured intervals, manage calendars, log health metrics, track CTL/ATL/TSB fitness trends and power PRs, and control training data through natural language. Uses secure cookie authentication so any account can connect without official API approval.-
- AlicenseNot gradedqualityNot gradedmaintenanceEnables Claude to read recent activities and wellness data, then design, create, update, and delete structured workouts that sync through intervals.icu to Garmin Connect and the user's watch.MIT