@trainheroic-unofficial/athlete-mcp 3.7.1 → 3.7.2

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.
Files changed (2) hide show
  1. package/dist/server.mjs +15 -5
  2. package/package.json +3 -3
package/dist/server.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { McpServer, acceptedContent, inputRequired, inputResponse } from "@modelcontextprotocol/server";
1
+ import { CLIENT_CAPABILITIES_META_KEY, McpServer, acceptedContent, inputRequired, inputResponse } from "@modelcontextprotocol/server";
2
2
  import { serveStdio } from "@modelcontextprotocol/server/stdio";
3
3
  import process from "node:process";
4
4
  import { z } from "zod";
@@ -976,6 +976,15 @@ function errorResult(message) {
976
976
  const NOT_CONFIRMED = "Not confirmed — the user declined. Nothing was changed.";
977
977
  /** Appended to the prompt so the fallback survives whichever way a client surfaces the request. */
978
978
  const FALLBACK_HINT = " (If you cannot show this prompt, re-run the tool with confirm:true once the user has agreed.)";
979
+ const CONFIRMATION_REQUIRED = "Ask the user to approve this action, then retry the tool with confirm:true only after they agree. Nothing was changed.";
980
+ /** `undefined` means a legacy request, whose capability check belongs to the SDK's shim. */
981
+ function modernClientSupportsFormElicitation(ctx) {
982
+ const envelope = ctx.mcpReq.envelope;
983
+ if (envelope === void 0) return void 0;
984
+ const elicitation = envelope[CLIENT_CAPABILITIES_META_KEY]?.elicitation;
985
+ if (elicitation === void 0) return false;
986
+ return elicitation.form !== void 0 || elicitation.url === void 0;
987
+ }
979
988
  /**
980
989
  * Confirm a destructive/athlete-facing action.
981
990
  *
@@ -991,14 +1000,15 @@ const FALLBACK_HINT = " (If you cannot show this prompt, re-run the tool with co
991
1000
  * confirmation message ever needs data fetched first, that fetch must be idempotent.
992
1001
  *
993
1002
  * Written once in the 2026 `inputRequired` style: modern clients retry with `inputResponses`.
994
- * A client that cannot elicit at all never reaches the denial below — the SDK rejects the
995
- * request before the retry so it must pass `confirm: true`, which is why the hint rides inside
996
- * the prompt text itself.
1003
+ * MCP correctly rejects unsupported embedded requests with `-32021`. This application has an
1004
+ * alternate `confirm: true` flow, so a modern client that does not declare form elicitation gets
1005
+ * a model-readable tool error that tells it how to recover while the gate remains closed.
997
1006
  */
998
1007
  function confirmGate(ctx, message, confirmArg) {
999
1008
  if (confirmArg === true) return void 0;
1000
1009
  if (acceptedContent(ctx.mcpReq.inputResponses, "confirm")?.confirm === true) return void 0;
1001
1010
  if (inputResponse(ctx.mcpReq.inputResponses, "confirm").kind !== "missing") return errorResult(NOT_CONFIRMED);
1011
+ if (modernClientSupportsFormElicitation(ctx) === false) return errorResult(`${message} ${CONFIRMATION_REQUIRED}`);
1002
1012
  const prompt = message + FALLBACK_HINT;
1003
1013
  return inputRequired({ inputRequests: { confirm: inputRequired.elicit({
1004
1014
  message: prompt,
@@ -3203,7 +3213,7 @@ function registerAthleteTrainingTools(server, ctx) {
3203
3213
  }
3204
3214
  //#endregion
3205
3215
  //#region package.json
3206
- var version = "3.7.1";
3216
+ var version = "3.7.2";
3207
3217
  //#endregion
3208
3218
  //#region src/server.ts
3209
3219
  function main() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trainheroic-unofficial/athlete-mcp",
3
- "version": "3.7.1",
3
+ "version": "3.7.2",
4
4
  "license": "MIT",
5
5
  "repository": {
6
6
  "type": "git",
@@ -21,8 +21,8 @@
21
21
  "dependencies": {
22
22
  "@modelcontextprotocol/server": "2.0.0",
23
23
  "zod": "^4.6.3",
24
- "@trainheroic-unofficial/core": "3.7.1",
25
- "@trainheroic-unofficial/js": "3.7.1"
24
+ "@trainheroic-unofficial/core": "3.7.2",
25
+ "@trainheroic-unofficial/js": "3.7.2"
26
26
  },
27
27
  "devDependencies": {
28
28
  "@types/node": "^26.5.1",