@trainheroic-unofficial/athlete-mcp 0.4.1 → 0.5.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 +31 -11
- package/dist/server.mjs +16 -2
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -1,13 +1,17 @@
|
|
|
1
1
|
# @trainheroic-unofficial/athlete-mcp
|
|
2
2
|
|
|
3
|
-
Local single-user MCP server for a TrainHeroic **athlete
|
|
3
|
+
Local single-user [MCP](https://modelcontextprotocol.io) server for a TrainHeroic **athlete** — it exposes one [TrainHeroic](https://www.trainheroic.com) athlete's own training to an AI assistant (Claude Code, Claude Desktop, or any MCP client) as callable tools. It runs on your machine and speaks the MCP stdio transport, so the assistant launches it as a subprocess.
|
|
4
4
|
|
|
5
|
-
It
|
|
5
|
+
It reads two required environment variables, `TRAINHEROIC_EMAIL` and `TRAINHEROIC_PASSWORD` — your existing TrainHeroic login. These are your real credentials in plaintext; the config below puts them in a file or shell history, so treat them as secrets.
|
|
6
|
+
|
|
7
|
+
It exposes the logged-in athlete's own training — scheduled and completed workouts, per-exercise history, PRs (personal records), working maxes, and lifetime totals — plus one confirmation-gated write that logs a completed set. For coaching (rosters, teams, programs, messaging), use [`@trainheroic-unofficial/coach-mcp`](../coach-mcp). For a hosted version that holds credentials server-side behind OAuth and gives a coach login both the athlete and coaching tools, see the [root README](../../README.md).
|
|
6
8
|
|
|
7
9
|
---
|
|
8
10
|
|
|
9
11
|
## Install
|
|
10
12
|
|
|
13
|
+
Needs Node (>= 18); the commands below fetch the package with `npx` on first run.
|
|
14
|
+
|
|
11
15
|
### Claude Code
|
|
12
16
|
|
|
13
17
|
```bash
|
|
@@ -19,7 +23,11 @@ claude mcp add trainheroic-athlete \
|
|
|
19
23
|
|
|
20
24
|
### Claude Desktop / `.mcp.json` / other stdio clients
|
|
21
25
|
|
|
22
|
-
|
|
26
|
+
Put this in your client's MCP config — for Claude Desktop that's `claude_desktop_config.json`
|
|
27
|
+
(macOS: `~/Library/Application Support/Claude/`; Windows: `%APPDATA%\Claude\`); for a
|
|
28
|
+
project-scoped Claude Code setup it's `.mcp.json` at the repo root.
|
|
29
|
+
|
|
30
|
+
```json
|
|
23
31
|
{
|
|
24
32
|
"mcpServers": {
|
|
25
33
|
"trainheroic-athlete": {
|
|
@@ -27,37 +35,49 @@ claude mcp add trainheroic-athlete \
|
|
|
27
35
|
"args": ["-y", "@trainheroic-unofficial/athlete-mcp"],
|
|
28
36
|
"env": {
|
|
29
37
|
"TRAINHEROIC_EMAIL": "athlete@example.com",
|
|
30
|
-
"TRAINHEROIC_PASSWORD": "yourpassword"
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
}
|
|
38
|
+
"TRAINHEROIC_PASSWORD": "yourpassword"
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
34
42
|
}
|
|
35
43
|
```
|
|
36
44
|
|
|
37
|
-
A coach account works here too: a coach
|
|
45
|
+
A coach account works here too: a TrainHeroic coach account also has its own athlete-side data, so it can read its own training through these tools. After it connects, ask the assistant something like "show my recent workouts" to confirm the tools are available.
|
|
38
46
|
|
|
39
47
|
---
|
|
40
48
|
|
|
41
49
|
## Tools
|
|
42
50
|
|
|
51
|
+
All read-only except `athlete_log_set`. The assistant fills in each tool's parameters (dates
|
|
52
|
+
are `YYYY-MM-DD`); your MCP client shows the full schema for each.
|
|
53
|
+
|
|
43
54
|
- `athlete_whoami` — identity (id, name, roles)
|
|
44
55
|
- `athlete_profile` — lifetime totals + profile
|
|
45
56
|
- `athlete_prefs` — notification/display preferences
|
|
46
|
-
- `athlete_workouts` — scheduled + completed workouts in a date range
|
|
57
|
+
- `athlete_workouts` — scheduled + completed workouts in a date range, flattened into one list
|
|
47
58
|
- `athlete_exercises` — search the exercises you've logged
|
|
48
59
|
- `athlete_exercise_history` — per-exercise PRs + dated session history
|
|
49
60
|
- `athlete_personal_records` — exercise personal records
|
|
50
61
|
- `athlete_exercise_stats` — last performance + PR as of a date
|
|
51
62
|
- `athlete_working_maxes` — working max per exercise
|
|
52
63
|
- `athlete_leaderboard` — benchmark/test workout leaderboard
|
|
53
|
-
|
|
64
|
+
|
|
65
|
+
**Write (confirmation-gated):**
|
|
66
|
+
|
|
67
|
+
- `athlete_log_set` — logs completed set results to your training log. This is a real write
|
|
68
|
+
that your coach can see. It confirms before running: the server asks the client to confirm,
|
|
69
|
+
falling back to an explicit `confirm: true` argument when the client can't prompt.
|
|
54
70
|
|
|
55
71
|
---
|
|
56
72
|
|
|
57
73
|
## Develop
|
|
58
74
|
|
|
75
|
+
Run `pnpm install` once at the repo root (Node >= 22, pnpm 10), then from this package. The
|
|
76
|
+
`pnpm start`/`pnpm inspect` commands need `TRAINHEROIC_EMAIL` and `TRAINHEROIC_PASSWORD`
|
|
77
|
+
exported in your shell. "MCP Inspector" is the [official MCP debugging UI](https://github.com/modelcontextprotocol/inspector).
|
|
78
|
+
|
|
59
79
|
```bash
|
|
60
|
-
pnpm start # run from source
|
|
80
|
+
pnpm start # run from source
|
|
61
81
|
pnpm inspect # MCP Inspector UI against the source server
|
|
62
82
|
pnpm build # tsdown → dist/server.mjs
|
|
63
83
|
pnpm typecheck
|
package/dist/server.mjs
CHANGED
|
@@ -415,6 +415,17 @@ async function confirmGate(server, requestId, message, confirmArg) {
|
|
|
415
415
|
}
|
|
416
416
|
}
|
|
417
417
|
//#endregion
|
|
418
|
+
//#region ../core/src/instructions.ts
|
|
419
|
+
/**
|
|
420
|
+
* Server-level guidance passed as the MCP `instructions` string. The host model receives it
|
|
421
|
+
* in the initialize result and treats it like a system hint. Its job is to stop tool-layer
|
|
422
|
+
* implementation details from leaking into user-facing replies: by default a model narrates
|
|
423
|
+
* capability using the raw snake_case tool name (e.g. `athlete_session_create`), and the tool
|
|
424
|
+
* descriptions here reference each other by name to drive correct chaining, which primes that
|
|
425
|
+
* leak further. This tells the host to keep that wiring internal and speak in app terms.
|
|
426
|
+
*/
|
|
427
|
+
const SERVER_INSTRUCTIONS = "Speak to the user in plain, everyday language about their training. Describe what you are doing in the TrainHeroic app's own terms (for example, say you are creating a workout rather than naming a tool). Do not surface internal tool names (the snake_case identifiers such as athlete_session_create), raw parameter names, or numeric ids in your replies unless the user explicitly asks for them; they are implementation details. The tool descriptions cross-reference each other by name only so you can chain them correctly. Keep that wiring to yourself.";
|
|
428
|
+
//#endregion
|
|
418
429
|
//#region ../js/src/auth.ts
|
|
419
430
|
const AUTH_URL = "https://apis.trainheroic.com/auth";
|
|
420
431
|
/**
|
|
@@ -1108,6 +1119,9 @@ function registerAthleteTrainingTools(server, ctx) {
|
|
|
1108
1119
|
registerLogTool(server, ctx);
|
|
1109
1120
|
}
|
|
1110
1121
|
//#endregion
|
|
1122
|
+
//#region package.json
|
|
1123
|
+
var version = "0.4.1";
|
|
1124
|
+
//#endregion
|
|
1111
1125
|
//#region src/server.ts
|
|
1112
1126
|
async function main() {
|
|
1113
1127
|
const email = process.env.TRAINHEROIC_EMAIL;
|
|
@@ -1119,8 +1133,8 @@ async function main() {
|
|
|
1119
1133
|
const client = new TrainHeroicClient(email, password);
|
|
1120
1134
|
const server = new McpServer({
|
|
1121
1135
|
name: "trainheroic-athlete",
|
|
1122
|
-
version
|
|
1123
|
-
});
|
|
1136
|
+
version
|
|
1137
|
+
}, { instructions: SERVER_INSTRUCTIONS });
|
|
1124
1138
|
registerAthleteTrainingTools(server, { client });
|
|
1125
1139
|
await server.connect(new StdioServerTransport());
|
|
1126
1140
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trainheroic-unofficial/athlete-mcp",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -21,8 +21,8 @@
|
|
|
21
21
|
"dependencies": {
|
|
22
22
|
"@modelcontextprotocol/sdk": "^1.29.0",
|
|
23
23
|
"zod": "^4.4.3",
|
|
24
|
-
"@trainheroic-unofficial/
|
|
25
|
-
"@trainheroic-unofficial/
|
|
24
|
+
"@trainheroic-unofficial/core": "0.5.0",
|
|
25
|
+
"@trainheroic-unofficial/js": "0.5.0"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
28
|
"@types/node": "^26.0.0",
|