@frontmcp/sdk 1.5.6 → 1.6.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.
Files changed (89) hide show
  1. package/README.md +12 -5
  2. package/auth/flows/oauth.authorize.flow.d.ts +8 -0
  3. package/auth/flows/oauth.authorize.flow.d.ts.map +1 -1
  4. package/auth/flows/oauth.callback.flow.d.ts +8 -0
  5. package/auth/flows/oauth.callback.flow.d.ts.map +1 -1
  6. package/auth/flows/oauth.provider-callback.flow.d.ts +1 -0
  7. package/auth/flows/oauth.provider-callback.flow.d.ts.map +1 -1
  8. package/auth/flows/oauth.register.flow.d.ts +4 -0
  9. package/auth/flows/oauth.register.flow.d.ts.map +1 -1
  10. package/auth/flows/well-known.oauth-authorization-server.flow.d.ts.map +1 -1
  11. package/auth/instances/instance.local-primary-auth.d.ts +38 -0
  12. package/auth/instances/instance.local-primary-auth.d.ts.map +1 -1
  13. package/common/interfaces/tool.interface.d.ts +33 -1
  14. package/common/interfaces/tool.interface.d.ts.map +1 -1
  15. package/common/metadata/front-mcp.metadata.d.ts +34 -0
  16. package/common/metadata/front-mcp.metadata.d.ts.map +1 -1
  17. package/common/types/options/transport/interfaces.d.ts +14 -0
  18. package/common/types/options/transport/interfaces.d.ts.map +1 -1
  19. package/common/types/options/transport/schema.d.ts +4 -0
  20. package/common/types/options/transport/schema.d.ts.map +1 -1
  21. package/common/utils/decide-request-intent.utils.d.ts +3 -3
  22. package/common/utils/decide-request-intent.utils.d.ts.map +1 -1
  23. package/context/frontmcp-context.d.ts +46 -1
  24. package/context/frontmcp-context.d.ts.map +1 -1
  25. package/elicitation/helpers/elicit.helper.d.ts.map +1 -1
  26. package/elicitation/helpers/index.d.ts +1 -0
  27. package/elicitation/helpers/index.d.ts.map +1 -1
  28. package/elicitation/helpers/mrtr-request.helper.d.ts +83 -0
  29. package/elicitation/helpers/mrtr-request.helper.d.ts.map +1 -0
  30. package/errors/index.d.ts +1 -0
  31. package/errors/index.d.ts.map +1 -1
  32. package/errors/mrtr.error.d.ts +55 -0
  33. package/errors/mrtr.error.d.ts.map +1 -0
  34. package/esm/index.mjs +2862 -470
  35. package/front-mcp/front-mcp.providers.d.ts +4 -0
  36. package/front-mcp/front-mcp.providers.d.ts.map +1 -1
  37. package/index.d.ts +10 -4
  38. package/index.d.ts.map +1 -1
  39. package/index.js +3134 -731
  40. package/job/enclave/job-enclave.bridge.d.ts.map +1 -1
  41. package/package.json +11 -11
  42. package/remote-mcp/mcp-client.service.d.ts +7 -0
  43. package/remote-mcp/mcp-client.service.d.ts.map +1 -1
  44. package/remote-mcp/mcp-client.types.d.ts +19 -6
  45. package/remote-mcp/mcp-client.types.d.ts.map +1 -1
  46. package/remote-mcp/mcp-stateless-client.adapter.d.ts +85 -0
  47. package/remote-mcp/mcp-stateless-client.adapter.d.ts.map +1 -0
  48. package/scope/flows/http.request.flow.d.ts +9 -3
  49. package/scope/flows/http.request.flow.d.ts.map +1 -1
  50. package/task/helpers/task-runner.d.ts.map +1 -1
  51. package/task/task.types.d.ts +16 -0
  52. package/task/task.types.d.ts.map +1 -1
  53. package/tool/flows/call-tool.flow.d.ts.map +1 -1
  54. package/transport/flows/handle.mcp-20260728.flow.d.ts +77 -0
  55. package/transport/flows/handle.mcp-20260728.flow.d.ts.map +1 -0
  56. package/transport/mcp-20260728/client/header-params.d.ts +22 -0
  57. package/transport/mcp-20260728/client/header-params.d.ts.map +1 -0
  58. package/transport/mcp-20260728/client/index.d.ts +8 -0
  59. package/transport/mcp-20260728/client/index.d.ts.map +1 -0
  60. package/transport/mcp-20260728/client/mcp-stateless.client.d.ts +157 -0
  61. package/transport/mcp-20260728/client/mcp-stateless.client.d.ts.map +1 -0
  62. package/transport/mcp-20260728/discover.d.ts +28 -0
  63. package/transport/mcp-20260728/discover.d.ts.map +1 -0
  64. package/transport/mcp-20260728/dispatcher.d.ts +77 -0
  65. package/transport/mcp-20260728/dispatcher.d.ts.map +1 -0
  66. package/transport/mcp-20260728/header-codec.d.ts +32 -0
  67. package/transport/mcp-20260728/header-codec.d.ts.map +1 -0
  68. package/transport/mcp-20260728/index.d.ts +22 -0
  69. package/transport/mcp-20260728/index.d.ts.map +1 -0
  70. package/transport/mcp-20260728/mrtr.d.ts +143 -0
  71. package/transport/mcp-20260728/mrtr.d.ts.map +1 -0
  72. package/transport/mcp-20260728/protocol-20260728.constants.d.ts +46 -0
  73. package/transport/mcp-20260728/protocol-20260728.constants.d.ts.map +1 -0
  74. package/transport/mcp-20260728/request-notifications.d.ts +70 -0
  75. package/transport/mcp-20260728/request-notifications.d.ts.map +1 -0
  76. package/transport/mcp-20260728/request-state.d.ts +76 -0
  77. package/transport/mcp-20260728/request-state.d.ts.map +1 -0
  78. package/transport/mcp-20260728/request-validation.d.ts +83 -0
  79. package/transport/mcp-20260728/request-validation.d.ts.map +1 -0
  80. package/transport/mcp-20260728/result-decorator.d.ts +62 -0
  81. package/transport/mcp-20260728/result-decorator.d.ts.map +1 -0
  82. package/transport/mcp-20260728/subscriptions.d.ts +47 -0
  83. package/transport/mcp-20260728/subscriptions.d.ts.map +1 -0
  84. package/transport/mcp-20260728/tasks-extension.d.ts +90 -0
  85. package/transport/mcp-20260728/tasks-extension.d.ts.map +1 -0
  86. package/transport/mcp-handlers/call-tool-request.handler.d.ts.map +1 -1
  87. package/transport/mcp-handlers/index.d.ts +556 -556
  88. package/transport/mcp-handlers/index.d.ts.map +1 -1
  89. package/transport/transport.registry.d.ts.map +1 -1
