@trainheroic-unofficial/coach-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.
- package/dist/server.mjs +15 -5
- 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";
|
|
@@ -1009,6 +1009,15 @@ async function apiCall(ctx, method, path, options, hint) {
|
|
|
1009
1009
|
const NOT_CONFIRMED = "Not confirmed — the user declined. Nothing was changed.";
|
|
1010
1010
|
/** Appended to the prompt so the fallback survives whichever way a client surfaces the request. */
|
|
1011
1011
|
const FALLBACK_HINT = " (If you cannot show this prompt, re-run the tool with confirm:true once the user has agreed.)";
|
|
1012
|
+
const CONFIRMATION_REQUIRED = "Ask the user to approve this action, then retry the tool with confirm:true only after they agree. Nothing was changed.";
|
|
1013
|
+
/** `undefined` means a legacy request, whose capability check belongs to the SDK's shim. */
|
|
1014
|
+
function modernClientSupportsFormElicitation(ctx) {
|
|
1015
|
+
const envelope = ctx.mcpReq.envelope;
|
|
1016
|
+
if (envelope === void 0) return void 0;
|
|
1017
|
+
const elicitation = envelope[CLIENT_CAPABILITIES_META_KEY]?.elicitation;
|
|
1018
|
+
if (elicitation === void 0) return false;
|
|
1019
|
+
return elicitation.form !== void 0 || elicitation.url === void 0;
|
|
1020
|
+
}
|
|
1012
1021
|
/**
|
|
1013
1022
|
* Confirm a destructive/athlete-facing action.
|
|
1014
1023
|
*
|
|
@@ -1024,14 +1033,15 @@ const FALLBACK_HINT = " (If you cannot show this prompt, re-run the tool with co
|
|
|
1024
1033
|
* confirmation message ever needs data fetched first, that fetch must be idempotent.
|
|
1025
1034
|
*
|
|
1026
1035
|
* Written once in the 2026 `inputRequired` style: modern clients retry with `inputResponses`.
|
|
1027
|
-
*
|
|
1028
|
-
*
|
|
1029
|
-
* the
|
|
1036
|
+
* MCP correctly rejects unsupported embedded requests with `-32021`. This application has an
|
|
1037
|
+
* alternate `confirm: true` flow, so a modern client that does not declare form elicitation gets
|
|
1038
|
+
* a model-readable tool error that tells it how to recover while the gate remains closed.
|
|
1030
1039
|
*/
|
|
1031
1040
|
function confirmGate(ctx, message, confirmArg) {
|
|
1032
1041
|
if (confirmArg === true) return void 0;
|
|
1033
1042
|
if (acceptedContent(ctx.mcpReq.inputResponses, "confirm")?.confirm === true) return void 0;
|
|
1034
1043
|
if (inputResponse(ctx.mcpReq.inputResponses, "confirm").kind !== "missing") return errorResult(NOT_CONFIRMED);
|
|
1044
|
+
if (modernClientSupportsFormElicitation(ctx) === false) return errorResult(`${message} ${CONFIRMATION_REQUIRED}`);
|
|
1035
1045
|
const prompt = message + FALLBACK_HINT;
|
|
1036
1046
|
return inputRequired({ inputRequests: { confirm: inputRequired.elicit({
|
|
1037
1047
|
message: prompt,
|
|
@@ -5205,7 +5215,7 @@ var JsonFileLibraryCache = class {
|
|
|
5205
5215
|
};
|
|
5206
5216
|
//#endregion
|
|
5207
5217
|
//#region package.json
|
|
5208
|
-
var version = "3.7.
|
|
5218
|
+
var version = "3.7.2";
|
|
5209
5219
|
//#endregion
|
|
5210
5220
|
//#region src/server.ts
|
|
5211
5221
|
function main() {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trainheroic-unofficial/coach-mcp",
|
|
3
|
-
"version": "3.7.
|
|
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/
|
|
25
|
-
"@trainheroic-unofficial/
|
|
24
|
+
"@trainheroic-unofficial/js": "3.7.2",
|
|
25
|
+
"@trainheroic-unofficial/core": "3.7.2"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
28
|
"@types/node": "^26.5.1",
|