Skip to main content
Glama
finalsurge-mcp

finalsurge-mcp

by pavelzaitsau

finalsurge-mcp

A local MCP server that turns the coach's free-text workouts in Final Surge into structured workouts in the Final Surge builder. Final Surge then syncs them to the watch.

This project is not affiliated with Final Surge. It calls the undocumented endpoints of the Final Surge web app with your own account, and a change on their side can break it at any time.

Use it

Requirements: macOS, uv, Claude Desktop, and a Final Surge account linked to your watch.

git clone https://github.com/pavelzaitsau/finalsurge-mcp.git
cd finalsurge-mcp
uv sync
FS_EMAIL=you@example.com uv run finalsurge-mcp --set-password

The last command stores the Final Surge password in the macOS Keychain under the service finalsurge-mcp.

Add the server to ~/Library/Application Support/Claude/claude_desktop_config.json and restart Claude Desktop. Use the full path from which uv and the absolute path of the clone:

"finalsurge": {
  "command": "/opt/homebrew/bin/uv",
  "args": ["--directory", "/absolute/path/to/finalsurge-mcp", "run", "finalsurge-mcp"],
  "env": { "FS_EMAIL": "you@example.com" }
}

src/finalsurge_mcp/rules.md holds the author's own conventions: paces, heart rate and the coach's phrasing. Copy it, adjust it to your training, and point FS_RULES_FILE at your copy.

Then ask Claude: "Build this week's workouts from Final Surge and show me the preview."

Claude reads the rules, builds the steps and shows a preview with a preview_token. After approval, Claude saves the steps with that token. The watch receives the workout after the Final Surge app syncs.

Related MCP server: Garmin Workout Pipeline

What it does not do

  • It does not talk to the watch. Final Surge owns the sync to Apple Watch, Garmin and Coros.

  • It does not parse the coach's text. Claude converts the text, and the server rejects steps that break a hard rule. See ADR-0002.

  • It does not use a public API. Final Surge has none, and the server calls the endpoints of the web app. See the API notes.

  • It does not overwrite a workout that already has steps, unless the request says so. An overwrite keeps a backup that restore_backup puts back.

Configuration

Setting

Default

Effect

FS_EMAIL

none, required

Final Surge login, and the Keychain account name

FS_PASSWORD

Keychain

Password; overrides the Keychain entry. Avoid it in claude_desktop_config.json, which stores it as plain text

FS_TOKEN

none

Session token; skips the login

FS_USER_KEY

from the login or /Profile

Final Surge user key

FS_RULES_FILE

src/finalsurge_mcp/rules.md

Rules file returned to Claude

FS_CONFIG_DIR

~/.config/finalsurge-mcp

Token cache (mode 0600, tied to FS_EMAIL) and backups/

FS_BASE_URL

https://beta.finalsurge.com/api

API root

A change to rules.md applies on the next call. A change to the Python code applies after a restart of Claude Desktop.

Tools

Tool

What it does

list_workouts(start_date, end_date, only_unstructured)

Lists calendar workouts with the coach's text

get_parsing_rules()

Returns rules.md

get_examples(limit, days_back)

Returns past coach texts with the steps built by hand, and flags the ones that break the current rules

get_zones()

Returns the heart-rate zones of the Final Surge profile, for reference

preview_structured_workout(name, steps)

Checks the steps, renders them and returns a preview_token; writes nothing

save_structured_workout(workout_key, date, name, steps, preview_token, overwrite)

Writes the previewed steps to the builder and reads them back

restore_backup(backup_file)

Puts back the steps that an overwrite replaced

get_structured_workout(workout_key)

Returns the steps in the builder

Troubleshooting

Symptom

Cause

Fix

Login failed

Wrong password, or Final Surge asks for a captcha

Run --set-password again, or set FS_TOKEN from localStorage.getItem('auth-token') on beta.finalsurge.com

A workout of the first day is missing

