Files
dsantillan 87bfd6d4c4 Rebrand to KuentaGYM, and start a new profile in pounds and Spanish
The app is now KuentaGYM everywhere a user can see it, and a fresh profile no
longer starts on upstream's English/kg defaults. Both are this fork's decisions,
so both are pinned by tests rather than left to a find-and-replace.

Rename (1,270 references, 149 files)

- Visible surfaces: the Login/Home/mobile-onboarding wordmark, the Settings
  version line, the printed plan, the PWA title + manifest, and the 17 branded
  strings across all 14 locale packs.
- Infrastructure: repo links, the container images and the release endpoints now
  name git.dploy.lol/dsantillan/kuentagym; .gitea/workflows/docker-publish.yml
  publishes to this forge's registry instead of gitea.com.
- The Android/iOS application id stays ch.duartesantos.opengym on purpose:
  changing it would make the mobile app a different app that could never update
  an installed copy.

Three things the mechanical pass would have broken, fixed here

- The update check asked gitlab.com for upstream's releases and would have
  installed upstream's APK, putting the old name back on the phone. It now reads
  this fork's Gitea releases API (the assets shape differs), with the tests
  rewritten to the payload Gitea actually returns.
- Renaming the mobile state/pairing files (opengym-state.json,
  opengym-remote.json) would lose the on-device copy of a history whose WebView
  storage may have been evicted, and silently unpair the device. Both are read
  under their old names and written forward under the new ones.
- Renaming the exported plan-file marker (openGym_plan) rejected every plan
  shared before the rename as "not a plan file". Both markers are accepted.

Defaults: pounds and Spanish

- DEF.unit = 'lb', DEF.lang = 'es', plus every fallback that independently
  assumed en/kg (the <html lang> attribute, the Settings pickers, the Store, the
  MCP, the Coach payload).
- Server-generated push copy existed only in English and pt-BR, so a Spanish
  profile would have been notified in English; Spanish added.
- The demo seed states unit: 'kg' — its seeded numbers are kilograms, and
  inheriting the new default would have introduced an 82.4 lb lifter benching 60.
- The module-level language in i18n-core stays English: it is the only language
  whose strings need no pack, so `t()`, dates, numbers and lists agree before a
  pack loads. Starting there on 'es' formats a Spanish-shaped UI with English
  strings.

Also
- api/package.json's test glob missed push-messages.test.js and
  verify-error.test.js, which sat beside the modules they cover and never ran.
- README, docs/, website/ and the issue templates no longer describe upstream's
  GitLab/GitHub pipeline, Discord, sponsorship or public demo as if they were
  this fork's; upstream history and attribution are preserved (NOTICE.md).
2026-09-21 14:29:54 -04:00

6.7 KiB
Raw Permalink Blame History

KuentaGYM MCP server

A Model Context Protocol bridge that lets an external LLM application (Claude Desktop, Cursor, Cline, Continue, etc.) read your KuentaGYM profile — routines, workouts, body-weight log, estimated 1RMs, and muscle balance — directly from your self-hosted ./data directory.

It is read-only, runs locally as a stdio process spawned by the LLM client, adds no new container, and requires no extra authentication. The LLM never sees passkeys, VAPID keys, or session secrets — it can only read the same state-<uid>.json files the KuentaGYM api already writes.

