ergzone-mcp 1.3.0 → 1.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -56,7 +56,9 @@ Prefer not to store your password? Use `ERGZONE_SESSION_TOKEN` instead (copied f
56
56
 
57
57
  | Tool | What it does |
58
58
  |------|------|
59
+ | `version` | server name + version |
59
60
  | `auth_check` | who am I |
61
+ | `update_profile` | set max HR, resting HR, weight, weight unit |
60
62
  | `list_workouts` / `get_workout` | browse workouts |
61
63
  | `create_workout` / `update_workout` / `delete_workout` | manage workouts |
62
64
  | `build_intervals` | preview intervals before saving |
@@ -68,11 +70,13 @@ Prefer not to store your password? Use `ERGZONE_SESSION_TOKEN` instead (copied f
68
70
  Just talk to Claude in plain language:
69
71
 
70
72
  - **Check it works** — *"Am I connected to ErgZone? Who am I?"*
73
+ - **Version** — *"What ErgZone MCP version is running?"*
71
74
  - **Browse** — *"List my ErgZone workouts."*
72
75
  - **Build (preview, nothing saved)** — *"Show me an SPM ladder from 16 to 30 spm, 1 min each."*
73
76
  - **Create** — *"Create a workout 'Tuesday tempo' with 3 × 2 min at 22 spm, 1 min rest."*
74
77
  - **Progressive intensity** — *"Build a workout: 2 blocks of 1-2-1-3-1-4 minutes, each interval 0.1s/500m faster than the previous, 4 min rest between blocks."*
75
78
  - **Results** — *"Show my last few ErgZone results."*
79
+ - **Profile** — *"Set my max heart rate to 186."*
76
80
  - **Analysis** — *"Analyze my last result: pace, SPI and HR zone per interval."*
77
81
  - **Stats** — *"How many meters did I row this month?"*
78
82
  - **Tidy up** — *"Delete the workout 'Tuesday tempo'."*
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ergzone-mcp",
3
- "version": "1.3.0",
3
+ "version": "1.4.0",
4
4
  "description": "Unofficial MCP server for ErgZone (Concept2 rowing). Zero runtime dependencies.",
5
5
  "type": "module",
6
6
  "bin": {
package/src/client.mjs CHANGED
@@ -109,12 +109,20 @@ export function todayISO() {
109
109
  return `${d.getFullYear()}-${p(d.getMonth() + 1)}-${p(d.getDate())}`;
110
110
  }
111
111
 
112
+ // A real ErgZone track id is a UUID. This guards against an unresolved MCPB
113
+ // placeholder (e.g. the literal "${user_config.track_id}" when the user leaves
114
+ // the field blank), which is truthy and would otherwise poison resolution and
115
+ // disable the auto-detect fallback.
116
+ const isValidTrackId = (v) =>
117
+ typeof v === 'string' && /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(v.trim());
118
+
112
119
  // Resolve the track to use, in order: explicit arg -> ERGZONE_TRACK_ID -> auto-discover
113
- // the user's personal "My Workouts" track. Discovery result is cached in memory.
120
+ // the user's personal "My Workouts" track. Invalid/placeholder values are ignored
121
+ // so the auto-detect path still runs. Discovery result is cached in memory.
114
122
  let trackIdCache = null;
115
123
  export async function resolveTrackId(explicit) {
116
- if (explicit) return explicit;
117
- if (process.env.ERGZONE_TRACK_ID) return process.env.ERGZONE_TRACK_ID;
124
+ if (isValidTrackId(explicit)) return explicit.trim();
125
+ if (isValidTrackId(process.env.ERGZONE_TRACK_ID)) return process.env.ERGZONE_TRACK_ID.trim();
118
126
  if (trackIdCache) return trackIdCache;
119
127
 
120
128
  const data = await gql('query{ tracks(onlyAdmin:true){ id name trackMode type isOwner } }');
package/src/tools.mjs CHANGED
@@ -1,9 +1,28 @@
1
1
  // MCP tool definitions (Tier 1: core training + builder + basic analysis).
2
2
  // Each tool: { name, description, inputSchema, handler, write?, destructive? }
3
3
 
4
+ import { readFileSync } from 'node:fs';
5
+ import { fileURLToPath } from 'node:url';
6
+ import { dirname, join } from 'node:path';
7
+
4
8
  import { gql, todayISO, resolveTrackId } from './client.mjs';
5
9
  import { resolveIntervals, validateIntervals } from './intervals.mjs';
6
10
 
11
+ // Server version, read once at load. Source of truth is manifest.json (CI syncs it
12
+ // to the real release version before packing the .mcpb); fall back to package.json.
13
+ const SERVER_VERSION = (() => {
14
+ const root = join(dirname(fileURLToPath(import.meta.url)), '..');
15
+ for (const file of ['manifest.json', 'package.json']) {
16
+ try {
17
+ const v = JSON.parse(readFileSync(join(root, file), 'utf8')).version;
18
+ if (v && v !== '0.0.0' && v !== '0.0.0-development') return v;
19
+ } catch {
20
+ /* ignore, try next */
21
+ }
22
+ }
23
+ return '0.0.0-development';
24
+ })();
25
+
7
26
  // ---- analysis helpers ----
8
27
 
9
28
  // Concept2 watts from pace (sec/500m). Formula: 2.80 / (pace/500)^3.
@@ -34,6 +53,15 @@ const INTERVAL_DEF = `type value spm spmMax rest undefRest notes restNotes sugge
34
53
  const INTERVAL_RESULT = `type value rest distance avgPace avgSpm maxSpm avgWatts maxWatts calories avgHr maxHr minHr hrZones strokeCount rateConsistency driveLength driveTime recoveryTime avgForce peakForce avgDragFactor`;
35
54
 
36
55
  export const TOOLS = [
56
+ {
57
+ name: 'version',
58
+ description: 'Return the ergzone-mcp server name and version.',
59
+ inputSchema: { type: 'object', properties: {} },
60
+ async handler() {
61
+ return { name: 'ergzone-mcp', version: SERVER_VERSION };
62
+ },
63
+ },
64
+
37
65
  {
38
66
  name: 'auth_check',
39
67
  description: 'Verify the token and show the logged-in user (id, name, email, max/resting HR, weight).',