Final Surge excludes the start date of a range

Already handled; update the server if it reappears

A rule change has no effect

The change is in Python code

Restart Claude Desktop

... is in the past

The server saves only today and later

Pick a current workout

preview_token does not match

The steps changed after the preview

Preview again and approve the new text

verified: false after a save

The save succeeded, the read-back failed

Call get_structured_workout; do not overwrite

Development

scripts/check.sh

The script runs the tests, the Markdown gate (markdownlint-cli2, through npx) and the docs style gate (vale). GitHub Actions runs the same script on every push and pull request.

Enable the commit-message hook once per clone:

git config core.hooksPath .githooks

More

License

MIT

Available Tools

8 tools
get_examplesB

Recent workouts that already have a structured workout: coach text + the steps the athlete built. Examples flagged OLD STYLE break the current rules and must not be copied.

Inputs: limit, days_back. Returns: result

get_parsing_rulesA

The athlete's conventions for turning coach text into steps. ALWAYS read before building steps.

Inputs: no named parameters. Returns: result

get_structured_workoutC

Steps currently saved in the builder for a workout (compact form), or null.

Inputs: workout_key (required). Returns: result

get_zonesA

Heart-rate zones of the Final Surge profile, for reference only. Steps take heart rate in bpm ('hr').

Inputs: no named parameters. Returns: result

list_workoutsB

List planned workouts in the Final Surge calendar (dates YYYY-MM-DD, inclusive). Returns coach's text in description and whether the builder already has steps.

Inputs: end_date (required), start_date (required), only_unstructured. Returns: result

preview_structured_workoutA

Check compact steps against the hard rules and render a preview. Writes nothing. Step: {kind: warmup|active|rest|cooldown, ONE of distance_km|distance_m|minutes|seconds|time, ONE target: pace "4:30-4:40" (min/km) | hr "120-135" (bpm), optional short English note}. Repeat: {repeat: N, steps: [...]}. Read get_parsing_rules first. Show the text to the athlete; pass preview_token to save_structured_workout after the athlete approves.

Inputs: name (required), steps (required).

restore_backupB

Restore the builder steps saved before an overwrite. The current steps are backed up first.

Inputs: backup_file (required).

save_structured_workoutA

Write the previewed steps into the Final Surge Workout Builder; Final Surge syncs them to the watch. preview_token must come from preview_structured_workout for exactly these name and steps, after the athlete approved the preview (or inside the approved nightly task). Refuses past dates, and refuses a workout that already has steps unless overwrite=true; an overwrite saves the old steps to a backup file first.

Inputs: date (required), name (required), steps (required), workout_key (required), +2 more.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A3.6/5.0

    Scored across 8 tools

    Disambiguation4/5

    Most tools have clearly distinct roles: list_workouts reads the calendar, get_structured_workout reads the builder, preview/save/restore form an unambiguous write pipeline. The only mild overlap is between get_parsing_rules and get_examples, which are both 'reference material to read before building,' though their descriptions clarify the difference (rules vs. concrete examples).

    Naming Consistency5/5

    All eight tools follow a strict snake_case verb_noun pattern: list_workouts, get_zones, get_parsing_rules, get_examples, get_structured_workout, preview_structured_workout, save_structured_workout, restore_backup. The shared 'structured_workout' stem across preview/save/get reinforces the pipeline.

    Tool Count5/5

    Eight tools is well-scoped for a focused workout-builder server, with no filler. Each tool earns its place: calendar read, three reference reads, builder read, validation, write, and undo.

    Completeness4/5

    The build → preview → save → restore lifecycle is fully covered, including safety nets like backups and overwrite protection. Minor gaps exist: there is no way to create a new planned workout or clear steps without overwriting with new ones, but these are workable around within the stated workflow.

    Maintenance

    ActivityMaintained
    ResponsivenessOutdated data

    Related MCP Connectors

    Related MCP Servers