The numbers it answers with are computed by the same pure functions the React UI uses (frontend/src/lib/*.js) — estimate1RM, loadOfWorkouts, effectiveRoutine, etc. — so a "what's my bench 1RM?" answer matches the Stats screen exactly.

Phase 1 of a multi-phase plan. Read-only today; long-lived token auth + write tools are planned but not shipped yet. See Roadmap below.

Quick start

1. Install

cd mcp
npm install

2. Point it at your data

The MCP server reads the same ./data directory docker compose up creates. Pick the profile to answer for — its user id is in ./data/db.json under users[].id:

# single-user instance (the common self-hosted case) — auto-detected:
node src/index.js

# multi-user instance, or just to be explicit:
KUENTAGYM_UID=<your-uid> KUENTAGYM_DATA=/path/to/KuentaGYM/data node src/index.js

3. Register with your LLM client

Add the server to your LLM client's MCP config. For Claude Desktop, edit claude_desktop_config.json (macOS: ~/Library/Application Support/Claude/claude_desktop_config.json):

{
  "mcpServers": {
    "kuentagym": {
      "command": "node",
      "args": ["/absolute/path/to/KuentaGYM/mcp/src/index.js"],
      "env": {
        "KUENTAGYM_DATA": "/absolute/path/to/KuentaGYM/data",
        "KUENTAGYM_UID": "<your-uid>"   // optional — auto-detected if you have one profile
      }
    }
  }
}

For Cursor and other MCP-compatible clients, see the client's MCP docs — the same command + args + env shape is what every stdio MCP server expects.

Restart the client; you should see the KuentaGYM tools appear with "serving profile <name>" on the server's stderr.

Tools

Nine read-only tools in v1:

Tool What it answers
list_routines What routines are saved in my profile? (names + exercise counts)
get_routine What does the Push Day routine prescribe? (sets/reps/weight and rest per exercise)
preview_session What will the app actually put on screen when I start this routine — after the progression policy and my history have overridden the plan?
get_week_plan What's on my plan this week, including today with any date-specific override?
list_workouts Recent sessions — newest first, with dates, sets done/planned, volume, duration, PRs.
get_workout Full set-by-set breakdown of one session, by workout_id or by date. On a day with two sessions the date alone returns both ids to pick from rather than guessing at one.
get_bodyweight Weigh-ins with the latest weight, the goal line, and deltas vs goal.
estimate_1rm All-time best 1RM for an exercise + the trend, or a PR table across all exercises.
muscle_balance Which muscles I've trained this week/month/all-time, ranked + which I've neglected.

get_routine and preview_session answer two different questions, and confusing them is the easiest way for a coach to give wrong advice. get_routine reports what the routine stores. preview_session reports what the athlete will actually see: a routine holding "squat 3×8 @ 60 kg" opens at 75 kg if the policy deloaded from the last logged session, and the rep counts come from history, not the plan. The routine's own numbers are the last fallback the session builder consults, not the first. Ask preview_session before naming a weight.

Each tool returns JSON the LLM can format as it likes; structured fields (sets, dates, levels) are pre-formatted into human-readable labels in src/labels.js so the LLM doesn't need to re-interpret them.

How it reuses the training logic

The MCP server imports the training helpers under frontend/src/lib/ directly as Node ESM and calls the same functions the React UI does (history.js, onerm.js, muscles.js, exercises.js). The numbers it returns match what the Stats screen shows, because they are the same code.

The one lib file that wasn't Node-safe was i18n.js (Vite's import.meta.glob at module top level) — split into i18n-core.js (pure, Node-safe) + i18n.js (Vite/React bits, re-exports from core). exercises.js got a one-line import.meta.env || {} guard. No new dependencies landed in frontend/, no public exports changed.

Design constraints honoured

  • One runtime dependency beyond the MCP SDK: none. No database driver, no HTTP framework.
  • No new container. stdio transport is spawned by the LLM client; nothing to add to docker-compose.yml.
  • No new auth. The filesystem is the boundary — same as docker compose running on the user's box. No passkey material, VAPID keys, or session secrets ever cross it.
  • No telemetry, no network. Reads ./data/*.json and exits when the LLM client disconnects.

Tests

cd mcp && npm test

58 cases seeding state from frontend/src/lib/demoSeed.js (the same deterministic fixture a demo build — VITE_DEMO=1 — seeds its example profile from; no demo is deployed for this fork). Pins JSON shape and the user-facing edge cases: rest-day override, missing routine, zero-workout history, no synced state, superset links, three 1RM formulas. "Today" is pinned via vi.useFakeTimers({ now: ..., toFake: ['Date'] }) so date-dependent tools see consistent values regardless of when the suite runs. The pure lib functions have their own 92 tests in frontend/src/lib/*.test.js.

Roadmap

  • Done (Phase 1): read-only stdio, 8 tools, direct ./data access.
  • Done (Phase 1.5): preview_session — the policy's next prescription, the opening set rows it produces, and which of plan / confirmed weight / history each number came from.
  • Phase 2: read+write over stdio. Requires a long-lived token auth path minted from the admin dashboard (new ./data/tokens.json) and a write-lock against the web UI's read-modify- write of state-<uid>.json. Tools: log_workout, add_bodyweight, edit_routine, assign_weekday, override_day.
  • Phase 3: Streamable HTTP transport, opt-in 4th container in docker-compose.yml. Same tool implementations, second transport — the MCP SDK supports both behind one tool registration.

License

AGPL-3.0-or-later, same as KuentaGYM.