@frontmcp/testing 1.11.2 → 1.12.0-rc.1
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 +11 -1
- package/assertions/mcp-assertions.d.ts +2 -2
- package/assertions/mcp-assertions.d.ts.map +1 -1
- package/auth/mock-cimd-server.d.ts +12 -2
- package/auth/mock-cimd-server.d.ts.map +1 -1
- package/client/index.d.ts +1 -1
- package/client/index.d.ts.map +1 -1
- package/client/mcp-test-client.builder.d.ts +23 -4
- package/client/mcp-test-client.builder.d.ts.map +1 -1
- package/client/mcp-test-client.d.ts +46 -1
- package/client/mcp-test-client.d.ts.map +1 -1
- package/client/mcp-test-client.types.d.ts +20 -3
- package/client/mcp-test-client.types.d.ts.map +1 -1
- package/esm/fixtures/index.mjs +2 -2
- package/esm/index.mjs +5 -5
- package/esm/package.json +6 -6
- package/esm/perf/index.mjs +1 -1
- package/fixtures/fixture-types.d.ts +13 -0
- package/fixtures/fixture-types.d.ts.map +1 -1
- package/fixtures/index.js +3 -3
- package/fixtures/test-fixture.d.ts.map +1 -1
- package/index.d.ts +3 -1
- package/index.d.ts.map +1 -1
- package/index.js +7 -7
- package/interceptor/interceptor-chain.d.ts +1 -1
- package/interceptor/interceptor-chain.d.ts.map +1 -1
- package/interceptor/mock-registry.d.ts +1 -1
- package/interceptor/mock-registry.d.ts.map +1 -1
- package/matchers/index.d.ts +1 -1
- package/matchers/index.d.ts.map +1 -1
- package/package.json +6 -6
- package/perf/index.js +4 -4
- package/perf/leak-detector.d.ts.map +1 -1
- package/perf/metrics-collector.d.ts +1 -1
- package/perf/metrics-collector.d.ts.map +1 -1
- package/perf/perf-fixtures.d.ts +1 -1
- package/perf/perf-fixtures.d.ts.map +1 -1
- package/perf/regression-detector.d.ts +1 -1
- package/perf/regression-detector.d.ts.map +1 -1
- package/server/port-registry.d.ts +16 -0
- package/server/port-registry.d.ts.map +1 -1
- package/transport/mcp-20260728.d.ts +19 -0
- package/transport/mcp-20260728.d.ts.map +1 -0
- package/transport/streamable-http.transport.d.ts +15 -1
- package/transport/streamable-http.transport.d.ts.map +1 -1
- package/transport/transport.interface.d.ts +19 -1
- package/transport/transport.interface.d.ts.map +1 -1
- package/webhook/webhook-receiver.d.ts +85 -0
- package/webhook/webhook-receiver.d.ts.map +1 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"perf-fixtures.d.ts","sourceRoot":"","sources":["../../src/perf/perf-fixtures.ts"],"names":[],"mappings":"AAAA;;;GAGG;
|
|
1
|
+
{"version":3,"file":"perf-fixtures.d.ts","sourceRoot":"","sources":["../../src/perf/perf-fixtures.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,KAAK,EACV,oBAAoB,EACpB,mBAAmB,EACnB,4BAA4B,EAC5B,2BAA2B,EAC3B,kBAAkB,EAClB,YAAY,EACZ,SAAS,EACT,eAAe,EACf,YAAY,EACZ,cAAc,EACf,MAAM,SAAS,CAAC;AAMjB;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,gBAAgB,CAEtF;AAED;;GAEG;AACH,qBAAa,gBAAiB,YAAW,YAAY;IASjD,OAAO,CAAC,QAAQ,CAAC,QAAQ;IACzB,OAAO,CAAC,QAAQ,CAAC,OAAO;IAT1B,OAAO,CAAC,SAAS,CAAmB;IACpC,OAAO,CAAC,YAAY,CAAe;IACnC,OAAO,CAAC,gBAAgB,CAA6B;IACrD,OAAO,CAAC,SAAS,CAAK;IACtB,OAAO,CAAC,MAAM,CAAmB;IACjC,OAAO,CAAC,WAAW,CAA6B;gBAG7B,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,MAAM;IAMlC;;OAEG;IACG,QAAQ,IAAI,OAAO,CAAC,YAAY,CAAC;IAMvC;;OAEG;IACH,OAAO,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,YAAY;IAIrC;;OAEG;IACG,SAAS,CAAC,SAAS,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,EAAE,OAAO,CAAC,EAAE,oBAAoB,GAAG,OAAO,CAAC,mBAAmB,CAAC;IAoB7G;;;;;;;;;;;;;;;;;;;;;;;OAuBG;IACG,iBAAiB,CACrB,gBAAgB,EAAE,CAAC,MAAM,EAAE,kBAAkB,EAAE,QAAQ,EAAE,MAAM,KAAK,MAAM,OAAO,CAAC,IAAI,CAAC,EACvF,OAAO,EAAE,4BAA4B,GAAG;QAAE,aAAa,EAAE,MAAM,OAAO,CAAC,kBAAkB,CAAC,CAAA;KAAE,GAC3F,OAAO,CAAC,2BAA2B,CAAC;IAoBvC;;OAEG;IACH,gBAAgB,CAAC,UAAU,EAAE,cAAc,GAAG,IAAI;IA6ElD;;OAEG;IACH,eAAe,IAAI,YAAY,EAAE;IAIjC;;OAEG;IACH,WAAW,IAAI,MAAM;IAIrB;;OAEG;IACH,UAAU,IAAI,MAAM;IAIpB;;OAEG;IACH,SAAS,IAAI,SAAS,EAAE;IAIxB;;OAEG;IACH,gBAAgB,IAAI,eAAe;IAuBnC;;OAEG;IACH,KAAK,IAAI,IAAI;CAOd;AAiBD;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,WAAW,EAAE,eAAe,GAAG,IAAI,CAEvE;AAED;;GAEG;AACH,wBAAgB,qBAAqB,IAAI,eAAe,EAAE,CAEzD;AAED;;GAEG;AACH,wBAAgB,uBAAuB,IAAI,IAAI,CAG9C;AAED;;GAEG;AACH,wBAAgB,yBAAyB,CAAC,OAAO,EAAE,MAAM,GAAG,eAAe,EAAE,CAE5E"}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* @file regression-detector.ts
|
|
3
3
|
* @description Performance regression detection by comparing current metrics to baseline
|
|
4
4
|
*/
|
|
5
|
-
import type {
|
|
5
|
+
import type { MetricRegression, PerfBaseline, PerfMeasurement, RegressionConfig, RegressionResult, TestBaseline } from './types';
|
|
6
6
|
/**
|
|
7
7
|
* Detects performance regressions by comparing current metrics to baseline.
|
|
8
8
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"regression-detector.d.ts","sourceRoot":"","sources":["../../src/perf/regression-detector.ts"],"names":[],"mappings":"AAAA;;;GAGG;
|
|
1
|
+
{"version":3,"file":"regression-detector.d.ts","sourceRoot":"","sources":["../../src/perf/regression-detector.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,KAAK,EACV,gBAAgB,EAChB,YAAY,EACZ,eAAe,EACf,gBAAgB,EAChB,gBAAgB,EAChB,YAAY,EACb,MAAM,SAAS,CAAC;AAgBjB;;GAEG;AACH,qBAAa,kBAAkB;IAC7B,OAAO,CAAC,QAAQ,CAAC,MAAM,CAA6B;gBAExC,MAAM,CAAC,EAAE,gBAAgB;IAIrC;;OAEG;IACH,gBAAgB,CAAC,WAAW,EAAE,eAAe,EAAE,QAAQ,EAAE,YAAY,GAAG,gBAAgB;IAuCxF;;OAEG;IACH,iBAAiB,CAAC,YAAY,EAAE,eAAe,EAAE,EAAE,SAAS,EAAE,YAAY,GAAG,gBAAgB,EAAE;IAe/F;;OAEG;IACH,OAAO,CAAC,WAAW;IA8BnB;;OAEG;IACH,OAAO,CAAC,YAAY;CAerB;AAMD;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,gBAAgB,EAAE,GAAG;IACjE,KAAK,EAAE,MAAM,CAAC;IACd,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;CACjB,CAgBA;AAED;;GAEG;AACH,wBAAgB,cAAc,CAC5B,OAAO,EAAE,gBAAgB,EAAE,EAC3B,MAAM,EAAE,IAAI,GAAG,SAAS,GAAG,YAAY,GACtC,gBAAgB,EAAE,CAEpB;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,gBAAgB,GAAG,gBAAgB,GAAG,IAAI,CAYrF;AAQD;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,CAAC,EAAE,gBAAgB,GAAG,kBAAkB,CAKnF;AAED;;GAEG;AACH,wBAAgB,uBAAuB,IAAI,IAAI,CAE9C"}
|
|
@@ -184,6 +184,22 @@ export declare const E2E_PORT_RANGES: {
|
|
|
184
184
|
readonly start: 50500;
|
|
185
185
|
readonly size: 10;
|
|
186
186
|
};
|
|
187
|
+
readonly 'demo-e2e-events': {
|
|
188
|
+
readonly start: 50530;
|
|
189
|
+
readonly size: 10;
|
|
190
|
+
};
|
|
191
|
+
readonly 'demo-e2e-events-appointments': {
|
|
192
|
+
readonly start: 50540;
|
|
193
|
+
readonly size: 10;
|
|
194
|
+
};
|
|
195
|
+
readonly 'demo-e2e-events-daemon': {
|
|
196
|
+
readonly start: 50550;
|
|
197
|
+
readonly size: 10;
|
|
198
|
+
};
|
|
199
|
+
readonly 'demo-e2e-events-mail-triage': {
|
|
200
|
+
readonly start: 50560;
|
|
201
|
+
readonly size: 10;
|
|
202
|
+
};
|
|
187
203
|
readonly 'mock-oauth': {
|
|
188
204
|
readonly start: 50900;
|
|
189
205
|
readonly size: 10;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"port-registry.d.ts","sourceRoot":"","sources":["../../src/server/port-registry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAQH;;;;;;GAMG;AACH,eAAO,MAAM,eAAe
|
|
1
|
+
{"version":3,"file":"port-registry.d.ts","sourceRoot":"","sources":["../../src/server/port-registry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAQH;;;;;;GAMG;AACH,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4ElB,CAAC;AAEX,MAAM,MAAM,UAAU,GAAG,MAAM,OAAO,eAAe,CAAC;AA2CtD,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAO/C;AAuDD;;GAEG;AACH,wBAAgB,YAAY,CAAC,OAAO,EAAE,MAAM,GAAG;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAM7E;AAED;;;;;;;;;GASG;AACH,wBAAsB,WAAW,CAC/B,OAAO,EAAE,MAAM,EACf,aAAa,CAAC,EAAE,MAAM,GACrB,OAAO,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAAC,aAAa,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAA;CAAE,CAAC,CAgE7F;AAmDD;;GAEG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAGtD;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,CAWxE;AAED;;GAEG;AACH,wBAAsB,eAAe,IAAI,OAAO,CAAC,IAAI,CAAC,CAMrD;AAED;;GAEG;AACH,wBAAgB,gBAAgB,IAAI,KAAK,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,CAAA;CAAE,CAAC,CAM/F"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file mcp-20260728.ts
|
|
3
|
+
* @description The wire format of MCP protocol revision 2026-07-28: per-request `_meta` and mirrored headers
|
|
4
|
+
*/
|
|
5
|
+
import { type SubscriptionFilter } from '@frontmcp/protocol';
|
|
6
|
+
import type { JsonRpcRequest, JsonRpcResponse } from './transport.interface';
|
|
7
|
+
/** Whether a request travels as 2026-07-28: the client speaks it, or the method exists only in it. */
|
|
8
|
+
export declare function isStatelessRequest(protocolVersion: string | undefined, method: string | undefined): boolean;
|
|
9
|
+
/** A header value, Base64-wrapped in the `=?base64?…?=` sentinel when it isn't plain visible ASCII. */
|
|
10
|
+
export declare function encodeHeaderValue(value: string): string;
|
|
11
|
+
/** The request with the client's `_meta` added; keys the caller set in `_meta` win. */
|
|
12
|
+
export declare function withRequestMeta(message: JsonRpcRequest, meta: Record<string, unknown>): JsonRpcRequest;
|
|
13
|
+
/** The headers a 2026-07-28 request mirrors from its body. `toolInputSchema` is the called tool's, when known. */
|
|
14
|
+
export declare function revisionHeaders(message: JsonRpcRequest | undefined, toolInputSchema?: unknown): Record<string, string>;
|
|
15
|
+
/** The JSON-RPC error an HTTP error's body carries, if it carries one. */
|
|
16
|
+
export declare function jsonRpcErrorIn(body: string): JsonRpcResponse | undefined;
|
|
17
|
+
/** The filter a `notifications/subscriptions/acknowledged` event acknowledges, or undefined for any other event. */
|
|
18
|
+
export declare function acknowledgedFilterIn(eventData: string): SubscriptionFilter | undefined;
|
|
19
|
+
//# sourceMappingURL=mcp-20260728.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mcp-20260728.d.ts","sourceRoot":"","sources":["../../src/transport/mcp-20260728.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAIL,KAAK,kBAAkB,EACxB,MAAM,oBAAoB,CAAC;AAG5B,OAAO,KAAK,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAc7E,sGAAsG;AACtG,wBAAgB,kBAAkB,CAAC,eAAe,EAAE,MAAM,GAAG,SAAS,EAAE,MAAM,EAAE,MAAM,GAAG,SAAS,GAAG,OAAO,CAG3G;AAED,uGAAuG;AACvG,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAIvD;AAED,uFAAuF;AACvF,wBAAgB,eAAe,CAAC,OAAO,EAAE,cAAc,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,cAAc,CAItG;AAED,kHAAkH;AAClH,wBAAgB,eAAe,CAC7B,OAAO,EAAE,cAAc,GAAG,SAAS,EACnC,eAAe,CAAC,EAAE,OAAO,GACxB,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAaxB;AAuBD,0EAA0E;AAC1E,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,eAAe,GAAG,SAAS,CASxE;AAED,oHAAoH;AACpH,wBAAgB,oBAAoB,CAAC,SAAS,EAAE,MAAM,GAAG,kBAAkB,GAAG,SAAS,CAQtF"}
|
|
@@ -2,9 +2,10 @@
|
|
|
2
2
|
* @file streamable-http.transport.ts
|
|
3
3
|
* @description StreamableHTTP transport implementation for MCP Test Client
|
|
4
4
|
*/
|
|
5
|
+
import { type SubscriptionFilter } from '@frontmcp/protocol';
|
|
5
6
|
import type { ElicitationHandler } from '../client/mcp-test-client.types';
|
|
6
7
|
import type { InterceptorChain } from '../interceptor';
|
|
7
|
-
import type { JsonRpcRequest, JsonRpcResponse, McpTransport, TransportConfig, TransportState } from './transport.interface';
|
|
8
|
+
import type { JsonRpcRequest, JsonRpcResponse, McpTransport, NotificationHandler, TransportConfig, TransportState } from './transport.interface';
|
|
8
9
|
/**
|
|
9
10
|
* StreamableHTTP transport for MCP communication
|
|
10
11
|
*
|
|
@@ -26,6 +27,10 @@ export declare class StreamableHttpTransport implements McpTransport {
|
|
|
26
27
|
private notificationStream?;
|
|
27
28
|
private notificationProtocolVersion;
|
|
28
29
|
private notificationStreamReopenTimer?;
|
|
30
|
+
private subscriptionStream?;
|
|
31
|
+
private readonly protocolVersion?;
|
|
32
|
+
private readonly requestMeta;
|
|
33
|
+
private readonly toolInputSchemas;
|
|
29
34
|
constructor(config: TransportConfig);
|
|
30
35
|
connect(): Promise<void>;
|
|
31
36
|
/**
|
|
@@ -39,6 +44,9 @@ export declare class StreamableHttpTransport implements McpTransport {
|
|
|
39
44
|
notify(message: JsonRpcRequest): Promise<void>;
|
|
40
45
|
sendRaw(data: string): Promise<JsonRpcResponse>;
|
|
41
46
|
openNotificationStream(protocolVersion: string): Promise<void>;
|
|
47
|
+
listen(id: string | number, notifications: SubscriptionFilter): Promise<SubscriptionFilter | undefined>;
|
|
48
|
+
/** Send a long-lived request with no timeout, handing its notifications on as they arrive. */
|
|
49
|
+
streamRequest(message: JsonRpcRequest, onNotification: NotificationHandler, signal: AbortSignal): Promise<JsonRpcResponse | undefined>;
|
|
42
50
|
close(): Promise<void>;
|
|
43
51
|
isConnected(): boolean;
|
|
44
52
|
getState(): TransportState;
|
|
@@ -57,7 +65,12 @@ export declare class StreamableHttpTransport implements McpTransport {
|
|
|
57
65
|
/** Opens the stream without holding up the caller past the request timeout; close() aborts it at any point. */
|
|
58
66
|
private connectNotificationStream;
|
|
59
67
|
private releaseNotificationStream;
|
|
68
|
+
private closeSubscriptionStream;
|
|
69
|
+
/** Posts `subscriptions/listen`, acknowledges the accepted filter, then records the notifications. */
|
|
70
|
+
private readSubscriptionStream;
|
|
60
71
|
private readNotificationStream;
|
|
72
|
+
private readEventStream;
|
|
73
|
+
private rememberToolInputSchemas;
|
|
61
74
|
/**
|
|
62
75
|
* Handle SSE response with elicitation support.
|
|
63
76
|
*
|
|
@@ -87,6 +100,7 @@ export declare class StreamableHttpTransport implements McpTransport {
|
|
|
87
100
|
* behaviour (`${baseUrl}/`) relied on it (issue #543).
|
|
88
101
|
*/
|
|
89
102
|
private mcpUrl;
|
|
103
|
+
/** `stateless` sends the request as 2026-07-28: no session, and the headers mirrored from `message`. */
|
|
90
104
|
private buildHeaders;
|
|
91
105
|
private ensureConnected;
|
|
92
106
|
private log;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"streamable-http.transport.d.ts","sourceRoot":"","sources":["../../src/transport/streamable-http.transport.ts"],"names":[],"mappings":"AAAA;;;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,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAqBxD,OAAO,CAAC,uBAAuB;IAM/B,+GAA+G;YACjG,yBAAyB;IAiCvC,OAAO,CAAC,yBAAyB;IAIjC,OAAO,CAAC,uBAAuB;IAK/B,sGAAsG;YACxF,sBAAsB;YA6BtB,sBAAsB;YAatB,eAAe;IAuB7B,OAAO,CAAC,wBAAwB;IAQhC;;;;;OAKG;YACW,gCAAgC;IA+F9C;;OAEG;IACH,OAAO,CAAC,cAAc;IAiDtB;;OAEG;YACW,cAAc;IA+C5B;;OAEG;YACW,wBAAwB;IAqCtC;;OAEG;YACW,uBAAuB;IA8BrC;;;;OAIG;IACH,OAAO,CAAC,MAAM;IAWd,wGAAwG;IACxG,OAAO,CAAC,YAAY;IAuCpB,OAAO,CAAC,eAAe;IAMvB,OAAO,CAAC,GAAG;IAMX;;;;;;;;;;;;OAYG;IACH,OAAO,CAAC,2BAA2B;CAsDpC"}
|
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
* @file transport.interface.ts
|
|
3
3
|
* @description Interface for MCP transport implementations
|
|
4
4
|
*/
|
|
5
|
-
import type {
|
|
5
|
+
import type { LoggingLevel, SubscriptionFilter } from '@frontmcp/protocol';
|
|
6
|
+
import type { ClientInfo, ElicitationHandler, TestClientCapabilities } from '../client/mcp-test-client.types';
|
|
6
7
|
export interface JsonRpcRequest {
|
|
7
8
|
jsonrpc: '2.0';
|
|
8
9
|
id?: string | number;
|
|
@@ -111,6 +112,17 @@ export interface McpTransport {
|
|
|
111
112
|
* @param protocolVersion - The version negotiated at initialize, sent as `MCP-Protocol-Version`
|
|
112
113
|
*/
|
|
113
114
|
openNotificationStream?(protocolVersion: string): Promise<void>;
|
|
115
|
+
/**
|
|
116
|
+
* Protocol 2026-07-28: open a `subscriptions/listen` stream, replacing the one open before, and
|
|
117
|
+
* hand its notifications to the notification handler.
|
|
118
|
+
* @returns The notification types the server acknowledged, or undefined when it opened no stream
|
|
119
|
+
*/
|
|
120
|
+
listen?(id: string | number, notifications: SubscriptionFilter): Promise<SubscriptionFilter | undefined>;
|
|
121
|
+
/**
|
|
122
|
+
* Send a long-lived request, such as `events/stream`, without a timeout: hand each notification of its response
|
|
123
|
+
* stream to `onNotification`, and resolve with its final response, or undefined when `signal` ended it first.
|
|
124
|
+
*/
|
|
125
|
+
streamRequest?(message: JsonRpcRequest, onNotification: NotificationHandler, signal: AbortSignal): Promise<JsonRpcResponse | undefined>;
|
|
114
126
|
}
|
|
115
127
|
/**
|
|
116
128
|
* Configuration for transport implementations
|
|
@@ -144,6 +156,12 @@ export interface TransportConfig {
|
|
|
144
156
|
interceptors?: import('../interceptor').InterceptorChain;
|
|
145
157
|
/** Client info for User-Agent header (enables platform detection on server) */
|
|
146
158
|
clientInfo?: ClientInfo;
|
|
159
|
+
/** The protocol revision; `'2026-07-28'` sends every request statelessly, with its `_meta` and mirrored headers */
|
|
160
|
+
protocolVersion?: string;
|
|
161
|
+
/** Protocol 2026-07-28: the capabilities each request declares in its `_meta` */
|
|
162
|
+
capabilities?: TestClientCapabilities;
|
|
163
|
+
/** Protocol 2026-07-28: the log level each request asks for in its `_meta` */
|
|
164
|
+
logLevel?: LoggingLevel;
|
|
147
165
|
/** Handler for server→client elicitation requests during tool execution */
|
|
148
166
|
elicitationHandler?: ElicitationHandler;
|
|
149
167
|
/** Handler for server notifications streamed during a request */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transport.interface.d.ts","sourceRoot":"","sources":["../../src/transport/transport.interface.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;
|
|
1
|
+
{"version":3,"file":"transport.interface.d.ts","sourceRoot":"","sources":["../../src/transport/transport.interface.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAE3E,OAAO,KAAK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c,EAAE,mBAAmB,EACnC,MAAM,EAAE,WAAW,GAClB,OAAO,CAAC,eAAe,GAAG,SAAS,CAAC,CAAC;CACzC;AAED;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,mEAAmE;IACnE,OAAO,EAAE,MAAM,CAAC;IAChB;;;;;OAKG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,sCAAsC;IACtC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,mCAAmC;IACnC,IAAI,CAAC,EAAE;QACL,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;KAClC,CAAC;IACF;;;;OAIG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,2BAA2B;IAC3B,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,0DAA0D;IAC1D,YAAY,CAAC,EAAE,OAAO,gBAAgB,EAAE,gBAAgB,CAAC;IACzD,+EAA+E;IAC/E,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB,mHAAmH;IACnH,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,iFAAiF;IACjF,YAAY,CAAC,EAAE,sBAAsB,CAAC;IACtC,8EAA8E;IAC9E,QAAQ,CAAC,EAAE,YAAY,CAAC;IACxB,2EAA2E;IAC3E,kBAAkB,CAAC,EAAE,kBAAkB,CAAC;IACxC,iEAAiE;IACjE,mBAAmB,CAAC,EAAE,mBAAmB,CAAC;CAC3C"}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { type EventWebhookReceiver } from '@frontmcp/sdk';
|
|
2
|
+
import type { WebhookSignatureCheck } from '@frontmcp/utils';
|
|
3
|
+
export interface WebhookReceiverOptions {
|
|
4
|
+
/**
|
|
5
|
+
* The secrets deliveries of any subscription are signed with. A request none of them signed is answered 401. Without
|
|
6
|
+
* any, and without a secret an events client registered, nothing is checked.
|
|
7
|
+
*/
|
|
8
|
+
secrets?: string[];
|
|
9
|
+
/** The path prefixes the well-known document declares. Without any, the document is a 404 and the challenge is used. */
|
|
10
|
+
receivers?: string[];
|
|
11
|
+
/** The path deliveries are sent to. @default '/hooks/mcp' */
|
|
12
|
+
path?: string;
|
|
13
|
+
/** @default an ephemeral port */
|
|
14
|
+
port?: number;
|
|
15
|
+
}
|
|
16
|
+
export interface WebhookReceiverInfo {
|
|
17
|
+
/** The callback URL to subscribe with. */
|
|
18
|
+
url: string;
|
|
19
|
+
origin: string;
|
|
20
|
+
port: number;
|
|
21
|
+
}
|
|
22
|
+
export type ReceivedWebhookKind = 'verification' | 'gap' | 'terminated' | 'event';
|
|
23
|
+
export interface ReceivedWebhook {
|
|
24
|
+
kind: ReceivedWebhookKind;
|
|
25
|
+
path: string;
|
|
26
|
+
/** The body exactly as it arrived: the bytes the signature covers. */
|
|
27
|
+
body: string;
|
|
28
|
+
/** The body as JSON, or undefined when it is not JSON. */
|
|
29
|
+
json: Record<string, unknown> | undefined;
|
|
30
|
+
webhookId?: string;
|
|
31
|
+
webhookTimestamp?: string;
|
|
32
|
+
webhookSignature?: string;
|
|
33
|
+
subscriptionId?: string;
|
|
34
|
+
/** `unchecked` when the receiver has no secret for the request's subscription. */
|
|
35
|
+
signatureCheck: WebhookSignatureCheck | 'unchecked';
|
|
36
|
+
/** The status the receiver answered with. */
|
|
37
|
+
answeredStatus: number;
|
|
38
|
+
receivedAt: number;
|
|
39
|
+
}
|
|
40
|
+
/** An HTTP server on 127.0.0.1 that stands in for the callback of a webhook subscription. */
|
|
41
|
+
export declare class WebhookReceiver {
|
|
42
|
+
private readonly options;
|
|
43
|
+
private readonly events;
|
|
44
|
+
private readonly received;
|
|
45
|
+
private server;
|
|
46
|
+
private info;
|
|
47
|
+
private failuresLeft;
|
|
48
|
+
private failureStatus;
|
|
49
|
+
private echoesChallenges;
|
|
50
|
+
/** A receiver that is not listening yet. */
|
|
51
|
+
constructor(options?: WebhookReceiverOptions);
|
|
52
|
+
/** The SDK receiver behind it, for `withEvents({ webhook: { url, receiver } })` of an events client. */
|
|
53
|
+
get eventReceiver(): EventWebhookReceiver;
|
|
54
|
+
/** Listen on 127.0.0.1 and answer with the callback URL. */
|
|
55
|
+
start(): Promise<WebhookReceiverInfo>;
|
|
56
|
+
/** Stop listening. */
|
|
57
|
+
stop(): Promise<void>;
|
|
58
|
+
/** The callback URL; the receiver must be started. */
|
|
59
|
+
get url(): string;
|
|
60
|
+
/** Every request received, oldest first. */
|
|
61
|
+
get requests(): readonly ReceivedWebhook[];
|
|
62
|
+
/** The verification challenges received. */
|
|
63
|
+
verifications(): ReceivedWebhook[];
|
|
64
|
+
/** The event deliveries received, retries included. */
|
|
65
|
+
deliveries(): ReceivedWebhook[];
|
|
66
|
+
/** Forget the requests received so far. */
|
|
67
|
+
clear(): void;
|
|
68
|
+
/** Accept deliveries signed with one more secret, as after a rotation. */
|
|
69
|
+
addSecret(secret: string): void;
|
|
70
|
+
/** Answer the next `count` deliveries with `status` instead of 200. Verification challenges are not affected. */
|
|
71
|
+
failNext(count: number, status?: number): void;
|
|
72
|
+
/** Whether a verification challenge is echoed (the default) or answered with an empty object. */
|
|
73
|
+
echoChallenges(echo: boolean): void;
|
|
74
|
+
/** Resolve once `count` event deliveries arrived, retries included; reject after `timeoutMs`. */
|
|
75
|
+
waitForDeliveries(count: number, timeoutMs?: number): Promise<ReceivedWebhook[]>;
|
|
76
|
+
/** Answer one request: the well-known document, or a webhook that is checked, recorded and answered. */
|
|
77
|
+
private handle;
|
|
78
|
+
/** The answer to a webhook: unchecked without secrets, a pending failure for a signed delivery, else the SDK's. */
|
|
79
|
+
private answer;
|
|
80
|
+
/** Serve the well-known document when the receiver declares path prefixes. */
|
|
81
|
+
private answerWellKnown;
|
|
82
|
+
/** The status of the next delivery: a pending failure, else 200. */
|
|
83
|
+
private nextDeliveryStatus;
|
|
84
|
+
}
|
|
85
|
+
//# sourceMappingURL=webhook-receiver.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3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