@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.
- package/README.md +12 -5
- package/auth/flows/oauth.authorize.flow.d.ts +8 -0
- package/auth/flows/oauth.authorize.flow.d.ts.map +1 -1
- package/auth/flows/oauth.callback.flow.d.ts +8 -0
- package/auth/flows/oauth.callback.flow.d.ts.map +1 -1
- package/auth/flows/oauth.provider-callback.flow.d.ts +1 -0
- package/auth/flows/oauth.provider-callback.flow.d.ts.map +1 -1
- package/auth/flows/oauth.register.flow.d.ts +4 -0
- package/auth/flows/oauth.register.flow.d.ts.map +1 -1
- package/auth/flows/well-known.oauth-authorization-server.flow.d.ts.map +1 -1
- package/auth/instances/instance.local-primary-auth.d.ts +38 -0
- package/auth/instances/instance.local-primary-auth.d.ts.map +1 -1
- package/common/interfaces/tool.interface.d.ts +33 -1
- package/common/interfaces/tool.interface.d.ts.map +1 -1
- package/common/metadata/front-mcp.metadata.d.ts +34 -0
- package/common/metadata/front-mcp.metadata.d.ts.map +1 -1
- package/common/types/options/transport/interfaces.d.ts +14 -0
- package/common/types/options/transport/interfaces.d.ts.map +1 -1
- package/common/types/options/transport/schema.d.ts +4 -0
- package/common/types/options/transport/schema.d.ts.map +1 -1
- package/common/utils/decide-request-intent.utils.d.ts +3 -3
- package/common/utils/decide-request-intent.utils.d.ts.map +1 -1
- package/context/frontmcp-context.d.ts +46 -1
- package/context/frontmcp-context.d.ts.map +1 -1
- package/elicitation/helpers/elicit.helper.d.ts.map +1 -1
- package/elicitation/helpers/index.d.ts +1 -0
- package/elicitation/helpers/index.d.ts.map +1 -1
- package/elicitation/helpers/mrtr-request.helper.d.ts +83 -0
- package/elicitation/helpers/mrtr-request.helper.d.ts.map +1 -0
- package/errors/index.d.ts +1 -0
- package/errors/index.d.ts.map +1 -1
- package/errors/mrtr.error.d.ts +55 -0
- package/errors/mrtr.error.d.ts.map +1 -0
- package/esm/index.mjs +2862 -470
- package/front-mcp/front-mcp.providers.d.ts +4 -0
- package/front-mcp/front-mcp.providers.d.ts.map +1 -1
- package/index.d.ts +10 -4
- package/index.d.ts.map +1 -1
- package/index.js +3134 -731
- package/job/enclave/job-enclave.bridge.d.ts.map +1 -1
- package/package.json +11 -11
- package/remote-mcp/mcp-client.service.d.ts +7 -0
- package/remote-mcp/mcp-client.service.d.ts.map +1 -1
- package/remote-mcp/mcp-client.types.d.ts +19 -6
- package/remote-mcp/mcp-client.types.d.ts.map +1 -1
- package/remote-mcp/mcp-stateless-client.adapter.d.ts +85 -0
- package/remote-mcp/mcp-stateless-client.adapter.d.ts.map +1 -0
- package/scope/flows/http.request.flow.d.ts +9 -3
- package/scope/flows/http.request.flow.d.ts.map +1 -1
- package/task/helpers/task-runner.d.ts.map +1 -1
- package/task/task.types.d.ts +16 -0
- package/task/task.types.d.ts.map +1 -1
- package/tool/flows/call-tool.flow.d.ts.map +1 -1
- package/transport/flows/handle.mcp-20260728.flow.d.ts +77 -0
- package/transport/flows/handle.mcp-20260728.flow.d.ts.map +1 -0
- package/transport/mcp-20260728/client/header-params.d.ts +22 -0
- package/transport/mcp-20260728/client/header-params.d.ts.map +1 -0
- package/transport/mcp-20260728/client/index.d.ts +8 -0
- package/transport/mcp-20260728/client/index.d.ts.map +1 -0
- package/transport/mcp-20260728/client/mcp-stateless.client.d.ts +157 -0
- package/transport/mcp-20260728/client/mcp-stateless.client.d.ts.map +1 -0
- package/transport/mcp-20260728/discover.d.ts +28 -0
- package/transport/mcp-20260728/discover.d.ts.map +1 -0
- package/transport/mcp-20260728/dispatcher.d.ts +77 -0
- package/transport/mcp-20260728/dispatcher.d.ts.map +1 -0
- package/transport/mcp-20260728/header-codec.d.ts +32 -0
- package/transport/mcp-20260728/header-codec.d.ts.map +1 -0
- package/transport/mcp-20260728/index.d.ts +22 -0
- package/transport/mcp-20260728/index.d.ts.map +1 -0
- package/transport/mcp-20260728/mrtr.d.ts +143 -0
- package/transport/mcp-20260728/mrtr.d.ts.map +1 -0
- package/transport/mcp-20260728/protocol-20260728.constants.d.ts +46 -0
- package/transport/mcp-20260728/protocol-20260728.constants.d.ts.map +1 -0
- package/transport/mcp-20260728/request-notifications.d.ts +70 -0
- package/transport/mcp-20260728/request-notifications.d.ts.map +1 -0
- package/transport/mcp-20260728/request-state.d.ts +76 -0
- package/transport/mcp-20260728/request-state.d.ts.map +1 -0
- package/transport/mcp-20260728/request-validation.d.ts +83 -0
- package/transport/mcp-20260728/request-validation.d.ts.map +1 -0
- package/transport/mcp-20260728/result-decorator.d.ts +62 -0
- package/transport/mcp-20260728/result-decorator.d.ts.map +1 -0
- package/transport/mcp-20260728/subscriptions.d.ts +47 -0
- package/transport/mcp-20260728/subscriptions.d.ts.map +1 -0
- package/transport/mcp-20260728/tasks-extension.d.ts +90 -0
- package/transport/mcp-20260728/tasks-extension.d.ts.map +1 -0
- package/transport/mcp-handlers/call-tool-request.handler.d.ts.map +1 -1
- package/transport/mcp-handlers/index.d.ts +556 -556
- package/transport/mcp-handlers/index.d.ts.map +1 -1
- package/transport/transport.registry.d.ts.map +1 -1
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MCP client for protocol revision 2026-07-28.
|
|
3
|
+
*
|
|
4
|
+
* The upstream `@modelcontextprotocol/sdk` client speaks at most `2025-11-25`,
|
|
5
|
+
* so talking to a 2026 server needs its own implementation. It is small on
|
|
6
|
+
* purpose — the revision is stateless, so there is no session, no handshake and
|
|
7
|
+
* no reconnect logic to manage. What it DOES own is the three behaviours a
|
|
8
|
+
* conforming client must implement:
|
|
9
|
+
*
|
|
10
|
+
* - **Request metadata.** Per-request `_meta` plus the mirrored
|
|
11
|
+
* `MCP-Protocol-Version` / `Mcp-Method` / `Mcp-Name` / `Mcp-Param-*` headers.
|
|
12
|
+
* - **MRTR.** An `input_required` result is answered by gathering the requested
|
|
13
|
+
* input and re-issuing the ORIGINAL request — with a NEW JSON-RPC id and the
|
|
14
|
+
* `requestState` echoed back verbatim.
|
|
15
|
+
* - **Tasks.** A `resultType: "task"` handle is polled through `tasks/get`
|
|
16
|
+
* until it reaches a terminal state, answering `input_required` along the way
|
|
17
|
+
* via `tasks/update`.
|
|
18
|
+
*
|
|
19
|
+
* @module transport/mcp-20260728/client
|
|
20
|
+
*/
|
|
21
|
+
import { type Implementation } from '@frontmcp/protocol';
|
|
22
|
+
import { TERMINAL_TASK_STATUSES } from '../tasks-extension';
|
|
23
|
+
/** Answers the client supplies when a server asks for input via MRTR. */
|
|
24
|
+
export interface McpStatelessInputHandlers {
|
|
25
|
+
/** Handle an `elicitation/create` request. */
|
|
26
|
+
onElicit?: (params: Record<string, unknown>) => Promise<Record<string, unknown>> | Record<string, unknown>;
|
|
27
|
+
/** Handle a `sampling/createMessage` request. */
|
|
28
|
+
onSample?: (params: Record<string, unknown>) => Promise<Record<string, unknown>> | Record<string, unknown>;
|
|
29
|
+
/** Handle a `roots/list` request. */
|
|
30
|
+
onListRoots?: () => Promise<{
|
|
31
|
+
roots: Array<{
|
|
32
|
+
uri: string;
|
|
33
|
+
name?: string;
|
|
34
|
+
}>;
|
|
35
|
+
}> | {
|
|
36
|
+
roots: Array<{
|
|
37
|
+
uri: string;
|
|
38
|
+
name?: string;
|
|
39
|
+
}>;
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
export interface McpStatelessClientOptions {
|
|
43
|
+
/** The MCP endpoint URL. */
|
|
44
|
+
url: string;
|
|
45
|
+
clientInfo?: Implementation;
|
|
46
|
+
/** Capabilities declared on EVERY request (they are per-request in this revision). */
|
|
47
|
+
capabilities?: Record<string, unknown>;
|
|
48
|
+
/** Extra headers (e.g. `Authorization`) sent with every request. */
|
|
49
|
+
headers?: Record<string, string>;
|
|
50
|
+
/** Log level to opt into; omit to receive no `notifications/message`. */
|
|
51
|
+
logLevel?: string;
|
|
52
|
+
/** Called for every notification received on a response stream. */
|
|
53
|
+
onNotification?: (notification: {
|
|
54
|
+
method: string;
|
|
55
|
+
params?: Record<string, unknown>;
|
|
56
|
+
}) => void;
|
|
57
|
+
/** How the client answers MRTR input requests. */
|
|
58
|
+
handlers?: McpStatelessInputHandlers;
|
|
59
|
+
/** Maximum MRTR round trips before giving up, guarding against a server that never settles. */
|
|
60
|
+
maxInputRounds?: number;
|
|
61
|
+
/**
|
|
62
|
+
* Per-request timeout in milliseconds.
|
|
63
|
+
*
|
|
64
|
+
* Without one an unreachable or hung remote leaves every call pending
|
|
65
|
+
* forever — including the `server/discover` probe used to negotiate the
|
|
66
|
+
* protocol, which would then never fall back.
|
|
67
|
+
*/
|
|
68
|
+
requestTimeoutMs?: number;
|
|
69
|
+
/** Injected for tests. */
|
|
70
|
+
fetchImpl?: typeof fetch;
|
|
71
|
+
}
|
|
72
|
+
export declare class McpStatelessError extends Error {
|
|
73
|
+
readonly code: number;
|
|
74
|
+
readonly data?: unknown | undefined;
|
|
75
|
+
constructor(code: number, message: string, data?: unknown | undefined);
|
|
76
|
+
}
|
|
77
|
+
export declare class McpStatelessClient {
|
|
78
|
+
private nextId;
|
|
79
|
+
private readonly options;
|
|
80
|
+
/** Cached tool input schemas, needed to derive `Mcp-Param-*` headers. */
|
|
81
|
+
private toolSchemas;
|
|
82
|
+
constructor(options: McpStatelessClientOptions);
|
|
83
|
+
private get fetchImpl();
|
|
84
|
+
/** Ask the server which versions, capabilities and identity it offers. */
|
|
85
|
+
discover(): Promise<Record<string, unknown>>;
|
|
86
|
+
/**
|
|
87
|
+
* List tools, dropping any whose `x-mcp-header` annotations are invalid.
|
|
88
|
+
*
|
|
89
|
+
* The spec requires this: one malformed tool definition must not prevent the
|
|
90
|
+
* other tools from being used, so the offender is excluded and logged rather
|
|
91
|
+
* than failing the call.
|
|
92
|
+
*/
|
|
93
|
+
listTools(): Promise<Array<Record<string, unknown>>>;
|
|
94
|
+
callTool(name: string, args?: Record<string, unknown>): Promise<Record<string, unknown>>;
|
|
95
|
+
readResource(uri: string): Promise<Record<string, unknown>>;
|
|
96
|
+
listResources(): Promise<Record<string, unknown>>;
|
|
97
|
+
listPrompts(): Promise<Record<string, unknown>>;
|
|
98
|
+
getPrompt(name: string, args?: Record<string, string>): Promise<Record<string, unknown>>;
|
|
99
|
+
/**
|
|
100
|
+
* Issue a request, resolving MRTR round trips and task handles transparently.
|
|
101
|
+
*
|
|
102
|
+
* The caller sees a single promise for the FINAL result, which is the whole
|
|
103
|
+
* point of centralising this: every entry point would otherwise need its own
|
|
104
|
+
* retry loop.
|
|
105
|
+
*/
|
|
106
|
+
request(method: string, params?: Record<string, unknown>): Promise<Record<string, unknown>>;
|
|
107
|
+
/** Fulfil each `inputRequests` entry using the configured handlers. */
|
|
108
|
+
private gatherInputs;
|
|
109
|
+
/**
|
|
110
|
+
* Poll a task handle to a terminal state, answering mid-flight input requests.
|
|
111
|
+
*
|
|
112
|
+
* Honours the server's `pollIntervalMs` hint rather than picking our own
|
|
113
|
+
* cadence — the server knows how long its work takes.
|
|
114
|
+
*/
|
|
115
|
+
private awaitTask;
|
|
116
|
+
/** Cancel a running task. */
|
|
117
|
+
cancelTask(taskId: string): Promise<void>;
|
|
118
|
+
/**
|
|
119
|
+
* Open a `subscriptions/listen` stream.
|
|
120
|
+
*
|
|
121
|
+
* Resolves once the server acknowledges the subscription, so callers know
|
|
122
|
+
* which notification types were actually honoured before they start waiting
|
|
123
|
+
* on them.
|
|
124
|
+
*/
|
|
125
|
+
listen(notifications: Record<string, unknown>, onNotification: (notification: {
|
|
126
|
+
method: string;
|
|
127
|
+
params?: Record<string, unknown>;
|
|
128
|
+
}) => void): Promise<{
|
|
129
|
+
acknowledged: Record<string, unknown>;
|
|
130
|
+
close: () => void;
|
|
131
|
+
}>;
|
|
132
|
+
/** Build and issue one JSON-RPC request, returning its result. */
|
|
133
|
+
private send;
|
|
134
|
+
/** Assemble the JSON-RPC body and its mirrored HTTP headers. */
|
|
135
|
+
private buildRequest;
|
|
136
|
+
private deriveName;
|
|
137
|
+
/**
|
|
138
|
+
* Read either framing the server may choose.
|
|
139
|
+
*
|
|
140
|
+
* A JSON body is the response outright; an SSE body carries this request's
|
|
141
|
+
* notifications followed by the final response, so notifications are forwarded
|
|
142
|
+
* as they arrive and the terminating message is returned.
|
|
143
|
+
*/
|
|
144
|
+
private readResponse;
|
|
145
|
+
/** Drain an SSE body, handing each decoded JSON message to `onMessage`. */
|
|
146
|
+
private pumpSse;
|
|
147
|
+
private warn;
|
|
148
|
+
}
|
|
149
|
+
/** Convenience: the capability object a client declaring the tasks extension sends. */
|
|
150
|
+
export declare const TASKS_CLIENT_CAPABILITY: {
|
|
151
|
+
extensions: {
|
|
152
|
+
"io.modelcontextprotocol/tasks": {};
|
|
153
|
+
};
|
|
154
|
+
};
|
|
155
|
+
/** Re-exported so callers can check task terminality without importing the extension module. */
|
|
156
|
+
export { TERMINAL_TASK_STATUSES };
|
|
157
|
+
//# sourceMappingURL=mcp-stateless.client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mcp-stateless.client.d.ts","sourceRoot":"","sources":["../../../../src/transport/mcp-20260728/client/mcp-stateless.client.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,OAAO,EAA0C,KAAK,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAIjG,OAAO,EAAsB,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAGhF,yEAAyE;AACzE,MAAM,WAAW,yBAAyB;IACxC,8CAA8C;IAC9C,QAAQ,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC3G,iDAAiD;IACjD,QAAQ,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,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;OAKG;YACW,SAAS;IAoCvB,6BAA6B;IACvB,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAI/C;;;;;;OAMG;IACG,MAAM,CACV,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACtC,cAAc,EAAE,CAAC,YAAY,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;KAAE,KAAK,IAAI,GAC3F,OAAO,CAAC;QAAE,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QAAC,KAAK,EAAE,MAAM,IAAI,CAAA;KAAE,CAAC;IAsDxE,kEAAkE;YACpD,IAAI;IAgClB,gEAAgE;IAChE,OAAO,CAAC,YAAY;IAmCpB,OAAO,CAAC,UAAU;IAMlB;;;;;;OAMG;YACW,YAAY;IAsB1B,2EAA2E;YAC7D,OAAO;IAmCrB,OAAO,CAAC,IAAI;CAGb;AAED,uFAAuF;AACvF,eAAO,MAAM,uBAAuB;;;;CAA+C,CAAC;AAEpF,gGAAgG;AAChG,OAAO,EAAE,sBAAsB,EAAE,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `server/discover` — protocol 2026-07-28, SEP-2575.
|
|
3
|
+
*
|
|
4
|
+
* Servers MUST implement this RPC. It advertises the versions the server
|
|
5
|
+
* speaks, its capabilities, and its instructions — the payload `initialize`
|
|
6
|
+
* used to return, minus everything that only made sense for a session.
|
|
7
|
+
*
|
|
8
|
+
* Clients MAY skip it entirely and negotiate inline via per-request `_meta`,
|
|
9
|
+
* which is why it must be cheap and side-effect free.
|
|
10
|
+
*/
|
|
11
|
+
import { type DiscoverResult, type ServerCapabilities20260728 } from '@frontmcp/protocol';
|
|
12
|
+
import { type Scope } from '../../scope';
|
|
13
|
+
/**
|
|
14
|
+
* Project the scope's capability set into the 2026-07-28 shape.
|
|
15
|
+
*
|
|
16
|
+
* The only structural change is `extensions`: this revision promotes optional
|
|
17
|
+
* MCP extensions out of `experimental` into a first-class field, so anything
|
|
18
|
+
* the scope already advertises is merged with the server-level extension list.
|
|
19
|
+
*/
|
|
20
|
+
export declare function buildDiscoverCapabilities(scope: Scope): ServerCapabilities20260728;
|
|
21
|
+
/**
|
|
22
|
+
* Build the `server/discover` result body.
|
|
23
|
+
*
|
|
24
|
+
* `resultType`, `_meta.serverInfo`, `ttlMs` and `cacheScope` are added by the
|
|
25
|
+
* shared result decorator, so this returns only the method-specific fields.
|
|
26
|
+
*/
|
|
27
|
+
export declare function buildDiscoverResult(scope: Scope, instructions?: string): Omit<DiscoverResult, keyof object>;
|
|
28
|
+
//# sourceMappingURL=discover.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"discover.d.ts","sourceRoot":"","sources":["../../../src/transport/mcp-20260728/discover.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,EAAE,KAAK,cAAc,EAAE,KAAK,0BAA0B,EAAE,MAAM,oBAAoB,CAAC;AAE1F,OAAO,EAAE,KAAK,KAAK,EAAE,MAAM,aAAa,CAAC;AAIzC;;;;;;GAMG;AACH,wBAAgB,yBAAyB,CAAC,KAAK,EAAE,KAAK,GAAG,0BAA0B,CAmBlF;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,KAAK,EAAE,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC,cAAc,EAAE,MAAM,MAAM,CAAC,CAQ3G"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { type FrontMcpContext } from '../../context';
|
|
2
|
+
import { type Scope } from '../../scope';
|
|
3
|
+
import { type RequestNotificationSink } from './request-notifications';
|
|
4
|
+
import { type JsonRpcErrorPayload } from './request-validation';
|
|
5
|
+
export interface DispatchOptions {
|
|
6
|
+
scope: Scope;
|
|
7
|
+
/** The validated JSON-RPC request body. */
|
|
8
|
+
body: Record<string, unknown>;
|
|
9
|
+
/** Capabilities the client declared in this request's `_meta`. */
|
|
10
|
+
clientCapabilities: Record<string, unknown>;
|
|
11
|
+
/** Ambient request context, used to carry the MRTR exchange to `elicit()`. */
|
|
12
|
+
frontmcpContext?: FrontMcpContext;
|
|
13
|
+
/** Auth info forwarded to the shared handlers. */
|
|
14
|
+
authInfo?: Record<string, unknown>;
|
|
15
|
+
/** True when the caller is unauthenticated, which makes results publicly cacheable. */
|
|
16
|
+
isAnonymous: boolean;
|
|
17
|
+
signal?: AbortSignal;
|
|
18
|
+
/** Lazily composed instructions for `server/discover`. */
|
|
19
|
+
composeInstructions?: () => string | undefined;
|
|
20
|
+
/** Collects `notifications/message` + `notifications/progress` for this request. */
|
|
21
|
+
notificationSink?: RequestNotificationSink;
|
|
22
|
+
/** OpenTelemetry context echoed back on the result (SEP-414). */
|
|
23
|
+
traceContext?: Record<string, string>;
|
|
24
|
+
}
|
|
25
|
+
export type DispatchResult = {
|
|
26
|
+
kind: 'result';
|
|
27
|
+
result: Record<string, unknown>;
|
|
28
|
+
} | {
|
|
29
|
+
kind: 'error';
|
|
30
|
+
status: number;
|
|
31
|
+
error: JsonRpcErrorPayload;
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* Requests that MAY return an `InputRequiredResult`.
|
|
35
|
+
*
|
|
36
|
+
* The spec enumerates these three and adds "Servers MUST NOT send
|
|
37
|
+
* `InputRequiredResult` responses on any other client requests."
|
|
38
|
+
*/
|
|
39
|
+
export declare const MRTR_CAPABLE_METHODS: readonly ["tools/call", "prompts/get", "resources/read"];
|
|
40
|
+
/**
|
|
41
|
+
* Identify the caller for `requestState` binding.
|
|
42
|
+
*
|
|
43
|
+
* Falls back to a fixed anonymous marker rather than a random value: public
|
|
44
|
+
* servers must still be able to redeem their own state on the retry, and there
|
|
45
|
+
* is no principal to separate anonymous callers by.
|
|
46
|
+
*/
|
|
47
|
+
export declare function resolvePrincipal(authInfo: Record<string, unknown> | undefined): string;
|
|
48
|
+
/**
|
|
49
|
+
* Identify the caller for TASK ownership.
|
|
50
|
+
*
|
|
51
|
+
* Stricter than {@link resolvePrincipal}: a public-mode server mints an
|
|
52
|
+
* anonymous bootstrap token per request, which is a fine binding for a
|
|
53
|
+
* short-lived `requestState` but must NOT be mistaken for an identity that can
|
|
54
|
+
* own a durable task. Anonymous callers resolve to `'anonymous'` so task
|
|
55
|
+
* creation is refused rather than pooled across unrelated users.
|
|
56
|
+
*/
|
|
57
|
+
export declare function resolveTaskPrincipal(authInfo: Record<string, unknown> | undefined, isAnonymous?: boolean): string;
|
|
58
|
+
/**
|
|
59
|
+
* Map a thrown error onto a JSON-RPC error payload.
|
|
60
|
+
*
|
|
61
|
+
* The one substantive change from earlier revisions is resource-not-found:
|
|
62
|
+
* `-32002` was retired in favour of `-32602` to align with JSON-RPC. Because
|
|
63
|
+
* the shared handlers still raise the old code (they serve legacy clients too),
|
|
64
|
+
* the translation happens here rather than at the source.
|
|
65
|
+
*/
|
|
66
|
+
export declare function toJsonRpcError(error: unknown): {
|
|
67
|
+
status: number;
|
|
68
|
+
error: JsonRpcErrorPayload;
|
|
69
|
+
};
|
|
70
|
+
/**
|
|
71
|
+
* Dispatch one 2026-07-28 JSON-RPC request.
|
|
72
|
+
*
|
|
73
|
+
* `subscriptions/listen` is NOT handled here — it needs to own the HTTP
|
|
74
|
+
* response as a stream, so the flow handles it before calling in.
|
|
75
|
+
*/
|
|
76
|
+
export declare function dispatch20260728(options: DispatchOptions): Promise<DispatchResult>;
|
|
77
|
+
//# sourceMappingURL=dispatcher.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dispatcher.d.ts","sourceRoot":"","sources":["../../../src/transport/mcp-20260728/dispatcher.ts"],"names":[],"mappings":"AAiBA,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,eAAe,CAAC;AAErD,OAAO,EAAE,KAAK,KAAK,EAAE,MAAM,aAA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CAAC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,EAAE,WAAW,UAAQ,GAAG,MAAM,CAS/G;AAqGD;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,OAAO,GAAG;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,mBAAmB,CAAA;CAAE,CA2B7F;AAED;;;;;GAKG;AACH,wBAAsB,gBAAgB,CAAC,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,cAAc,CAAC,CAqKxF"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Value encoding for the mirrored HTTP headers of protocol 2026-07-28.
|
|
3
|
+
*
|
|
4
|
+
* HTTP field values are limited to visible ASCII, so a tool name, resource URI,
|
|
5
|
+
* or parameter value that falls outside that set travels Base64-wrapped in the
|
|
6
|
+
* `=?base64?…?=` sentinel. Servers MUST decode before comparing to the body —
|
|
7
|
+
* a naive string compare would reject every conforming client that had to
|
|
8
|
+
* encode, and would accept a crafted literal that merely LOOKS encoded.
|
|
9
|
+
*/
|
|
10
|
+
/** True when `value` is wrapped in the (case-sensitive, lowercase) sentinel. */
|
|
11
|
+
export declare function isSentinelEncoded(value: string): boolean;
|
|
12
|
+
/**
|
|
13
|
+
* Decode a mirrored header value.
|
|
14
|
+
*
|
|
15
|
+
* Returns `undefined` when the sentinel is present but the payload is not valid
|
|
16
|
+
* Base64/UTF-8 — the caller turns that into a `HeaderMismatch` rather than
|
|
17
|
+
* silently comparing garbage.
|
|
18
|
+
*/
|
|
19
|
+
export declare function decodeHeaderValue(value: string): string | undefined;
|
|
20
|
+
/** Encode a value for a mirrored header, wrapping it only when necessary. */
|
|
21
|
+
export declare function encodeHeaderValue(value: string): string;
|
|
22
|
+
/** True when a raw header value contains octets HTTP does not permit. */
|
|
23
|
+
export declare function hasInvalidHeaderChars(value: string): boolean;
|
|
24
|
+
/**
|
|
25
|
+
* Compare a decoded header value against the value found in the request body.
|
|
26
|
+
*
|
|
27
|
+
* Numbers are compared numerically per the spec note (`42` and `42.0` are
|
|
28
|
+
* equal); booleans use their lowercase spelling; everything else is an exact
|
|
29
|
+
* string match.
|
|
30
|
+
*/
|
|
31
|
+
export declare function headerMatchesBodyValue(headerValue: string, bodyValue: unknown): boolean;
|
|
32
|
+
//# sourceMappingURL=header-codec.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"header-codec.d.ts","sourceRoot":"","sources":["../../../src/transport/mcp-20260728/header-codec.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAKH,gFAAgF;AAChF,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAMxD;AAED;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAanE;AAED,6EAA6E;AAC7E,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAIvD;AAKD,yEAAyE;AACzE,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAU5D;AAED;;;;;;GAMG;AACH,wBAAgB,sBAAsB,CAAC,WAAW,EAAE,MAAM,EAAE,SAAS,EAAE,OAAO,GAAG,OAAO,CASvF"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MCP protocol revision 2026-07-28 support.
|
|
3
|
+
*
|
|
4
|
+
* Everything in here is additive: a request is only routed through this module
|
|
5
|
+
* when it explicitly declares the 2026-07-28 revision (or uses a method that
|
|
6
|
+
* exists only in it). Every earlier revision keeps its original code path.
|
|
7
|
+
*
|
|
8
|
+
* @module transport/mcp-20260728
|
|
9
|
+
*/
|
|
10
|
+
export * from './protocol-20260728.constants';
|
|
11
|
+
export * from './header-codec';
|
|
12
|
+
export * from './request-validation';
|
|
13
|
+
export * from './request-state';
|
|
14
|
+
export * from './request-notifications';
|
|
15
|
+
export * from './result-decorator';
|
|
16
|
+
export * from './discover';
|
|
17
|
+
export * from './mrtr';
|
|
18
|
+
export * from './subscriptions';
|
|
19
|
+
export * from './tasks-extension';
|
|
20
|
+
export * from './dispatcher';
|
|
21
|
+
export * from './client';
|
|
22
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/transport/mcp-20260728/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,cAAc,+BAA+B,CAAC;AAC9C,cAAc,gBAAgB,CAAC;AAC/B,cAAc,sBAAsB,CAAC;AACrC,cAAc,iBAAiB,CAAC;AAChC,cAAc,yBAAyB,CAAC;AACxC,cAAc,oBAAoB,CAAC;AACnC,cAAc,YAAY,CAAC;AAC3B,cAAc,QAAQ,CAAC;AACvB,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC;AAClC,cAAc,cAAc,CAAC;AAC7B,cAAc,UAAU,CAAC"}
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Multi Round-Trip Requests (MRTR) — protocol 2026-07-28, SEP-2322.
|
|
3
|
+
*
|
|
4
|
+
* ## How a round trip works
|
|
5
|
+
*
|
|
6
|
+
* 1. The tool calls `this.elicit(...)` / `this.sample(...)` / `this.listRoots()`.
|
|
7
|
+
* No response is recorded for that call yet, so the exchange records the
|
|
8
|
+
* pending request and throws {@link InputRequiredSignal}.
|
|
9
|
+
* 2. The dispatcher turns the signal into an `InputRequiredResult`
|
|
10
|
+
* (`resultType: "input_required"`) carrying `inputRequests` and an opaque,
|
|
11
|
+
* integrity-protected `requestState`.
|
|
12
|
+
* 3. The client gathers the input and re-issues the SAME request (with a NEW
|
|
13
|
+
* JSON-RPC id) carrying `inputResponses` + the echoed `requestState`.
|
|
14
|
+
* 4. The entry runs again from the top. This time each call finds a recorded
|
|
15
|
+
* answer and returns it inline, so execution proceeds.
|
|
16
|
+
*
|
|
17
|
+
* Entries are therefore replayed, not resumed — which is why keys are derived
|
|
18
|
+
* from the call ORDER (`elicit-1`, `sampling-1`, `roots-1`, …) rather than
|
|
19
|
+
* randomly: the second run must line its calls up with the first run's answers.
|
|
20
|
+
*
|
|
21
|
+
* `requestState` accumulates every answer gathered so far, so a multi-step tool
|
|
22
|
+
* converges even if the client only echoes the most recent `inputResponses`.
|
|
23
|
+
* It is signed and bound to the caller and the originating request — see
|
|
24
|
+
* {@link ./request-state}.
|
|
25
|
+
*/
|
|
26
|
+
import type { InputResponses } from '@frontmcp/protocol';
|
|
27
|
+
import { type ElicitStatus } from '../../elicitation';
|
|
28
|
+
import { InputRequiredSignal } from '../../errors';
|
|
29
|
+
import { type RequestStateBinding } from './request-state';
|
|
30
|
+
/** Requests the client may be asked to fulfil, and the capability each needs. */
|
|
31
|
+
declare const CAPABILITY_FOR_KIND: {
|
|
32
|
+
readonly elicitation: {
|
|
33
|
+
readonly capability: "elicitation";
|
|
34
|
+
readonly required: {
|
|
35
|
+
readonly elicitation: {
|
|
36
|
+
readonly form: {};
|
|
37
|
+
};
|
|
38
|
+
};
|
|
39
|
+
};
|
|
40
|
+
readonly sampling: {
|
|
41
|
+
readonly capability: "sampling";
|
|
42
|
+
readonly required: {
|
|
43
|
+
readonly sampling: {};
|
|
44
|
+
};
|
|
45
|
+
};
|
|
46
|
+
readonly roots: {
|
|
47
|
+
readonly capability: "roots";
|
|
48
|
+
readonly required: {
|
|
49
|
+
readonly roots: {};
|
|
50
|
+
};
|
|
51
|
+
};
|
|
52
|
+
};
|
|
53
|
+
export type MrtrRequestKind = keyof typeof CAPABILITY_FOR_KIND;
|
|
54
|
+
/** Shape recorded for a pending elicitation before it becomes an input request. */
|
|
55
|
+
export interface PendingElicitation {
|
|
56
|
+
message: string;
|
|
57
|
+
requestedSchema: Record<string, unknown>;
|
|
58
|
+
mode?: 'form' | 'url';
|
|
59
|
+
url?: string;
|
|
60
|
+
}
|
|
61
|
+
/** Parameters for a `sampling/createMessage` input request. */
|
|
62
|
+
export interface PendingSampling {
|
|
63
|
+
messages: unknown[];
|
|
64
|
+
maxTokens: number;
|
|
65
|
+
systemPrompt?: string;
|
|
66
|
+
modelPreferences?: Record<string, unknown>;
|
|
67
|
+
temperature?: number;
|
|
68
|
+
stopSequences?: string[];
|
|
69
|
+
includeContext?: 'none' | 'thisServer' | 'allServers';
|
|
70
|
+
metadata?: Record<string, unknown>;
|
|
71
|
+
}
|
|
72
|
+
/** The client's answer to a `sampling/createMessage` request. */
|
|
73
|
+
export interface SamplingAnswer {
|
|
74
|
+
role: string;
|
|
75
|
+
content: unknown;
|
|
76
|
+
model?: string;
|
|
77
|
+
stopReason?: string;
|
|
78
|
+
}
|
|
79
|
+
/** The client's answer to a `roots/list` request. */
|
|
80
|
+
export interface RootsAnswer {
|
|
81
|
+
roots: Array<{
|
|
82
|
+
uri: string;
|
|
83
|
+
name?: string;
|
|
84
|
+
}>;
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Per-request bookkeeping for one MRTR exchange.
|
|
88
|
+
*
|
|
89
|
+
* Lives on the `FrontMcpContext` for the duration of a single dispatch, so
|
|
90
|
+
* `elicit()` / `sample()` / `listRoots()` deep inside an entry can reach it
|
|
91
|
+
* without threading it through every flow stage.
|
|
92
|
+
*/
|
|
93
|
+
export declare class MrtrExchange {
|
|
94
|
+
/** Answers already supplied by the client, keyed by input-request key. */
|
|
95
|
+
private readonly responses;
|
|
96
|
+
/** Requests raised during THIS run that the client still has to answer. */
|
|
97
|
+
private readonly pending;
|
|
98
|
+
/** Per-kind call counters, used to derive stable keys across a replay. */
|
|
99
|
+
private readonly counters;
|
|
100
|
+
readonly clientCapabilities: Record<string, unknown>;
|
|
101
|
+
private readonly binding;
|
|
102
|
+
constructor(params: {
|
|
103
|
+
/** `inputResponses` from the request params. */
|
|
104
|
+
inputResponses?: InputResponses;
|
|
105
|
+
/** Answers carried over from earlier rounds via a verified `requestState`. */
|
|
106
|
+
carriedResponses?: InputResponses;
|
|
107
|
+
/** Capabilities the client declared for this request. */
|
|
108
|
+
clientCapabilities: Record<string, unknown>;
|
|
109
|
+
/** Principal + request digest that new state will be bound to. */
|
|
110
|
+
binding: RequestStateBinding;
|
|
111
|
+
});
|
|
112
|
+
/** True when the client declared the capability a given request kind needs. */
|
|
113
|
+
supports(kind: MrtrRequestKind): boolean;
|
|
114
|
+
/** True when the client declared support for elicitation in this request. */
|
|
115
|
+
supportsElicitation(mode?: 'form' | 'url'): boolean;
|
|
116
|
+
/**
|
|
117
|
+
* Look up a recorded answer for the next call of `kind`, or record the
|
|
118
|
+
* request and unwind.
|
|
119
|
+
*
|
|
120
|
+
* The spec forbids asking for something the client never said it supports, so
|
|
121
|
+
* an undeclared capability fails fast with `-32021` rather than emitting an
|
|
122
|
+
* `inputRequests` entry the client cannot honor.
|
|
123
|
+
*/
|
|
124
|
+
private resolve;
|
|
125
|
+
/** Resolve the next `elicit()` call. */
|
|
126
|
+
resolveElicitation(pending: PendingElicitation): {
|
|
127
|
+
status: ElicitStatus;
|
|
128
|
+
content?: unknown;
|
|
129
|
+
};
|
|
130
|
+
/** Resolve the next `sample()` call. */
|
|
131
|
+
resolveSampling(pending: PendingSampling): SamplingAnswer;
|
|
132
|
+
/** Resolve the next `listRoots()` call. */
|
|
133
|
+
resolveRoots(): RootsAnswer;
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* Build the `InputRequiredResult` body for a raised signal.
|
|
137
|
+
*
|
|
138
|
+
* `resultType` is set here rather than by the generic result decorator because
|
|
139
|
+
* an interim result is precisely the case the decorator must not overwrite.
|
|
140
|
+
*/
|
|
141
|
+
export declare function buildInputRequiredResult(signal: InputRequiredSignal): Record<string, unknown>;
|
|
142
|
+
export {};
|
|
143
|
+
//# sourceMappingURL=mrtr.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mrtr.d.ts","sourceRoot":"","sources":["../../../src/transport/m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G;AACH,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,mBAAmB,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAM7F"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Every revision this server speaks, newest first.
|
|
3
|
+
*
|
|
4
|
+
* Advertised verbatim by `server/discover` and echoed in the `supported` array
|
|
5
|
+
* of an `UnsupportedProtocolVersionError`. The older entries are load-bearing:
|
|
6
|
+
* dropping one would strand every client that negotiated it.
|
|
7
|
+
*/
|
|
8
|
+
export declare const FRONTMCP_SUPPORTED_PROTOCOL_VERSIONS: readonly ["2026-07-28", "2025-11-25", "2025-06-18", "2025-03-26", "2024-11-05"];
|
|
9
|
+
/**
|
|
10
|
+
* Revisions handled by the pre-existing session/`initialize` pipeline.
|
|
11
|
+
*
|
|
12
|
+
* A request declaring one of these is NOT claimed by the 2026 path, which is
|
|
13
|
+
* what keeps the old behaviour bit-for-bit identical.
|
|
14
|
+
*/
|
|
15
|
+
export declare const LEGACY_PROTOCOL_VERSIONS: string[];
|
|
16
|
+
/** Methods that exist only in 2026-07-28. */
|
|
17
|
+
export declare const PROTOCOL_20260728_ONLY_METHODS: string[];
|
|
18
|
+
/** HTTP header names mirrored from the JSON-RPC body (SEP-2243). */
|
|
19
|
+
export declare const MCP_HEADERS: {
|
|
20
|
+
readonly protocolVersion: "mcp-protocol-version";
|
|
21
|
+
readonly method: "mcp-method";
|
|
22
|
+
readonly name: "mcp-name";
|
|
23
|
+
/** Prefix for `x-mcp-header`-derived parameter headers. */
|
|
24
|
+
readonly paramPrefix: "mcp-param-";
|
|
25
|
+
};
|
|
26
|
+
/** Methods whose `Mcp-Name` header is sourced from `params.name`. */
|
|
27
|
+
export declare const NAME_FROM_PARAMS_NAME: string[];
|
|
28
|
+
/** Methods whose `Mcp-Name` header is sourced from `params.uri`. */
|
|
29
|
+
export declare const NAME_FROM_PARAMS_URI: string[];
|
|
30
|
+
/**
|
|
31
|
+
* Default `ttlMs` per cacheable method.
|
|
32
|
+
*
|
|
33
|
+
* Conservative on purpose: list endpoints change rarely and benefit most from
|
|
34
|
+
* caching, while `resources/read` is content that a server may regenerate, so
|
|
35
|
+
* it defaults to "revalidate every time" rather than risking a stale read.
|
|
36
|
+
*/
|
|
37
|
+
export declare const DEFAULT_CACHE_TTL_MS: Record<string, number>;
|
|
38
|
+
/** Methods whose results MUST carry `ttlMs` + `cacheScope` (`CacheableResult`). */
|
|
39
|
+
export declare const CACHEABLE_METHODS: string[];
|
|
40
|
+
/**
|
|
41
|
+
* MCP extensions this server advertises under `capabilities.extensions`.
|
|
42
|
+
*
|
|
43
|
+
* Keys follow the `_meta` naming rules (mandatory reverse-DNS prefix).
|
|
44
|
+
*/
|
|
45
|
+
export declare const ADVERTISED_EXTENSIONS: Record<string, Record<string, unknown>>;
|
|
46
|
+
//# sourceMappingURL=protocol-20260728.constants.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"protocol-20260728.constants.d.ts","sourceRoot":"","sources":["../../../src/transport/mcp-20260728/protocol-20260728.constants.ts"],"names":[],"mappings":"AAOA;;;;;;GAMG;AACH,eAAO,MAAM,oCAAoC,iFAMvC,CAAC;AAEX;;;;;GAKG;AACH,eAAO,MAAM,wBAAwB,UAAyE,CAAC;AAE/G,6CAA6C;AAC7C,eAAO,MAAM,8BAA8B,UAA8C,CAAC;AAE1F,oEAAoE;AACpE,eAAO,MAAM,WAAW;;;;IAItB,2DAA2D;;CAEnD,CAAC;AAEX,qEAAqE;AACrE,eAAO,MAAM,qBAAqB,UAAgC,CAAC;AAEnE,oEAAoE;AACpE,eAAO,MAAM,oBAAoB,UAAqB,CAAC;AAEvD;;;;;;GAMG;AACH,eAAO,MAAM,oBAAoB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAOvD,CAAC;AAEF,mFAAmF;AACnF,eAAO,MAAM,iBAAiB,UAAoC,CAAC;AAEnE;;;;GAIG;AACH,eAAO,MAAM,qBAAqB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAEzE,CAAC"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Request-scoped notifications for protocol 2026-07-28.
|
|
3
|
+
*
|
|
4
|
+
* Two rules from SEP-2575 shape this:
|
|
5
|
+
*
|
|
6
|
+
* - `notifications/progress` and `notifications/message` flow on the response
|
|
7
|
+
* stream of the request they relate to — never on the `subscriptions/listen`
|
|
8
|
+
* stream, and never on a session channel (there are no sessions).
|
|
9
|
+
* - `logging/setLevel` is gone. The client opts in per request via
|
|
10
|
+
* `_meta["io.modelcontextprotocol/logLevel"]`, and a server **MUST NOT** emit
|
|
11
|
+
* `notifications/message` for a request that omitted it.
|
|
12
|
+
*
|
|
13
|
+
* The sink is attached to the `FrontMcpContext` for the duration of one
|
|
14
|
+
* dispatch, so `this.notify()` / `this.progress()` deep inside an entry reach it
|
|
15
|
+
* without any session lookup.
|
|
16
|
+
*/
|
|
17
|
+
import { type LoggingLevel } from '@frontmcp/protocol';
|
|
18
|
+
/** True when `level` is at least as severe as the client's requested minimum. */
|
|
19
|
+
export declare function meetsLogLevel(level: LoggingLevel, minimum: LoggingLevel): boolean;
|
|
20
|
+
export interface QueuedRequestNotification {
|
|
21
|
+
method: string;
|
|
22
|
+
params: Record<string, unknown>;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Collects notifications raised while handling one request and hands them to
|
|
26
|
+
* the transport in arrival order.
|
|
27
|
+
*
|
|
28
|
+
* Deliberately unbounded-but-drained: the transport consumes as it streams, and
|
|
29
|
+
* a request that ends without streaming simply discards what it buffered (a
|
|
30
|
+
* client that asked for neither logs nor progress gets neither).
|
|
31
|
+
*/
|
|
32
|
+
export declare class RequestNotificationSink {
|
|
33
|
+
/** Minimum severity the client opted into, or undefined for "no logs". */
|
|
34
|
+
private readonly logLevel;
|
|
35
|
+
/** Progress token from `_meta`, or undefined for "no progress". */
|
|
36
|
+
private readonly progressToken;
|
|
37
|
+
private readonly queue;
|
|
38
|
+
private wake;
|
|
39
|
+
private finished;
|
|
40
|
+
constructor(
|
|
41
|
+
/** Minimum severity the client opted into, or undefined for "no logs". */
|
|
42
|
+
logLevel: LoggingLevel | undefined,
|
|
43
|
+
/** Progress token from `_meta`, or undefined for "no progress". */
|
|
44
|
+
progressToken: string | number | undefined);
|
|
45
|
+
/** True when the client opted into anything at all. */
|
|
46
|
+
get active(): boolean;
|
|
47
|
+
/**
|
|
48
|
+
* Queue a log message.
|
|
49
|
+
*
|
|
50
|
+
* Dropped outright when the client did not set `logLevel` — the spec makes
|
|
51
|
+
* that a MUST NOT, not a preference.
|
|
52
|
+
*/
|
|
53
|
+
log(level: LoggingLevel, logger: string | undefined, data: unknown): boolean;
|
|
54
|
+
/** Queue a progress notification, if the client supplied a progress token. */
|
|
55
|
+
progress(progress: number, total?: number, message?: string): boolean;
|
|
56
|
+
private push;
|
|
57
|
+
/** Everything queued so far, cleared from the sink. */
|
|
58
|
+
drain(): QueuedRequestNotification[];
|
|
59
|
+
/** Signal that no further notifications will be raised. */
|
|
60
|
+
close(): void;
|
|
61
|
+
/**
|
|
62
|
+
* Wait until something is queued or the sink closes.
|
|
63
|
+
*
|
|
64
|
+
* Returns immediately when work is already pending, so a fast producer never
|
|
65
|
+
* makes the consumer sleep on a non-empty queue.
|
|
66
|
+
*/
|
|
67
|
+
waitForActivity(): Promise<void>;
|
|
68
|
+
get closed(): boolean;
|
|
69
|
+
}
|
|
70
|
+
//# sourceMappingURL=request-notifications.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"request-notifications.d.ts","sourceRoot":"","sources":["../../../src/transport/mcp-20260728/request-notifications.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAKvD,iFAAiF;AACjF,wBAAgB,aAAa,CA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