The MCP code came in with 5–8 line file headers, JSDoc on every
one-line wrapper, and inline explanations that referenced the PR
itself ("so the MCP server can reuse it") — none of which matches
api/server.js or frontend/src/lib/, where comments are one-line,
fact-shaped and never mention the change that introduced them.
Trimmed across mcp/src/*.js, i18n-core.js, i18n.js, exercises.js,
format.js, mcp/test/tools.test.js, mcp/vitest.config.js and
mcp/README.md. Tool prefaces lost their numbers; duplicate fs.watch
rationale folded into one; the ASCII import diagram in the README
replaced with a paragraph; the cross-references and self-references
removed. Also fixed two real defects: a corrupted Cyrillic word in a
state.js comment and a missing space in a tools.test.js comment.
No code changes; 92 frontend + 32 MCP tests still pass.
Adds Stryker 9.6.1 as a devDep and a .stryker.conf.json scoped to the three MCP-only
modules (src/state.js, src/labels.js, src/tools.js). The reused pure lib in
frontend/src/lib/ is deliberately excluded — it has its own 92-test vitest suite, and
mutating it here would just re-test it under a different label.
Two non-obvious config choices, both learned the hard way:
· inPlace: true. Stryker's default copies the project to a sandbox, but the MCP test
file imports "../../frontend/src/lib/*.js" — a relative path that breaks the moment
the source is moved. inPlace mutates files where they live, keeps a backup in
.stryker-tmp/backup-*/ during the run, and restores on exit. Verified: after the
run, `git diff` shows no changes and all 92+32 tests still pass.
· vitest.related: false. The vitest runner's related-files mode uses static import
analysis to pick which tests to run per mutant; it can't see the cross-directory
imports and reported "no tests were found". Disabling it means every mutant runs
the full suite — slower (~54s for 847 mutants) but accurate.
Baseline first run: 39.32% mutation score (333 killed, 330 survived, 184 no-coverage).
Most of the survivors are zod schema string literals (the unit suite bypasses the SDK's
validation by calling handlers directly), and the bulk of the no-coverage debt lives in
state.js — file watching, multi-user resolution and the mtime fallback paths. The HTML
report at mcp/reports/mutation/mutation.html (gitignored, regenerated per run) shows
each survived mutant inline.
Run with `npm run mutation:test` from mcp/.
A Model Context Protocol bridge that lets an external LLM application (Claude Desktop,
Cursor, Cline, Continue, …) read a user's openGym profile directly from ./data — no new
container, no extra auth, no third-party service. The LLM client spawns the server
locally as a stdio process (per the official MCP model); reads the same state-<uid>.json
the api server writes; reuses the pure training helpers from frontend/src/lib/*.js so
the numbers it answers with match what the Stats screen shows exactly.
Eight tools in v1, all read-only:
· list_routines, get_routine — names + exercise counts + per-exercise targets
· get_week_plan — Mo/We/Fr assignments and today's routine, accounting for any
date-specific overrides (a "rest" override cancels the day)
· list_workouts, get_workout — newest-first session summaries + per-set breakdown
· get_bodyweight — weigh-ins with the goal line and signed deltas vs goal
· estimate_1rm — Epley/Brzycki/Lombardi formulas, all-time best + trend per exercise,
or a PR table across all reps-mode exercises
· muscle_balance — which muscles are trained vs neglected over a week/month/all window
State is read with fs.watch (mtime fallback for platforms where watchers are flaky) so
the server reflects a session the web UI just finished without a restart. No passkey
material, VAPID keys, or session secrets ever cross the boundary — handlers only ever
serialize fields from the state object plus the user's name from db.json.
The MCP server has exactly one runtime dependency beyond the SDK: none. zod is the SDK's
transitive; vitest and Stryker are devDeps only. Tests run against the demo seed fixture
(demoSeed.js) — 32 cases pinning the JSON shape and the most user-facing edge cases
(empty state, missing routine, rest-day override, zero-workout muscle_balance, three
1RM formulas, superset links, timed/cardio set labels).