@chrischall/mcp-utils 2.0.0 → 2.2.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 +73 -1
- package/dist/caller/index.d.ts +72 -0
- package/dist/caller/index.d.ts.map +1 -0
- package/dist/caller/index.js +65 -0
- package/dist/caller/index.js.map +1 -0
- package/dist/cancel/index.d.ts +45 -1
- package/dist/cancel/index.d.ts.map +1 -1
- package/dist/cancel/index.js +54 -2
- package/dist/cancel/index.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/server/confirmation.d.ts +8 -0
- package/dist/server/confirmation.d.ts.map +1 -1
- package/dist/server/confirmation.js +22 -0
- package/dist/server/confirmation.js.map +1 -1
- package/dist/server/index.d.ts.map +1 -1
- package/dist/server/index.js +67 -2
- package/dist/server/index.js.map +1 -1
- package/dist/zod/index.d.ts +22 -1
- package/dist/zod/index.d.ts.map +1 -1
- package/dist/zod/index.js +4 -1
- package/dist/zod/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -32,7 +32,7 @@ import light:
|
|
|
32
32
|
|
|
33
33
|
| Import | Contents |
|
|
34
34
|
| --- | --- |
|
|
35
|
-
| `@chrischall/mcp-utils` | core barrel: `server` + `response` + `errors` + `config` + `fs` + `http` + `cancel` + `concurrency` + `dates` + `zod` + `auth` + `scrape` |
|
|
35
|
+
| `@chrischall/mcp-utils` | core barrel: `server` + `response` + `errors` + `config` + `fs` + `http` + `cancel` + `caller` + `concurrency` + `dates` + `zod` + `auth` + `scrape` |
|
|
36
36
|
| `@chrischall/mcp-utils/session` | session registry, session store, state persistence, token manager, cookie-session manager |
|
|
37
37
|
| `@chrischall/mcp-utils/fetchproxy` | fetchproxy transport adapter, bot-wall / retry / concurrency helpers |
|
|
38
38
|
| `@chrischall/mcp-utils/healthcheck` | credential-style healthcheck factory (no fetchproxy peer needed) |
|
|
@@ -40,6 +40,12 @@ import light:
|
|
|
40
40
|
| `@chrischall/mcp-utils/scrape` | convenience alias for the zero-dep `scrape` module (also in the core barrel) |
|
|
41
41
|
| `@chrischall/mcp-utils/test` | in-memory test harness for tool registration |
|
|
42
42
|
|
|
43
|
+
See **[`docs/CLIENT-BEHAVIOUR.md`](docs/CLIENT-BEHAVIOUR.md)** for what MCP
|
|
44
|
+
clients measurably support and *honour* — including why an unannotated tool
|
|
45
|
+
publishes as destructive, why `structuredContent` is dead weight on
|
|
46
|
+
claude.ai, and the three silent SDK gotchas around cancellation and
|
|
47
|
+
progress.
|
|
48
|
+
|
|
43
49
|
```ts
|
|
44
50
|
import { createMcpServer, textResult, requireEnvVar } from '@chrischall/mcp-utils';
|
|
45
51
|
import { createSessionRegistry } from '@chrischall/mcp-utils/session';
|
|
@@ -457,6 +463,72 @@ half-committed write simply does not ask. Outside a tool call — a unit test,
|
|
|
457
463
|
a CLI — `currentCallSignal()` is `undefined`, which every consumer must read
|
|
458
464
|
as "no cancellation".
|
|
459
465
|
|
|
466
|
+
#### Progress
|
|
467
|
+
|
|
468
|
+
The same store carries the caller's progress token, so a long tool can say
|
|
469
|
+
how far along it is:
|
|
470
|
+
|
|
471
|
+
```ts
|
|
472
|
+
import { callerWantsProgress, reportProgress } from '@chrischall/mcp-utils';
|
|
473
|
+
|
|
474
|
+
for (const [i, page] of pages.entries()) {
|
|
475
|
+
await reportProgress(i + 1, pages.length, `page ${i + 1}`);
|
|
476
|
+
// …
|
|
477
|
+
}
|
|
478
|
+
```
|
|
479
|
+
|
|
480
|
+
MEASURED support, which is why it is here: claude.ai sends
|
|
481
|
+
`_meta.progressToken` on its `tools/call` requests (mcp-host usage rows,
|
|
482
|
+
2026-09-20), so progress a hosted MCP reports genuinely arrives. A caller
|
|
483
|
+
that did not ask has no token and `reportProgress` is a no-op —
|
|
484
|
+
`callerWantsProgress()` is there for skipping work nobody will see.
|
|
485
|
+
|
|
486
|
+
Three things about the SDK make this worth a helper rather than three lines
|
|
487
|
+
at each call site, because **none of them throws** and all three look
|
|
488
|
+
identical to working code from the server's side:
|
|
489
|
+
|
|
490
|
+
- `notify` takes a notification OBJECT, not `(method, params)`. Handed a
|
|
491
|
+
string it spreads it character by character and puts
|
|
492
|
+
`{"0":"n","1":"o",…}` on the wire, which the peer rejects as
|
|
493
|
+
`Unknown message type`.
|
|
494
|
+
- The caller's token lives at `_meta`, not `meta`. Read the wrong one and
|
|
495
|
+
the notification goes out well-formed but tokenless, and the client
|
|
496
|
+
discards it as *"progress notification for an unknown token"*.
|
|
497
|
+
- Sending progress when the caller asked for none produces exactly that
|
|
498
|
+
error at the client, so the no-op matters.
|
|
499
|
+
|
|
500
|
+
### `caller` — what the CALLER can do, made readable
|
|
501
|
+
|
|
502
|
+
A confirmation-guarded tool returns `input_required`, and the SDK refuses to
|
|
503
|
+
deliver one to a client that declared no `elicitation` — a protocol `-32021`
|
|
504
|
+
raised **after** the handler returned, so the handler cannot catch it and the
|
|
505
|
+
caller sees only an opaque failure. Measured on the mcp-host fleet
|
|
506
|
+
2026-09-20: claude.ai declares `{"extensions": {…}}` and no `elicitation`, so
|
|
507
|
+
`gog_gmail_forward` answered four attempts in a row in under 110 ms, having
|
|
508
|
+
never run.
|
|
509
|
+
|
|
510
|
+
`callerAcceptsFormElicitation(ctx)` answers before the handler returns, so
|
|
511
|
+
`requireConfirmation` can refuse with a sentence instead of a prompt
|
|
512
|
+
nothing will deliver.
|
|
513
|
+
|
|
514
|
+
```ts
|
|
515
|
+
import { callerAcceptsFormElicitation, callerCapabilities } from '@chrischall/mcp-utils';
|
|
516
|
+
|
|
517
|
+
if (callerAcceptsFormElicitation(ctx) === false) { /* say so; do not prompt */ }
|
|
518
|
+
```
|
|
519
|
+
|
|
520
|
+
Two sources, because the answer lives in two places: a 2026-07-28 request
|
|
521
|
+
carries the caller's own declaration in its `_meta` envelope — and a relay
|
|
522
|
+
forwards the *real* caller's per request, so the envelope **wins** over
|
|
523
|
+
anything connection-scoped — while a 2025 connection declared its
|
|
524
|
+
capabilities once at `initialize`, where only the low-level `Server` kept
|
|
525
|
+
them. `surfaceToolHints` reads that second source and stores it ambiently.
|
|
526
|
+
|
|
527
|
+
**Absence is never a verdict.** With neither source available the helpers
|
|
528
|
+
answer `undefined`, never `false`; reading "cannot tell" as "cannot" would
|
|
529
|
+
refuse every caller this cannot see, including handlers registered outside
|
|
530
|
+
`surfaceToolHints`.
|
|
531
|
+
|
|
460
532
|
### `concurrency` — bounded async map & single-flight
|
|
461
533
|
|
|
462
534
|
`mapWithConcurrency`, `singleFlight`, `memoizeAsync` — zero-dependency async
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What the CALLER can do, made readable from inside a tool handler.
|
|
3
|
+
*
|
|
4
|
+
* ## The gap this closes
|
|
5
|
+
*
|
|
6
|
+
* A confirmation-guarded tool returns `input_required`, and the SDK refuses
|
|
7
|
+
* to send it to a client that did not declare `elicitation` — a protocol
|
|
8
|
+
* error (`-32021`) raised AFTER the handler returned, so the handler cannot
|
|
9
|
+
* catch it and the caller is told nothing useful. Measured on the mcp-host
|
|
10
|
+
* fleet 2026-09-20: claude.ai declares `{"extensions": {…}}` and no
|
|
11
|
+
* `elicitation`, so `gog_gmail_forward` answered four attempts in a row with
|
|
12
|
+
* an opaque "Error occurred during tool execution" in 69–107 ms, having never
|
|
13
|
+
* run. The only way out is for the handler to know BEFORE it returns.
|
|
14
|
+
*
|
|
15
|
+
* ## Where the answer lives, and why it takes two sources
|
|
16
|
+
*
|
|
17
|
+
* On protocol revision 2026-07-28 each request carries its own `_meta`
|
|
18
|
+
* envelope, so the caller's capabilities are on `ctx.mcpReq.envelope` — and
|
|
19
|
+
* that is the era the mcp-host relay uses, forwarding the real caller's
|
|
20
|
+
* declaration rather than the connection's. On a 2025-era connection there is
|
|
21
|
+
* no envelope: the capabilities were declared once at `initialize` and only
|
|
22
|
+
* the underlying {@link Server} holds them. `surfaceToolHints` is the one
|
|
23
|
+
* wrapper every tool already passes through AND the one place with a
|
|
24
|
+
* reference to that server, so it reads the second source and stores it here.
|
|
25
|
+
*
|
|
26
|
+
* ## What it deliberately does NOT do
|
|
27
|
+
*
|
|
28
|
+
* It answers `undefined` — never "no" — when neither source is available.
|
|
29
|
+
* A missing answer is not a negative one, and treating it as one would refuse
|
|
30
|
+
* every caller this cannot see, which includes any handler registered outside
|
|
31
|
+
* `surfaceToolHints`. Absence is never a verdict.
|
|
32
|
+
*/
|
|
33
|
+
/** The capability map a client declares, as far as this module cares about it. */
|
|
34
|
+
export interface CallerCapabilities {
|
|
35
|
+
readonly elicitation?: Record<string, unknown>;
|
|
36
|
+
readonly [key: string]: unknown;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Run `fn` with `capabilities` as the ambient caller declaration for its whole
|
|
40
|
+
* async extent. Called by `surfaceToolHints` once per tool call.
|
|
41
|
+
*
|
|
42
|
+
* A caller whose capabilities could not be resolved runs `fn` unwrapped rather
|
|
43
|
+
* than storing `undefined`: an empty store and no store are the same answer to
|
|
44
|
+
* {@link currentCallerCapabilities}.
|
|
45
|
+
*/
|
|
46
|
+
export declare function withCallerCapabilities<T>(capabilities: CallerCapabilities | undefined, fn: () => T): T;
|
|
47
|
+
/** The ambient caller capabilities, or `undefined` outside a wrapped tool call. */
|
|
48
|
+
export declare function currentCallerCapabilities(): CallerCapabilities | undefined;
|
|
49
|
+
/**
|
|
50
|
+
* The caller's declared capabilities for THIS call: the request's own envelope
|
|
51
|
+
* when the era carries one, else whatever `surfaceToolHints` stored.
|
|
52
|
+
*
|
|
53
|
+
* The envelope wins because it is per request. On the 2026-07-28 era a relay
|
|
54
|
+
* forwards the real caller's declaration with every call, so two callers on
|
|
55
|
+
* one connection can differ — and the ambient value, resolved once from the
|
|
56
|
+
* connection, would answer about the wrong one.
|
|
57
|
+
*/
|
|
58
|
+
export declare function callerCapabilities(ctx: unknown): CallerCapabilities | undefined;
|
|
59
|
+
/**
|
|
60
|
+
* Whether this caller can be shown a FORM elicitation — the shape every
|
|
61
|
+
* {@link requireConfirmation} prompt uses.
|
|
62
|
+
*
|
|
63
|
+
* `undefined` means "cannot tell", which callers must not read as `false`.
|
|
64
|
+
*
|
|
65
|
+
* Mirrors the SDK's own gate, verified against `@modelcontextprotocol/server`
|
|
66
|
+
* 2.0.0 by driving all four shapes through a real client: `elicitation` absent
|
|
67
|
+
* refuses; `{url: {}}` refuses (a URL elicitation cannot carry a schema);
|
|
68
|
+
* `{form: {}}` passes; and `{}` — modes not enumerated — PASSES, because a
|
|
69
|
+
* client that named no mode is not a client that excluded this one.
|
|
70
|
+
*/
|
|
71
|
+
export declare function callerAcceptsFormElicitation(ctx: unknown): boolean | undefined;
|
|
72
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/caller/index.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAEH,kFAAkF;AAClF,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC/C,QAAQ,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACjC;AAID;;;;;;;GAOG;AACH,wBAAgB,sBAAsB,CAAC,CAAC,EACtC,YAAY,EAAE,kBAAkB,GAAG,SAAS,EAC5C,EAAE,EAAE,MAAM,CAAC,GACV,CAAC,CAEH;AAED,mFAAmF;AACnF,wBAAgB,yBAAyB,IAAI,kBAAkB,GAAG,SAAS,CAE1E;AAYD;;;;;;;;GAQG;AACH,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,OAAO,GAAG,kBAAkB,GAAG,SAAS,CAO/E;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,4BAA4B,CAAC,GAAG,EAAE,OAAO,GAAG,OAAO,GAAG,SAAS,CAO9E"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { AsyncLocalStorage } from 'node:async_hooks';
|
|
2
|
+
const storage = new AsyncLocalStorage();
|
|
3
|
+
/**
|
|
4
|
+
* Run `fn` with `capabilities` as the ambient caller declaration for its whole
|
|
5
|
+
* async extent. Called by `surfaceToolHints` once per tool call.
|
|
6
|
+
*
|
|
7
|
+
* A caller whose capabilities could not be resolved runs `fn` unwrapped rather
|
|
8
|
+
* than storing `undefined`: an empty store and no store are the same answer to
|
|
9
|
+
* {@link currentCallerCapabilities}.
|
|
10
|
+
*/
|
|
11
|
+
export function withCallerCapabilities(capabilities, fn) {
|
|
12
|
+
return capabilities ? storage.run(capabilities, fn) : fn();
|
|
13
|
+
}
|
|
14
|
+
/** The ambient caller capabilities, or `undefined` outside a wrapped tool call. */
|
|
15
|
+
export function currentCallerCapabilities() {
|
|
16
|
+
return storage.getStore();
|
|
17
|
+
}
|
|
18
|
+
/** The envelope key the 2026-07-28 revision carries a caller's capabilities under. */
|
|
19
|
+
const ENVELOPE_CAPABILITIES_KEY = 'io.modelcontextprotocol/clientCapabilities';
|
|
20
|
+
/** The elicitation modes the spec defines; anything else is not a mode. */
|
|
21
|
+
const ELICITATION_MODES = ['form', 'url'];
|
|
22
|
+
function isRecord(value) {
|
|
23
|
+
return typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* The caller's declared capabilities for THIS call: the request's own envelope
|
|
27
|
+
* when the era carries one, else whatever `surfaceToolHints` stored.
|
|
28
|
+
*
|
|
29
|
+
* The envelope wins because it is per request. On the 2026-07-28 era a relay
|
|
30
|
+
* forwards the real caller's declaration with every call, so two callers on
|
|
31
|
+
* one connection can differ — and the ambient value, resolved once from the
|
|
32
|
+
* connection, would answer about the wrong one.
|
|
33
|
+
*/
|
|
34
|
+
export function callerCapabilities(ctx) {
|
|
35
|
+
const envelope = isRecord(ctx) && isRecord(ctx.mcpReq) ? ctx.mcpReq.envelope : undefined;
|
|
36
|
+
if (isRecord(envelope)) {
|
|
37
|
+
const declared = envelope[ENVELOPE_CAPABILITIES_KEY];
|
|
38
|
+
if (isRecord(declared))
|
|
39
|
+
return declared;
|
|
40
|
+
}
|
|
41
|
+
return currentCallerCapabilities();
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Whether this caller can be shown a FORM elicitation — the shape every
|
|
45
|
+
* {@link requireConfirmation} prompt uses.
|
|
46
|
+
*
|
|
47
|
+
* `undefined` means "cannot tell", which callers must not read as `false`.
|
|
48
|
+
*
|
|
49
|
+
* Mirrors the SDK's own gate, verified against `@modelcontextprotocol/server`
|
|
50
|
+
* 2.0.0 by driving all four shapes through a real client: `elicitation` absent
|
|
51
|
+
* refuses; `{url: {}}` refuses (a URL elicitation cannot carry a schema);
|
|
52
|
+
* `{form: {}}` passes; and `{}` — modes not enumerated — PASSES, because a
|
|
53
|
+
* client that named no mode is not a client that excluded this one.
|
|
54
|
+
*/
|
|
55
|
+
export function callerAcceptsFormElicitation(ctx) {
|
|
56
|
+
const capabilities = callerCapabilities(ctx);
|
|
57
|
+
if (!capabilities)
|
|
58
|
+
return undefined;
|
|
59
|
+
const elicitation = capabilities.elicitation;
|
|
60
|
+
if (!isRecord(elicitation))
|
|
61
|
+
return false;
|
|
62
|
+
const namedModes = ELICITATION_MODES.filter((mode) => mode in elicitation);
|
|
63
|
+
return namedModes.length === 0 || namedModes.includes('form');
|
|
64
|
+
}
|
|
65
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/caller/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAyCrD,MAAM,OAAO,GAAG,IAAI,iBAAiB,EAAsB,CAAC;AAE5D;;;;;;;GAOG;AACH,MAAM,UAAU,sBAAsB,CACpC,YAA4C,EAC5C,EAAW;IAEX,OAAO,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;QAAE,OAAO,KAAK,CAAC;IACzC,MAAM,UAAU,GAAG,iBAAiB,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,IAAI,WAAW,CAAC,CAAC;IAC3E,OAAO,UAAU,CAAC,MAAM,KAAK,CAAC,IAAI,UAAU,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;AAChE,CAAC"}
|
package/dist/cancel/index.d.ts
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* {@link currentCallSignal}, and not entering the context at all is cheaper
|
|
8
8
|
* and easier to reason about.
|
|
9
9
|
*/
|
|
10
|
-
export declare function withCallSignal<T>(signal: AbortSignal | undefined, fn: () => T): T;
|
|
10
|
+
export declare function withCallSignal<T>(signal: AbortSignal | undefined, fn: () => T, request?: ProgressCapableRequest): T;
|
|
11
11
|
/**
|
|
12
12
|
* The cancellation for the tool call currently running, or `undefined`
|
|
13
13
|
* outside one.
|
|
@@ -60,5 +60,49 @@ export declare function killOnCancel(child: Killable, signal?: NodeJS.Signals):
|
|
|
60
60
|
* seen is the error that propagates.
|
|
61
61
|
*/
|
|
62
62
|
export declare function throwIfCancelled(): void;
|
|
63
|
+
/** The part of the SDK's request context progress needs. */
|
|
64
|
+
interface ProgressCapableRequest {
|
|
65
|
+
_meta?: {
|
|
66
|
+
progressToken?: string | number;
|
|
67
|
+
};
|
|
68
|
+
notify(notification: {
|
|
69
|
+
method: string;
|
|
70
|
+
params: Record<string, unknown>;
|
|
71
|
+
}): Promise<void> | void;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Tell the caller how far along a long tool call is.
|
|
75
|
+
*
|
|
76
|
+
* MEASURED SUPPORT, which is why this exists at all: on the mcp-host fleet
|
|
77
|
+
* claude.ai sends `_meta.progressToken` on its `tools/call` requests
|
|
78
|
+
* (recorded as `meta.progressToken` on the usage row, 2026-09-20), so
|
|
79
|
+
* progress a hosted MCP reports genuinely reaches it. Without a token
|
|
80
|
+
* nothing can be delivered and this is a no-op — which is the ordinary case
|
|
81
|
+
* for a client that did not ask.
|
|
82
|
+
*
|
|
83
|
+
* THREE THINGS ARE EASY TO GET WRONG HERE, and all three were, against
|
|
84
|
+
* `@modelcontextprotocol/server` 2.0.0, before this was written:
|
|
85
|
+
*
|
|
86
|
+
* 1. `notify` takes a NOTIFICATION OBJECT, not `(method, params)`. Passed a
|
|
87
|
+
* string it spreads it character by character and puts
|
|
88
|
+
* `{"0":"n","1":"o",…}` on the wire — a frame the peer answers with
|
|
89
|
+
* `Unknown message type`. It does not throw, so the mistake is invisible
|
|
90
|
+
* from the server.
|
|
91
|
+
* 2. The caller's token is at `_meta`, NOT `meta`. Reading `meta` yields
|
|
92
|
+
* `undefined`, and the notification then goes out WITHOUT a
|
|
93
|
+
* `progressToken` — well-formed, accepted, and dropped by the client
|
|
94
|
+
* with "progress notification for an unknown token", because the client
|
|
95
|
+
* routes on that field alone.
|
|
96
|
+
* 3. Neither mistake throws. A tool reporting progress into the void looks
|
|
97
|
+
* exactly like one reporting progress correctly, from the server's side.
|
|
98
|
+
*
|
|
99
|
+
* AMBIENT, like the cancellation above and for the same reason: the token
|
|
100
|
+
* belongs to the request, `surfaceToolHints` already has it, and threading a
|
|
101
|
+
* reporter through several hundred tools is how most of them end up without
|
|
102
|
+
* one.
|
|
103
|
+
*/
|
|
104
|
+
export declare function reportProgress(progress: number, total?: number, message?: string): Promise<void>;
|
|
105
|
+
/** Whether this caller asked for progress — for skipping work nobody will see. */
|
|
106
|
+
export declare function callerWantsProgress(): boolean;
|
|
63
107
|
export {};
|
|
64
108
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/cancel/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/cancel/index.ts"],"names":[],"mappings":"AAqDA;;;;;;;;GAQG;AACH,wBAAgB,cAAc,CAAC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ncLocalStorage();
|
|
|
9
9
|
* {@link currentCallSignal}, and not entering the context at all is cheaper
|
|
10
10
|
* and easier to reason about.
|
|
11
11
|
*/
|
|
12
|
-
export function withCallSignal(signal, fn) {
|
|
13
|
-
return signal ? storage.run({ signal }, fn) : fn();
|
|
12
|
+
export function withCallSignal(signal, fn, request) {
|
|
13
|
+
return signal ? storage.run({ signal, ...(request ? { request } : {}) }, fn) : fn();
|
|
14
14
|
}
|
|
15
15
|
/**
|
|
16
16
|
* The cancellation for the tool call currently running, or `undefined`
|
|
@@ -88,4 +88,56 @@ export function throwIfCancelled() {
|
|
|
88
88
|
if (signal?.aborted)
|
|
89
89
|
throw signal.reason instanceof Error ? signal.reason : new Error(String(signal.reason));
|
|
90
90
|
}
|
|
91
|
+
/**
|
|
92
|
+
* Tell the caller how far along a long tool call is.
|
|
93
|
+
*
|
|
94
|
+
* MEASURED SUPPORT, which is why this exists at all: on the mcp-host fleet
|
|
95
|
+
* claude.ai sends `_meta.progressToken` on its `tools/call` requests
|
|
96
|
+
* (recorded as `meta.progressToken` on the usage row, 2026-09-20), so
|
|
97
|
+
* progress a hosted MCP reports genuinely reaches it. Without a token
|
|
98
|
+
* nothing can be delivered and this is a no-op — which is the ordinary case
|
|
99
|
+
* for a client that did not ask.
|
|
100
|
+
*
|
|
101
|
+
* THREE THINGS ARE EASY TO GET WRONG HERE, and all three were, against
|
|
102
|
+
* `@modelcontextprotocol/server` 2.0.0, before this was written:
|
|
103
|
+
*
|
|
104
|
+
* 1. `notify` takes a NOTIFICATION OBJECT, not `(method, params)`. Passed a
|
|
105
|
+
* string it spreads it character by character and puts
|
|
106
|
+
* `{"0":"n","1":"o",…}` on the wire — a frame the peer answers with
|
|
107
|
+
* `Unknown message type`. It does not throw, so the mistake is invisible
|
|
108
|
+
* from the server.
|
|
109
|
+
* 2. The caller's token is at `_meta`, NOT `meta`. Reading `meta` yields
|
|
110
|
+
* `undefined`, and the notification then goes out WITHOUT a
|
|
111
|
+
* `progressToken` — well-formed, accepted, and dropped by the client
|
|
112
|
+
* with "progress notification for an unknown token", because the client
|
|
113
|
+
* routes on that field alone.
|
|
114
|
+
* 3. Neither mistake throws. A tool reporting progress into the void looks
|
|
115
|
+
* exactly like one reporting progress correctly, from the server's side.
|
|
116
|
+
*
|
|
117
|
+
* AMBIENT, like the cancellation above and for the same reason: the token
|
|
118
|
+
* belongs to the request, `surfaceToolHints` already has it, and threading a
|
|
119
|
+
* reporter through several hundred tools is how most of them end up without
|
|
120
|
+
* one.
|
|
121
|
+
*/
|
|
122
|
+
export async function reportProgress(progress, total, message) {
|
|
123
|
+
const req = storage.getStore()?.request;
|
|
124
|
+
const token = req?._meta?.progressToken;
|
|
125
|
+
// No token means the caller did not ask for progress, which is the
|
|
126
|
+
// ordinary case and not a failure.
|
|
127
|
+
if (req === undefined || token === undefined)
|
|
128
|
+
return;
|
|
129
|
+
await req.notify({
|
|
130
|
+
method: 'notifications/progress',
|
|
131
|
+
params: {
|
|
132
|
+
progressToken: token,
|
|
133
|
+
progress,
|
|
134
|
+
...(total === undefined ? {} : { total }),
|
|
135
|
+
...(message === undefined ? {} : { message }),
|
|
136
|
+
},
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
/** Whether this caller asked for progress — for skipping work nobody will see. */
|
|
140
|
+
export function callerWantsProgress() {
|
|
141
|
+
return storage.getStore()?.request?._meta?.progressToken !== undefined;
|
|
142
|
+
}
|
|
91
143
|
//# sourceMappingURL=index.js.map
|
package/dist/cancel/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/cancel/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/cancel/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAmDrD,MAAM,OAAO,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IACjC,OAAO,OAAO,CAAC,QAAQ,EAAE,EAAE,OAAO,EAAE,KAAK,EAAE,aAAa,KAAK,SAAS,CAAC;AACzE,CAAC"}
|
package/dist/index.d.ts
CHANGED
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC;AACpC,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC;AAChC,cAAc,wBAAwB,CAAC;AACvC,cAAc,kBAAkB,CAAC;AACjC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC;AACpC,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC;AAChC,cAAc,wBAAwB,CAAC;AACvC,cAAc,kBAAkB,CAAC;AACjC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC"}
|
package/dist/index.js
CHANGED
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC;AACpC,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC;AAChC,cAAc,wBAAwB,CAAC;AACvC,cAAc,kBAAkB,CAAC;AACjC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC;AACpC,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC;AAChC,cAAc,wBAAwB,CAAC;AACvC,cAAc,kBAAkB,CAAC;AACjC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC"}
|
|
@@ -11,6 +11,14 @@ export interface RequireConfirmationOptions {
|
|
|
11
11
|
requestKey?: string;
|
|
12
12
|
/** Label shown beside the required confirmation checkbox. */
|
|
13
13
|
confirmationLabel?: string;
|
|
14
|
+
/**
|
|
15
|
+
* One sentence appended when the caller cannot be shown a prompt at all,
|
|
16
|
+
* naming what to do instead (typically the tool that stages the same action
|
|
17
|
+
* without dispatching it). Omitted, the refusal still explains itself — this
|
|
18
|
+
* only adds the way forward, which the caller of this helper knows and this
|
|
19
|
+
* helper does not.
|
|
20
|
+
*/
|
|
21
|
+
unsupportedNote?: string;
|
|
14
22
|
}
|
|
15
23
|
/**
|
|
16
24
|
* Require an explicit, checked form elicitation before a mutating tool proceeds.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"confirmation.d.ts","sourceRoot":"","sources":["../../src/server/confirmation.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,KAAK,cAAc,EACnB,KAAK,mBAAmB,EACxB,KAAK,aAAa,EACnB,MAAM,8BAA8B,CAAC;
|
|
1
|
+
{"version":3,"file":"confirmation.d.ts","sourceRoot":"","sources":["../../src/server/confirmation.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,KAAK,cAAc,EACnB,KAAK,mBAAmB,EACxB,KAAK,aAAa,EACnB,MAAM,8BAA8B,CAAC;AAUtC,+CAA+C;AAC/C,MAAM,WAAW,0BAA0B;IACzC,2DAA2D;IAC3D,MAAM,EAAE,MAAM,CAAC;IACf,wEAAwE;IACxE,OAAO,EAAE,MAAM,CAAC;IAChB,mFAAmF;IACnF,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAClC,kFAAkF;IAClF,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,6DAA6D;IAC7D,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B;;;;;;OAMG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED;;;;;;;;;GASG;AACH,wBAAgB,mBAAmB,CACjC,GAAG,EAAE,aAAa,EAClB,OAAO,EAAE,0BAA0B,GAClC,mBAAmB,GAAG,cAAc,GAAG,SAAS,CA0DlD"}
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import { acceptedContent, inputRequired, inputResponse, } from '@modelcontextprotocol/server';
|
|
2
2
|
import { z } from 'zod';
|
|
3
|
+
import { callerAcceptsFormElicitation } from '../caller/index.js';
|
|
3
4
|
import { textResult } from '../response/index.js';
|
|
4
5
|
const DEFAULT_REQUEST_KEY = 'confirmation';
|
|
5
6
|
const DEFAULT_CONFIRMATION_LABEL = 'Confirm this action should proceed.';
|
|
7
|
+
const UNSUPPORTED_NOTE = 'Nothing was done because this client cannot show a confirmation prompt '
|
|
8
|
+
+ '(it declares no MCP elicitation capability), and this action is never taken without one';
|
|
6
9
|
/**
|
|
7
10
|
* Require an explicit, checked form elicitation before a mutating tool proceeds.
|
|
8
11
|
*
|
|
@@ -23,6 +26,25 @@ export function requireConfirmation(ctx, options) {
|
|
|
23
26
|
const response = inputResponse(ctx.mcpReq.inputResponses, requestKey);
|
|
24
27
|
const accepted = acceptedContent(ctx.mcpReq.inputResponses, requestKey, confirmationSchema);
|
|
25
28
|
if (response.kind === 'missing') {
|
|
29
|
+
// A CALLER THAT CANNOT BE ASKED IS TOLD SO, rather than being handed a
|
|
30
|
+
// prompt the SDK will refuse to deliver. That refusal is a protocol error
|
|
31
|
+
// (-32021) raised after this function has returned, so it cannot be caught
|
|
32
|
+
// here and the caller sees only an opaque failure: measured on the mcp-host
|
|
33
|
+
// fleet, claude.ai — which declares no `elicitation` — got four of those in
|
|
34
|
+
// a row from `gog_gmail_forward`, each in under 110 ms, having never run.
|
|
35
|
+
//
|
|
36
|
+
// `false` only, never a missing answer: see `callerAcceptsFormElicitation`.
|
|
37
|
+
if (callerAcceptsFormElicitation(ctx) === false) {
|
|
38
|
+
return textResult({
|
|
39
|
+
confirmed: false,
|
|
40
|
+
dispatched: false,
|
|
41
|
+
action: options.action,
|
|
42
|
+
reason: 'confirmation-unsupported',
|
|
43
|
+
note: options.unsupportedNote
|
|
44
|
+
? `${UNSUPPORTED_NOTE}. ${options.unsupportedNote}`
|
|
45
|
+
: `${UNSUPPORTED_NOTE}.`,
|
|
46
|
+
});
|
|
47
|
+
}
|
|
26
48
|
const preview = {
|
|
27
49
|
action: options.action,
|
|
28
50
|
...(options.details === undefined ? {} : { details: options.details }),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"confirmation.js","sourceRoot":"","sources":["../../src/server/confirmation.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,EACf,aAAa,EACb,aAAa,GAId,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,UAA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3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/server/index.ts"],"names":[],"mappings":"AAoCA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,oCAAoC,CAAC;AAC5E,OAAO,EAAE,SAAS,EAA+B,MAAM,8BAA8B,CAAC;AACtF,OAAO,KAAK,EAAE,SAAS,EAAkB,MAAM,8BAA8B,CAAC;AAI9E,cAAc,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/server/index.ts"],"names":[],"mappings":"AAoCA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,oCAAoC,CAAC;AAC5E,OAAO,EAAE,SAAS,EAA+B,MAAM,8BAA8B,CAAC;AACtF,OAAO,KAAK,EAAE,SAAS,EAAkB,MAAM,8BAA8B,CAAC;AAI9E,cAAc,mBAAmB,CAAC;AAKlC;;;GAGG;AACH,YAAY,EAAE,iBAAiB,EAAE,MAAM,oCAAoC,CAAC;AAE5E;;;;;;;GAOG;AACH,MAAM,MAAM,aAAa,CAAC,KAAK,GAAG,OAAO,IAAI,CAC3C,MAAM,EAAE,SAAS,EACjB,IAAI,EAAE,KAAK,KACR,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;AAE1B,2EAA2E;AAC3E,eAAO,MAAM,wBAAwB,mBAGnC,CAAC;AAEH,+EAA+E;AAC/E,MAAM,MAAM,aAAa,GAAG,OAAO,GAAG,SAAS,CAAC;AAEhD,2CAA2C;AAC3C,MAAM,WAAW,sBAAsB,CAAC,KAAK,GAAG,OAAO;IACrD,mEAAmE;IACnE,IAAI,EAAE,MAAM,CAAC;IACb,8EAA8E;IAC9E,OAAO,EAAE,MAAM,CAAC;IAChB,8CAA8C;IAC9C,KAAK,EAAE,aAAa,CAAC,KAAK,CAAC,EAAE,CAAC;IAC9B;;;;;OAKG;IACH,IAAI,CAAC,EAAE,KAAK,CAAC;IACb,mGAAmG;IACnG,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;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BG;AACH,wBAAgB,MAAM,CAAC,KAAK,GAAG,OAAO,EAAE,IAAI,EAAE,aAAa,CAAC,KAAK,CAAC,GAAG,iBAAiB,CAoCrF"}
|
package/dist/server/index.js
CHANGED
|
@@ -39,6 +39,7 @@ import { McpToolError, redactSecrets } from '../errors/index.js';
|
|
|
39
39
|
import { errorResult } from '../response/index.js';
|
|
40
40
|
export * from './confirmation.js';
|
|
41
41
|
import { withCallSignal } from '../cancel/index.js';
|
|
42
|
+
import { withCallerCapabilities } from '../caller/index.js';
|
|
42
43
|
/** Protocol revisions supported by servers and the shared test harness. */
|
|
43
44
|
export const SERVER_PROTOCOL_VERSIONS = Object.freeze([
|
|
44
45
|
'2026-07-28',
|
|
@@ -58,6 +59,29 @@ function hintResultOrRethrow(err) {
|
|
|
58
59
|
}
|
|
59
60
|
throw err;
|
|
60
61
|
}
|
|
62
|
+
/**
|
|
63
|
+
* The SDK request for the call in flight, or `undefined` when it cannot
|
|
64
|
+
* deliver a notification.
|
|
65
|
+
*
|
|
66
|
+
* Shares the shape rules described on {@link callSignalFrom} below — the
|
|
67
|
+
* context is the LAST argument, and what matters hangs off `mcpReq` rather
|
|
68
|
+
* than off the context. The extra check here is `notify`: `reportProgress`
|
|
69
|
+
* must never have to guess whether the request can carry a notification, so
|
|
70
|
+
* a request without it is treated as absent.
|
|
71
|
+
*/
|
|
72
|
+
function mcpRequestFrom(args) {
|
|
73
|
+
const ctx = args.at(-1);
|
|
74
|
+
if (typeof ctx !== 'object' || ctx === null)
|
|
75
|
+
return undefined;
|
|
76
|
+
const req = ctx.mcpReq;
|
|
77
|
+
if (typeof req !== 'object' || req === null)
|
|
78
|
+
return undefined;
|
|
79
|
+
// Only a request that can actually deliver one, so `reportProgress` never
|
|
80
|
+
// has to guess: the SDK's own shape, checked the same way the signal is.
|
|
81
|
+
return typeof req.notify === 'function'
|
|
82
|
+
? req
|
|
83
|
+
: undefined;
|
|
84
|
+
}
|
|
61
85
|
/**
|
|
62
86
|
* The caller's `AbortSignal`, dug out of whatever the SDK passed.
|
|
63
87
|
*
|
|
@@ -82,6 +106,39 @@ function callSignalFrom(args) {
|
|
|
82
106
|
const signal = req.signal;
|
|
83
107
|
return signal instanceof AbortSignal ? signal : undefined;
|
|
84
108
|
}
|
|
109
|
+
/**
|
|
110
|
+
* The capabilities the client declared at `initialize`, read off the low-level
|
|
111
|
+
* `Server` the {@link McpServer} wraps.
|
|
112
|
+
*
|
|
113
|
+
* This is the 2025-ERA source, and that is the whole reason the wrapper
|
|
114
|
+
* resolves it: a 2026-07-28 request carries the caller's declaration in its
|
|
115
|
+
* own per-request envelope, which {@link callerCapabilities} reads and
|
|
116
|
+
* prefers, but a 2025 connection declared them once at handshake and only the
|
|
117
|
+
* server kept them.
|
|
118
|
+
*
|
|
119
|
+
* Checked at every step rather than asserted, for the reason the two above
|
|
120
|
+
* are: this runs on the tool path for every call, and `getClientCapabilities`
|
|
121
|
+
* is a deprecated accessor on a type this package does not own — it is absent
|
|
122
|
+
* from `McpServer` itself, which is how a first attempt read `undefined`
|
|
123
|
+
* forever without anything failing.
|
|
124
|
+
*/
|
|
125
|
+
function declaredCapabilitiesFrom(server) {
|
|
126
|
+
const inner = server.server;
|
|
127
|
+
if (typeof inner !== 'object' || inner === null)
|
|
128
|
+
return undefined;
|
|
129
|
+
const read = inner.getClientCapabilities;
|
|
130
|
+
if (typeof read !== 'function')
|
|
131
|
+
return undefined;
|
|
132
|
+
try {
|
|
133
|
+
const declared = read.call(inner);
|
|
134
|
+
return typeof declared === 'object' && declared !== null
|
|
135
|
+
? declared
|
|
136
|
+
: undefined;
|
|
137
|
+
}
|
|
138
|
+
catch {
|
|
139
|
+
return undefined;
|
|
140
|
+
}
|
|
141
|
+
}
|
|
85
142
|
/**
|
|
86
143
|
* Wrap `server.registerTool` so every tool handler surfaces its error `hint`.
|
|
87
144
|
*
|
|
@@ -120,7 +177,15 @@ export function surfaceToolHints(server) {
|
|
|
120
177
|
// Here because this is the one wrapper every tool already passes
|
|
121
178
|
// through: threading the signal by hand would mean editing several
|
|
122
179
|
// hundred handlers and missing exactly the ones nobody edits.
|
|
123
|
-
withCallSignal(callSignalFrom(args), () =>
|
|
180
|
+
withCallSignal(callSignalFrom(args), () =>
|
|
181
|
+
// WHAT THE CALLER CAN DO, made ambient for the same reason and in
|
|
182
|
+
// the same place (`caller/index.ts`). Only the 2025-era half needs
|
|
183
|
+
// the wrapper — a 2026-07-28 request answers for itself off its own
|
|
184
|
+
// envelope — but a guarded tool that cannot tell whether the caller
|
|
185
|
+
// can be shown a prompt returns one the SDK then refuses to deliver,
|
|
186
|
+
// and that refusal reaches the caller as an unexplained protocol
|
|
187
|
+
// error it had no chance to catch.
|
|
188
|
+
withCallerCapabilities(declaredCapabilitiesFrom(server), () => {
|
|
124
189
|
let result;
|
|
125
190
|
try {
|
|
126
191
|
result = cb(...args);
|
|
@@ -129,7 +194,7 @@ export function surfaceToolHints(server) {
|
|
|
129
194
|
return hintResultOrRethrow(err);
|
|
130
195
|
}
|
|
131
196
|
return result instanceof Promise ? result.catch(hintResultOrRethrow) : result;
|
|
132
|
-
}));
|
|
197
|
+
}), mcpRequestFrom(args)));
|
|
133
198
|
}
|
|
134
199
|
/**
|
|
135
200
|
* Build an {@link McpServer}, print the optional stderr banner, and apply every
|
package/dist/server/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/server/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,OAAO,EAAE,UAAU,EAAE,MAAM,oCAAoC,CAAC;AAEhE,OAAO,EAAE,SAAS,EAAE,2BAA2B,EAAE,MAAM,8BAA8B,CAAC;AAEtF,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACjE,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAEnD,cAAc,mBAAmB,CAAC;AAClC,OAAO,E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KAAK,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;YACnF,CAAC,CAAC;QACJ,wEAAwE;QACxE,0EAA0E;QAC1E,qEAAqE;QACrE,GAAG,CAAC,IAAI,KAAK,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;KACjD,CAAC,CAAC;IAEH,MAAM,QAAQ,GAAG,IAAI,CAAC,QAAQ,IAAI,IAAI,CAAC;IACvC,IAAI,QAAQ,KAAK,KAAK,EAAE,CAAC;QACvB,oBAAoB,CAAC,MAAM,EAAE,QAAQ,KAAK,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC;IAClE,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
package/dist/zod/index.d.ts
CHANGED
|
@@ -129,6 +129,25 @@ export interface ToolAnnotationsInput {
|
|
|
129
129
|
readOnly?: boolean;
|
|
130
130
|
/** Repeated identical calls have the same effect. Emitted ONLY when set. */
|
|
131
131
|
idempotent?: boolean;
|
|
132
|
+
/**
|
|
133
|
+
* Tool performs DESTRUCTIVE updates — it removes or overwrites something
|
|
134
|
+
* that cannot be put back, or its effect reaches a third party. Emitted
|
|
135
|
+
* ONLY when set.
|
|
136
|
+
*
|
|
137
|
+
* **Omitting this is not neutral.** `destructiveHint` defaults to TRUE in
|
|
138
|
+
* the MCP spec whenever `readOnlyHint` is false, so every `readOnly: false`
|
|
139
|
+
* tool that says nothing here is published as destructive. Measured
|
|
140
|
+
* 2026-09-21 across the fleet: 1,181 tools, of which 500 read as
|
|
141
|
+
* destructive and SIX as additive — because this option did not exist and
|
|
142
|
+
* the honest answer was literally inexpressible. A client that must raise
|
|
143
|
+
* the same alarm for "add a grocery item" as for "delete the frame" has
|
|
144
|
+
* been told nothing.
|
|
145
|
+
*
|
|
146
|
+
* The line the fleet draws is RECOVERABILITY, not "only appends": pass
|
|
147
|
+
* `false` for an edit the owner can undo, and `true` for a delete, a send,
|
|
148
|
+
* or anything another person sees. See `docs/CLIENT-BEHAVIOUR.md`.
|
|
149
|
+
*/
|
|
150
|
+
destructive?: boolean;
|
|
132
151
|
/**
|
|
133
152
|
* Tool reaches an open/unbounded external world (the live web/API) rather
|
|
134
153
|
* than a closed local computation. Emitted ONLY when set.
|
|
@@ -143,7 +162,9 @@ export interface ToolAnnotationsInput {
|
|
|
143
162
|
* injecting hints a tool didn't declare.
|
|
144
163
|
*
|
|
145
164
|
* @example toolAnnotations({ title: 'Search properties' }) // { title, readOnlyHint: true }
|
|
146
|
-
* @example toolAnnotations({ readOnly: false }) // { readOnlyHint: false }
|
|
165
|
+
* @example toolAnnotations({ readOnly: false }) // { readOnlyHint: false } — DESTRUCTIVE by spec default
|
|
166
|
+
* @example toolAnnotations({ readOnly: false, destructive: false })
|
|
167
|
+
* // { readOnlyHint: false, destructiveHint: false } — a recoverable edit
|
|
147
168
|
* @example toolAnnotations({ title: 'Search', idempotent: true, openWorld: true })
|
|
148
169
|
* // { title, readOnlyHint: true, idempotentHint: true, openWorldHint: true }
|
|
149
170
|
*/
|
package/dist/zod/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/zod/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAMxB,2CAA2C;AAC3C,eAAO,MAAM,WAAW,aAA8B,CAAC;AAEvD,uCAAuC;AACvC,eAAO,MAAM,SAAS,aAAiC,CAAC;AAExD,uEAAuE;AACvE,eAAO,MAAM,cAAc,aAAoB,CAAC;AAEhD;;;GAGG;AACH,eAAO,MAAM,OAAO,cAAe,CAAC;AAEpC;;;;;;GAMG;AACH,eAAO,MAAM,OAAO,aAEqD,CAAC;AAE1E;;;;;;GAMG;AACH,eAAO,MAAM,eAAe,aAG0D,CAAC;AAEvF;;;;;;;;;;;;;;GA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SAAS,GAAG,IAAI,GAAG,MAAM,CAOpE;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,GAAG,MAAM,GAAG,SAAS,CAuBlF;AAED,cAAc,oBAAoB,CAAC"}
|
package/dist/zod/index.js
CHANGED
|
@@ -160,7 +160,9 @@ export function calculateOffset(page, size) {
|
|
|
160
160
|
* injecting hints a tool didn't declare.
|
|
161
161
|
*
|
|
162
162
|
* @example toolAnnotations({ title: 'Search properties' }) // { title, readOnlyHint: true }
|
|
163
|
-
* @example toolAnnotations({ readOnly: false }) // { readOnlyHint: false }
|
|
163
|
+
* @example toolAnnotations({ readOnly: false }) // { readOnlyHint: false } — DESTRUCTIVE by spec default
|
|
164
|
+
* @example toolAnnotations({ readOnly: false, destructive: false })
|
|
165
|
+
* // { readOnlyHint: false, destructiveHint: false } — a recoverable edit
|
|
164
166
|
* @example toolAnnotations({ title: 'Search', idempotent: true, openWorld: true })
|
|
165
167
|
* // { title, readOnlyHint: true, idempotentHint: true, openWorldHint: true }
|
|
166
168
|
*/
|
|
@@ -169,6 +171,7 @@ export function toolAnnotations(opts = {}) {
|
|
|
169
171
|
...(opts.title !== undefined ? { title: opts.title } : {}),
|
|
170
172
|
readOnlyHint: opts.readOnly ?? true,
|
|
171
173
|
...(opts.idempotent !== undefined ? { idempotentHint: opts.idempotent } : {}),
|
|
174
|
+
...(opts.destructive !== undefined ? { destructiveHint: opts.destructive } : {}),
|
|
172
175
|
...(opts.openWorld !== undefined ? { openWorldHint: opts.openWorld } : {}),
|
|
173
176
|
};
|
|
174
177
|
}
|
package/dist/zod/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/zod/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,8EAA8E;AAC9E,Q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OAAO,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,IAAI,MAAM,CAAC,MAAM,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE,CAAC;AAC/E,CAAC;AAED,cAAc,oBAAoB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@chrischall/mcp-utils",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.2.0",
|
|
4
4
|
"description": "Shared scaffolding for the chrischall MCP fleet — server bootstrap, tool-result formatting, helpful errors, hardened env/config, a bearer API-client kit, zod atoms, session registries, a fetchproxy transport adapter, auth resolver skeletons, an in-memory test harness, and opt-in HTML helpers. The generic MCP glue hoisted out of ~19 sibling servers.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|