@@ -0,0 +1,76 @@
1
+ /**
2
+ * Integrity-protected `requestState` for MRTR — protocol 2026-07-28, SEP-2322.
3
+ *
4
+ * The spec is explicit that `requestState` round-trips through the client and
5
+ * MUST therefore be treated as attacker-controlled input:
6
+ *
7
+ * > If `requestState` influences authorization, resource access, or business
8
+ * > logic, servers **MUST** protect its integrity (e.g. HMAC or AEAD) and
9
+ * > **MUST** reject state that fails verification.
10
+ *
11
+ * It also asks servers to bound replay by binding the state to
12
+ * the authenticated principal, a short expiry, and the originating request.
13
+ * All three are enforced here — a blob minted for user A's `tools/call echo`
14
+ * is rejected if it comes back from user B, after it expires, or on a
15
+ * different call.
16
+ *
17
+ * Format: `<base64url(payload JSON)>.<base64url(HMAC-SHA256)>`.
18
+ */
19
+ import { type InputResponses } from '@frontmcp/protocol';
20
+ /** How long a minted state stays redeemable. */
21
+ export declare const DEFAULT_REQUEST_STATE_TTL_MS: number;
22
+ /**
23
+ * Largest `requestState` this server will even attempt to verify.
24
+ *
25
+ * The blob is attacker-controlled and reaches an HMAC before anything else can
26
+ * reject it, so an unbounded value would let a client burn CPU at will. 256 KiB
27
+ * is far above any legitimate accumulation of `InputResponses` (sampling
28
+ * completions are the biggest realistic contributor) while keeping the work per
29
+ * request bounded.
30
+ */
31
+ export declare const MAX_REQUEST_STATE_BYTES: number;
32
+ export interface RequestStateBinding {
33
+ /** Authenticated principal, or a stable stand-in for anonymous callers. */
34
+ principal: string;
35
+ /** Digest of the originating request (see {@link computeRequestBinding}). */
36
+ binding: string;
37
+ }
38
+ export type RequestStateDecodeResult = {
39
+ ok: true;
40
+ responses: InputResponses;
41
+ } | {
42
+ ok: false;
43
+ reason: 'absent' | 'malformed' | 'bad-signature' | 'expired' | 'principal-mismatch' | 'request-mismatch';
44
+ };
45
+ /**
46
+ * Resolve the HMAC key.
47
+ *
48
+ * Mirrors the credential vault's pepper resolution (`VAULT_SECRET ?? JWT_SECRET`,
49
+ * then a random per-process value) so a multi-node deployment that already
50
+ * configures one of those secrets gets cross-node-verifiable state for free.
51
+ * Without a configured secret the key is per-process, which still blocks
52
+ * tampering but makes state non-portable across nodes — acceptable because a
53
+ * rejected state only costs the client one extra round trip.
54
+ */
55
+ export declare function getRequestStateKey(): Uint8Array;
56
+ /**
57
+ * Bind state to the request that produced it.
58
+ *
59
+ * Uses the method plus the identity-bearing params (tool/prompt name, resource
60
+ * URI, arguments) — deliberately excluding `_meta`, `inputResponses` and
61
+ * `requestState` itself, all of which legitimately differ between the initial
62
+ * request and the retry.
63
+ */
64
+ export declare function computeRequestBinding(method: string, params: Record<string, unknown> | undefined): string;
65
+ /** Mint an integrity-protected `requestState`. */
66
+ export declare function encodeRequestState(responses: InputResponses, binding: RequestStateBinding, ttlMs?: number): string;
67
+ /**
68
+ * Verify and decode a client-echoed `requestState`.
69
+ *
70
+ * Every failure mode is distinguished so callers can log the cause, but they
71
+ * all lead to the same outcome for the client: the exchange restarts. Returning
72
+ * an error instead would strand a caller whose only mistake was letting the
73
+ * state expire.
74
+ */
75
+ export declare function decodeRequestState(state: unknown, expected: RequestStateBinding): RequestStateDecodeResult;
76
+ //# sourceMappingURL=request-state.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"request-state.d.ts","sourceRoot":"","sources":["../../../src/transport/mcp-20260728/request-state.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AACH,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAGzD,gDAAgD;AAChD,eAAO,MAAM,4BAA4B,QAAiB,CAAC;AAE3D;;;;;;;;GAQG;AACH,eAAO,MAAM,uBAAuB,QAAa,CAAC;AAalD,MAAM,WAAW,mBAAmB;IAClC,2EAA2E;IAC3E,SAAS,EAAE,MAAM,CAAC;IAClB,6EAA6E;IAC7E,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,MAAM,wBAAwB,GAChC;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,SAAS,EAAE,cAAc,CAAA;CAAE,GACvC;IACE,EAAE,EAAE,KAAK,CAAC;IACV,MAAM,EAAE,QAAQ,GAAG,WAAW,GAAG,eAAe,GAAG,SAAS,GAAG,oBAAoB,GAAG,kBAAkB,CAAC;CAC1G,CAAC;AAIN;;;;;;;;;GASG;AACH,wBAAgB,kBAAkB,IAAI,UAAU,CAK/C;AAOD;;;;;;;GAOG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,GAAG,MAAM,CAMzG;AAyBD,kDAAkD;AAClD,wBAAgB,kBAAkB,CAChC,SAAS,EAAE,cAAc,EACzB,OAAO,EAAE,mBAAmB,EAC5B,KAAK,GAAE,MAAqC,GAC3C,MAAM,CASR;AAED;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,mBAAmB,GAAG,wBAAwB,CA8B1G"}
@@ -0,0 +1,83 @@
1
+ export interface JsonRpcErrorPayload {
2
+ code: number;
3
+ message: string;
4
+ data?: unknown;
5
+ }
6
+ export type ValidationFailure = {
7
+ ok: false;
8
+ status: number;
9
+ error: JsonRpcErrorPayload;
10
+ };
11
+ export type ValidationSuccess = {
12
+ ok: true;
13
+ version: string;
14
+ };
15
+ export type ValidationResult = ValidationSuccess | ValidationFailure;
16
+ /** Case-insensitive header read across the shapes Node/Express/Web produce. */
17
+ export declare function readHeader(headers: Record<string, unknown> | undefined, name: string): string | undefined;
18
+ /** All `Mcp-Param-*` headers, keyed by the lowercased suffix after the prefix. */
19
+ export declare function readParamHeaders(headers: Record<string, unknown> | undefined): Map<string, string>;
20
+ /**
21
+ * Decide whether this request belongs to the 2026-07-28 pipeline.
22
+ *
23
+ * Claimed when ANY of:
24
+ * - the body declares a version via the 2026-only `_meta` key (present only in
25
+ * this revision, so its presence is unambiguous);
26
+ * - the `MCP-Protocol-Version` header names something that is not a revision the
27
+ * legacy pipeline knows (so an unknown/future version gets a proper
28
+ * `-32022` instead of a confusing session error);
29
+ * - the method exists only in this revision.
30
+ */
31
+ export declare function declaresProtocol20260728(params: {
32
+ headers: Record<string, unknown> | undefined;
33
+ body: unknown;
34
+ }): boolean;
35
+ export declare function isProtocol20260728Request(params: {
36
+ headers: Record<string, unknown> | undefined;
37
+ body: unknown;
38
+ /**
39
+ * Revision to assume for a request that identifies none. Defaults to
40
+ * `'legacy'`, so an unconfigured deployment behaves exactly as before.
41
+ */
42
+ defaultVersion?: '2026-07-28' | 'legacy';
43
+ }): boolean;
44
+ /**
45
+ * Walk a JSON Schema and collect `x-mcp-header` annotations.
46
+ *
47
+ * Only *statically reachable* properties count — the chain must consist purely
48
+ * of `properties` keys. An annotation behind `items`, `$ref`, or a composition
49
+ * keyword is invalid per the spec and is ignored here rather than being
50
+ * enforced against the client.
51
+ */
52
+ export declare function collectHeaderParams(schema: unknown, path?: string[], out?: Map<string, string[]>): Map<string, string[]>;
53
+ export interface Validate20260728Options {
54
+ headers: Record<string, unknown> | undefined;
55
+ body: Record<string, unknown>;
56
+ /** Resolves a tool's input JSON Schema so `x-mcp-header` can be validated. */
57
+ lookupToolSchema?: (toolName: string) => Record<string, unknown> | null | undefined;
58
+ /**
59
+ * Enforce the mirrored-header contract.
60
+ *
61
+ * `true` when the CLIENT declared 2026-07-28 — it opted into SEP-2243, so the
62
+ * headers are required and a mismatch is a hard error.
63
+ *
64
+ * `false` when the SERVER defaulted to this revision for a request that named
65
+ * none (see `transport.defaultProtocolVersion`). Such a client never agreed to
66
+ * send the headers, so requiring them would turn a working call into a `400`.
67
+ * Headers that ARE present are still validated — a disagreement is a genuine
68
+ * routing hazard either way.
69
+ */
70
+ strictHeaders?: boolean;
71
+ }
72
+ /**
73
+ * Validate a claimed 2026-07-28 request.
74
+ *
75
+ * Order matters and mirrors the spec's own precedence: transport-level header
76
+ * presence/agreement first, then version support, then the per-method mirrored
77
+ * values. That way a client sending a wrong version AND a wrong method header
78
+ * learns about the version first, which is the actionable one.
79
+ */
80
+ export declare function validate20260728Request(options: Validate20260728Options): ValidationResult;
81
+ /** The revision this pipeline implements — exported for callers building results. */
82
+ export declare const IMPLEMENTED_PROTOCOL_VERSION: "2026-07-28";
83
+ //# sourceMappingURL=request-validation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"request-validation.d.ts","sourceRoot":"","sources":["../../../src/transport/mcp-20260728/request-validation.ts"],"names":[],"mappings":"AAuBA,MAAM,WAAW,mBAAmB;IACl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AAG,GAAE,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,CAAa,GACrC,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAevB;AAYD,MAAM,WAAW,uBAAuB;IACtC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,CAAC;IAC7C,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC9B,8EAA8E;IAC9E,gBAAgB,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,GAAG,SAAS,CAAC;IACpF;;;;;;;;;;;OAWG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB;AAED;;;;;;;GAOG;AACH,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,uBAAuB,GAAG,gBAAgB,CAkF1F;AA6ED,qFAAqF;AACrF,eAAO,MAAM,4BAA4B,cAAsB,CAAC"}
@@ -0,0 +1,62 @@
1
+ /**
2
+ * Result shaping for protocol 2026-07-28.
3
+ *
4
+ * Three additions ride on every response of this revision:
5
+ * - `resultType` — REQUIRED on all results, so the client can tell a final
6
+ * result from an MRTR interim one without guessing.
7
+ * - `_meta["io.modelcontextprotocol/serverInfo"]` — the identity that used to
8
+ * arrive once via `initialize`.
9
+ * - `ttlMs` + `cacheScope` — REQUIRED on `CacheableResult` methods only.
10
+ *
11
+ * Applied at the dispatcher boundary rather than inside each handler, so the
12
+ * existing handlers (shared with every older transport) stay untouched and no
13
+ * legacy response can accidentally grow these fields.
14
+ */
15
+ import { type Implementation } from '@frontmcp/protocol';
16
+ export interface DecorateResultOptions {
17
+ /** JSON-RPC method that produced this result. */
18
+ method: string;
19
+ /** Server identity advertised back to the client. */
20
+ serverInfo: Implementation;
21
+ /**
22
+ * `private` when the payload may vary by authorization context, `public` when
23
+ * it is identical for every caller. Getting this wrong lets a shared proxy
24
+ * serve one tenant's tool list to another, so the default is `private`.
25
+ */
26
+ cacheScope?: 'public' | 'private';
27
+ /** Override for the per-method TTL default. */
28
+ ttlMs?: number;
29
+ /**
30
+ * OpenTelemetry context to echo back (SEP-414).
31
+ *
32
+ * Propagating `traceparent` on the response lets a client stitch its span to
33
+ * the server's without an out-of-band correlation id.
34
+ */
35
+ traceContext?: Record<string, string>;
36
+ }
37
+ /** Attach the 2026-07-28 envelope fields to a handler's raw result. */
38
+ export declare function decorateResult(result: Record<string, unknown>, options: DecorateResultOptions): Record<string, unknown>;
39
+ /**
40
+ * Sort list entries by name so repeated calls agree byte-for-byte.
41
+ *
42
+ * 2026-07-28 asks servers to return `tools/list` in a deterministic order so
43
+ * clients can cache and so an LLM's prompt cache keeps hitting. Registration
44
+ * order is already stable in practice, but it shifts the moment a tool is
45
+ * registered dynamically — sorting makes the guarantee explicit.
46
+ *
47
+ * Applied only on the 2026 path; older revisions keep their existing order.
48
+ *
49
+ * Ordering is guaranteed WITHIN a page. Concatenating paginated pages does not
50
+ * yield a globally sorted list — the cursor defines page boundaries, and this
51
+ * sorts each page as it is returned.
52
+ */
53
+ export declare function orderListResult(method: string, result: Record<string, unknown>): Record<string, unknown>;
54
+ /**
55
+ * Choose a cache scope for a request.
56
+ *
57
+ * Anonymous/public traffic carries no per-user variation and is safe to share;
58
+ * anything tied to a token is `private` so intermediaries cannot cross
59
+ * authorization contexts.
60
+ */
61
+ export declare function resolveCacheScope(isAnonymous: boolean): 'public' | 'private';
62
+ //# sourceMappingURL=result-decorator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"result-decorator.d.ts","sourceRoot":"","sources":["../../../src/transport/mcp-20260728/result-decorator.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,OAAO,EAAqB,KAAK,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAI5E,MAAM,WAAW,qBAAqB;IACpC,iDAAiD;IACjD,MAAM,EAAE,MAAM,CAAC;IACf,qDAAqD;IACrD,UAAU,EAAE,cAAc,CAAC;IAC3B;;;;OAIG;IACH,UAAU,CAAC,EAAE,QAAQ,GAAG,SAAS,CAAC;IAClC,+CAA+C;IAC/C,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;;;OAKG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACvC;AAED,uEAAuE;AACvE,wBAAgB,cAAc,CAC5B,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC/B,OAAO,EAAE,qBAAqB,GAC7B,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAsBzB;AAUD;;;;;;;;;;;;;GAaG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAcxG;AAED;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,WAAW,EAAE,OAAO,GAAG,QAAQ,GAAG,SAAS,CAE5E"}
@@ -0,0 +1,47 @@
1
+ /**
2
+ * `subscriptions/listen` — protocol 2026-07-28, SEP-2575.
3
+ *
4
+ * Replaces the standalone HTTP GET stream and the
5
+ * `resources/subscribe` / `resources/unsubscribe` RPC pair with ONE long-lived
6
+ * POST-response stream. Two rules shape the implementation:
7
+ *
8
+ * - **Opt-in only.** The server MUST NOT push a notification type the client
9
+ * did not name in the request's filter.
10
+ * - **Acknowledge first.** The acknowledgement MUST be the first message
11
+ * carrying the subscription's id, so a client never sees a change
12
+ * notification before it knows which of its requests was honored.
13
+ *
14
+ * The stream is produced as an `AsyncIterable<Uint8Array>` of SSE frames rather
15
+ * than by writing to a runtime-specific response object, so the same code
16
+ * renders on Node and on a Web `Response` body.
17
+ */
18
+ import { type SubscriptionFilter } from '@frontmcp/protocol';
19
+ import { type Scope } from '../../scope';
20
+ export interface SubscriptionStreamOptions {
21
+ scope: Scope;
22
+ /** JSON-RPC id of the `subscriptions/listen` request; doubles as the stream id. */
23
+ subscriptionId: string | number;
24
+ /** Notification types the client asked for. */
25
+ requested: SubscriptionFilter;
26
+ /** Fires when the client disconnects so the registry listeners are released. */
27
+ signal?: AbortSignal;
28
+ }
29
+ /**
30
+ * Narrow the client's filter to what this scope can actually deliver.
31
+ *
32
+ * A server that has no prompts cannot honor `promptsListChanged`; the spec says
33
+ * to omit it from the acknowledgement rather than accept and stay silent, so
34
+ * the client knows not to wait for it.
35
+ */
36
+ export declare function resolveAcknowledgedFilter(scope: Scope, requested: SubscriptionFilter): SubscriptionFilter;
37
+ /**
38
+ * Build the SSE body for a `subscriptions/listen` request.
39
+ *
40
+ * Returns the acknowledged filter alongside the stream so the caller can log or
41
+ * assert on it without consuming the stream.
42
+ */
43
+ export declare function createSubscriptionStream(options: SubscriptionStreamOptions): {
44
+ acknowledged: SubscriptionFilter;
45
+ stream: AsyncIterable<Uint8Array>;
46
+ };
47
+ //# sourceMappingURL=subscriptions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"subscriptions.d.ts","sourceRoot":"","sources":["../../../src/transport/mcp-20260728/subscriptions.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AACH,OAAO,EAAwD,KAAK,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAEnH,OAAO,EAAE,KAAK,KAAK,EAAE,MAAM,aAAa,CAAC;AAKzC,MAAM,WAAW,yBAAyB;IACxC,KAAK,EAAE,KAAK,CAAC;IACb,mFAAmF;IACnF,cAAc,EAAE,MAAM,GAAG,MAAM,CAAC;IAChC,+CAA+C;IAC/C,SAAS,EAAE,kBAAkB,CAAC;IAC9B,gFAAgF;IAChF,MAAM,CAAC,EAAE,WAAW,CAAC;CACtB;AAED;;;;;;GAMG;AACH,wBAAgB,yBAAyB,CAAC,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,kBAAkB,GAAG,kBAAkB,CAiBzG;AAsBD;;;;;GAKG;AACH,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,yBAAyB,GAAG;IAC5E,YAAY,EAAE,kBAAkB,CAAC;IACjC,MAAM,EAAE,aAAa,CAAC,UAAU,CAAC,CAAC;CACnC,CA2GA"}
@@ -0,0 +1,90 @@
1
+ /**
2
+ * `io.modelcontextprotocol/tasks` extension — protocol 2026-07-28, SEP-2663.
3
+ *
4
+ * Tasks moved out of the core protocol into an official extension and were
5
+ * redesigned:
6
+ *
7
+ * - The blocking `tasks/result` is gone; clients poll `tasks/get`.
8
+ * - `tasks/list` is gone entirely.
9
+ * - `tasks/update` is new — it feeds `inputResponses` to a task that has paused
10
+ * in `input_required`, which is how a long-running operation does
11
+ * human-in-the-loop without a second connection.
12
+ * - Servers MAY return a task handle unsolicited; there is no per-request
13
+ * `params.task` opt-in any more. The gate is the CLIENT declaring the
14
+ * extension in its per-request capabilities.
15
+ *
16
+ * The wire shape also renames `ttl` → `ttlMs` and `pollInterval` → `pollIntervalMs`,
17
+ * and a task-bearing response is discriminated by `resultType: "task"` rather
18
+ * than by a `task` field on a normal result.
19
+ */
20
+ import { type Scope } from '../../scope';
21
+ import { type TaskRecord } from '../../task/task.types';
22
+ /** Extension identifier, as declared in capabilities. */
23
+ export declare const TASKS_EXTENSION_ID = "io.modelcontextprotocol/tasks";
24
+ /** RPCs this extension defines. */
25
+ export declare const TASKS_EXTENSION_METHODS: string[];
26
+ /** Terminal statuses — a task in one of these never changes again. */
27
+ export declare const TERMINAL_TASK_STATUSES: string[];
28
+ /** True when the client declared support for the tasks extension on this request. */
29
+ export declare function clientSupportsTasks(clientCapabilities: Record<string, unknown>): boolean;
30
+ /**
31
+ * Project a stored task onto the 2026-07-28 `Task` wire shape.
32
+ *
33
+ * `result` / `error` only appear once the task is terminal, and `inputRequests`
34
+ * only while it is paused waiting for the client — mirroring what the client is
35
+ * actually allowed to act on at each point in the lifecycle.
36
+ */
37
+ export declare function taskToWire20260728(record: TaskRecord): Record<string, unknown>;
38
+ /**
39
+ * Build the `CreateTaskResult` a server returns instead of an inline result.
40
+ *
41
+ * Discriminated by `resultType: "task"`, which is why the shared result
42
+ * decorator must not overwrite it.
43
+ */
44
+ export declare function buildCreateTaskResult(record: TaskRecord): Record<string, unknown>;
45
+ /**
46
+ * Derive the owner key a task is stored under.
47
+ *
48
+ * 2026-07-28 has no protocol-level sessions, so a task must be keyed by
49
+ * something that survives across independent requests — the authenticated
50
+ * principal. Anonymous callers have no such identity: two unrelated users would
51
+ * share one key and could read each other's task results, so tasks are refused
52
+ * rather than silently pooled.
53
+ */
54
+ export declare function resolveTaskOwner(principal: string): {
55
+ ok: true;
56
+ owner: string;
57
+ } | {
58
+ ok: false;
59
+ reason: string;
60
+ };
61
+ export type TasksDispatchOutcome = {
62
+ kind: 'result';
63
+ result: Record<string, unknown>;
64
+ } | {
65
+ kind: 'error';
66
+ status: number;
67
+ error: {
68
+ code: number;
69
+ message: string;
70
+ data?: unknown;
71
+ };
72
+ };
73
+ export interface TasksDispatchOptions {
74
+ scope: Scope;
75
+ method: string;
76
+ params: Record<string, unknown>;
77
+ /** Owner key the task is stored under (see {@link resolveTaskOwner}). */
78
+ owner: string;
79
+ /** Re-runs a resumed task in the background. */
80
+ resume: (record: TaskRecord) => Promise<void>;
81
+ }
82
+ /**
83
+ * Serve `tasks/get`, `tasks/update` and `tasks/cancel`.
84
+ *
85
+ * These read and mutate the SAME store the 2025-era task methods use, so a
86
+ * task created under either revision is visible to the other — only the wire
87
+ * shape and the method set differ.
88
+ */
89
+ export declare function dispatchTasksMethod(options: TasksDispatchOptions): Promise<TasksDispatchOutcome>;
90
+ //# sourceMappingURL=tasks-extension.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tasks-extension.d.ts","sourceRoot":"","sources":["../../../src/transport/mcp-20260728/tasks-extension.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AACH,OAAO,EAAE,KAAK,KAAK,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,KAAK,UAAU,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EAAyE;IACzE,KAAK,EAAE,MAAM,CAAC;IACd,gDAAgD;IAChD,MAAM,EAAE,CAAC,MAAM,EAAE,UAAU,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CAC/C;AAID;;;;;;GAMG;AACH,wBAAsB,mBAAmB,CAAC,OAAO,EAAE,oBAAoB,GAAG,OAAO,CAAC,oBAAoB,CAAC,CA0EtG"}
@@ -1 +1 @@
1
- {"version":3,"file":"call-tool-request.handler.d.ts","sourceRoot":"","sources":["../../../src/transport/mcp-handlers/call-tool-request.handler.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,eAAe,EACpB,KAAK,cAAc,EACpB,MAAM,oBAAoB,CAAC;AAW5B,OAAO,EAAE,KAAK,UAAU,EAAE,KAAK,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAE/E,MAAM,CAAC,OAAO,UAAU,sBAAsB,CAAC,EAC7C,KAAK,GACN,EAAE,iBAAiB,GAAG,UAAU,CAAC,eAAe,EAAE,cAAc,CAAC,CAyEjE"}
1
+ {"version":3,"file":"call-tool-request.handler.d.ts","sourceRoot":"","sources":["../../../src/transport/mcp-handlers/call-tool-request.handler.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,eAAe,EACpB,KAAK,cAAc,EACpB,MAAM,oBAAoB,CAAC;AAa5B,OAAO,EAAE,KAAK,UAAU,EAAE,KAAK,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAE/E,MAAM,CAAC,OAAO,UAAU,sBAAsB,CAAC,EAC7C,KAAK,GACN,EAAE,iBAAiB,GAAG,UAAU,CAAC,eAAe,EAAE,cAAc,CAAC,CAmFjE"}