agents 0.19.0 → 0.20.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 +24 -19
- package/dist/{agent-tool-types-BNUGGBzQ.d.ts → agent-tool-types-Btk9ETS-.d.ts} +997 -356
- package/dist/agent-tool-types.d.ts +1 -1
- package/dist/{agent-tools-BFbzVLFc.d.ts → agent-tools-UuScsJg3.d.ts} +2 -2
- package/dist/agent-tools.d.ts +1 -1
- package/dist/browser/ai.js +1 -1
- package/dist/browser/index.js +1 -1
- package/dist/chat/index.d.ts +2 -2
- package/dist/chat-sdk/index.d.ts +1 -1
- package/dist/client-invoker-BNSZxAkv.d.ts +20 -0
- package/dist/client-invoker-VNZ7X0nn.js +57 -0
- package/dist/client-invoker-VNZ7X0nn.js.map +1 -0
- package/dist/{client-CcjiFpTf.js → client-zqKcsyFa.js} +434 -168
- package/dist/client-zqKcsyFa.js.map +1 -0
- package/dist/client.d.ts +1 -1
- package/dist/{connector-CdldGF3h.js → connector-KEJnl6e5.js} +2 -2
- package/dist/connector-KEJnl6e5.js.map +1 -0
- package/dist/{do-oauth-client-provider-D4ZwyBDu.d.ts → do-oauth-client-provider-VTZj2VtM.d.ts} +23 -11
- package/dist/experimental/webmcp.js +1 -1
- package/dist/handler-stateless-8hQN_kC3.js +367 -0
- package/dist/handler-stateless-8hQN_kC3.js.map +1 -0
- package/dist/handler-stateless-C_bo-Ytq.d.ts +107 -0
- package/dist/index.d.ts +12 -12
- package/dist/index.js +3 -2
- package/dist/index.js.map +1 -1
- package/dist/mcp/client.d.ts +22 -18
- package/dist/mcp/client.js +1 -1
- package/dist/mcp/do-oauth-client-provider.d.ts +1 -1
- package/dist/mcp/do-oauth-client-provider.js +25 -12
- package/dist/mcp/do-oauth-client-provider.js.map +1 -1
- package/dist/mcp/index.d.ts +48 -34
- package/dist/mcp/index.js +84 -79
- package/dist/mcp/index.js.map +1 -1
- package/dist/mcp/server.d.ts +17 -0
- package/dist/mcp/server.js +2 -0
- package/dist/mcp/x402.d.ts +21 -9
- package/dist/mcp/x402.js +8 -7
- package/dist/mcp/x402.js.map +1 -1
- package/dist/react.d.ts +1 -1
- package/dist/serializable.d.ts +1 -1
- package/dist/sub-routing.d.ts +6 -6
- package/dist/workflows.d.ts +1 -1
- package/docs/human-in-the-loop.md +63 -82
- package/docs/mcp-client.md +31 -7
- package/docs/mcp-servers.md +125 -88
- package/docs/securing-mcp-servers.md +9 -6
- package/package.json +28 -7
- package/dist/client-CcjiFpTf.js.map +0 -1
- package/dist/connector-CdldGF3h.js.map +0 -1
|
@@ -5,7 +5,19 @@ import {
|
|
|
5
5
|
r as ObservabilityEvent,
|
|
6
6
|
s as MCPObservabilityEvent
|
|
7
7
|
} from "./index-BRnybD6X.js";
|
|
8
|
-
import { t as AgentMcpOAuthProvider } from "./do-oauth-client-provider-
|
|
8
|
+
import { t as AgentMcpOAuthProvider } from "./do-oauth-client-provider-VTZj2VtM.js";
|
|
9
|
+
import {
|
|
10
|
+
a as McpAuthContext,
|
|
11
|
+
c as CORSOptions,
|
|
12
|
+
d as ServeOptions,
|
|
13
|
+
f as TransportType,
|
|
14
|
+
l as MaybePromise,
|
|
15
|
+
n as StatelessMcpHandler,
|
|
16
|
+
s as BaseTransportType,
|
|
17
|
+
t as CreateStatelessMcpHandlerOptions,
|
|
18
|
+
u as McpClientOptions
|
|
19
|
+
} from "./handler-stateless-C_bo-Ytq.js";
|
|
20
|
+
import { n as LegacyCallToolResultSchema } from "./client-invoker-BNSZxAkv.js";
|
|
9
21
|
import {
|
|
10
22
|
_ as WorkflowEventPayload,
|
|
11
23
|
d as WorkflowCallback,
|
|
@@ -29,51 +41,58 @@ import {
|
|
|
29
41
|
WSMessage as WSMessage$1
|
|
30
42
|
} from "partyserver";
|
|
31
43
|
import { z } from "zod";
|
|
32
|
-
import { Client } from "@modelcontextprotocol/sdk/client/index.js";
|
|
33
|
-
import {
|
|
34
|
-
SSEClientTransport,
|
|
35
|
-
SSEClientTransportOptions
|
|
36
|
-
} from "@modelcontextprotocol/sdk/client/sse.js";
|
|
37
|
-
import {
|
|
38
|
-
StreamableHTTPClientTransport,
|
|
39
|
-
StreamableHTTPClientTransportOptions
|
|
40
|
-
} from "@modelcontextprotocol/sdk/client/streamableHttp.js";
|
|
41
44
|
import {
|
|
45
|
+
CacheableRequestOptions,
|
|
42
46
|
CallToolRequest,
|
|
43
|
-
|
|
47
|
+
CallToolRequestOptions,
|
|
48
|
+
Client,
|
|
44
49
|
ClientCapabilities,
|
|
45
|
-
|
|
50
|
+
DiscoverResult,
|
|
46
51
|
ElicitRequest,
|
|
47
52
|
ElicitRequest as ElicitRequest$1,
|
|
48
|
-
|
|
53
|
+
ElicitRequest as ElicitRequest$2,
|
|
49
54
|
ElicitResult,
|
|
50
|
-
ElicitResult as ElicitResult$
|
|
55
|
+
ElicitResult as ElicitResult$2,
|
|
56
|
+
ElicitResult as ElicitResult$3,
|
|
51
57
|
GetPromptRequest,
|
|
52
|
-
InitializeRequestParams,
|
|
53
58
|
JSONRPCMessage,
|
|
54
59
|
MessageExtraInfo,
|
|
55
60
|
Prompt,
|
|
56
61
|
ReadResourceRequest,
|
|
57
|
-
|
|
62
|
+
RequestOptions,
|
|
58
63
|
Resource,
|
|
59
|
-
|
|
64
|
+
ResourceTemplateType,
|
|
65
|
+
SSEClientTransport,
|
|
66
|
+
SSEClientTransportOptions,
|
|
60
67
|
ServerCapabilities,
|
|
61
|
-
|
|
68
|
+
StreamableHTTPClientTransport,
|
|
69
|
+
StreamableHTTPClientTransportOptions,
|
|
70
|
+
StreamableHTTPReconnectionOptions,
|
|
71
|
+
Tool,
|
|
72
|
+
Transport,
|
|
73
|
+
TransportSendOptions
|
|
74
|
+
} from "@modelcontextprotocol/client";
|
|
75
|
+
import {
|
|
76
|
+
ElicitRequestSchema,
|
|
77
|
+
ElicitResult as ElicitResult$1,
|
|
78
|
+
InitializeRequestParams,
|
|
79
|
+
JSONRPCMessage as JSONRPCMessage$1,
|
|
80
|
+
MessageExtraInfo as MessageExtraInfo$1,
|
|
81
|
+
RequestId
|
|
62
82
|
} from "@modelcontextprotocol/sdk/types.js";
|
|
63
|
-
import {
|
|
83
|
+
import { McpServerFactory } from "@modelcontextprotocol/server";
|
|
84
|
+
import { McpServer as McpServer$1 } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
85
|
+
import { Server as Server$2 } from "@modelcontextprotocol/sdk/server/index.js";
|
|
64
86
|
import {
|
|
65
87
|
EventStore as EventStore$1,
|
|
66
88
|
StreamId as StreamId$1,
|
|
67
|
-
WebStandardStreamableHTTPServerTransport,
|
|
89
|
+
WebStandardStreamableHTTPServerTransport as WebStandardStreamableHTTPServerTransport$1,
|
|
68
90
|
WebStandardStreamableHTTPServerTransportOptions
|
|
69
91
|
} from "@modelcontextprotocol/sdk/server/webStandardStreamableHttp.js";
|
|
70
|
-
import { RequestOptions } from "@modelcontextprotocol/sdk/shared/protocol.js";
|
|
71
92
|
import {
|
|
72
|
-
Transport,
|
|
73
|
-
TransportSendOptions
|
|
93
|
+
Transport as Transport$1,
|
|
94
|
+
TransportSendOptions as TransportSendOptions$1
|
|
74
95
|
} from "@modelcontextprotocol/sdk/shared/transport.js";
|
|
75
|
-
import { Server as Server$1 } from "@modelcontextprotocol/sdk/server/index.js";
|
|
76
|
-
import { Client as Client$1 } from "@modelcontextprotocol/sdk/client";
|
|
77
96
|
import {
|
|
78
97
|
EventId,
|
|
79
98
|
EventStore,
|
|
@@ -209,35 +228,15 @@ declare class Emitter<T> implements Disposable {
|
|
|
209
228
|
dispose(): void;
|
|
210
229
|
}
|
|
211
230
|
//#endregion
|
|
212
|
-
//#region src/mcp/types.d.ts
|
|
213
|
-
type MaybePromise<T> = T | Promise<T>;
|
|
214
|
-
type HttpTransportType = "sse" | "streamable-http";
|
|
215
|
-
type BaseTransportType = HttpTransportType | "rpc";
|
|
216
|
-
type TransportType = BaseTransportType | "auto";
|
|
217
|
-
interface CORSOptions {
|
|
218
|
-
origin?: string;
|
|
219
|
-
methods?: string;
|
|
220
|
-
headers?: string;
|
|
221
|
-
maxAge?: number;
|
|
222
|
-
exposeHeaders?: string;
|
|
223
|
-
}
|
|
224
|
-
interface ServeOptions {
|
|
225
|
-
binding?: string;
|
|
226
|
-
corsOptions?: CORSOptions;
|
|
227
|
-
transport?: TransportType;
|
|
228
|
-
jurisdiction?: DurableObjectJurisdiction;
|
|
229
|
-
}
|
|
230
|
-
type McpClientOptions = ConstructorParameters<typeof Client$1>[1];
|
|
231
|
-
//#endregion
|
|
232
231
|
//#region src/mcp/client-transports.d.ts
|
|
233
232
|
/**
|
|
234
|
-
* @deprecated Use SSEClientTransport from @modelcontextprotocol/
|
|
233
|
+
* @deprecated Use SSEClientTransport from @modelcontextprotocol/client instead. This alias will be removed in the next major version.
|
|
235
234
|
*/
|
|
236
235
|
declare class SSEEdgeClientTransport extends SSEClientTransport {
|
|
237
236
|
constructor(url: URL, options: SSEClientTransportOptions);
|
|
238
237
|
}
|
|
239
238
|
/**
|
|
240
|
-
* @deprecated Use StreamableHTTPClientTransport from @modelcontextprotocol/
|
|
239
|
+
* @deprecated Use StreamableHTTPClientTransport from @modelcontextprotocol/client instead. This alias will be removed in the next major version.
|
|
241
240
|
*/
|
|
242
241
|
declare class StreamableHTTPEdgeClientTransport extends StreamableHTTPClientTransport {
|
|
243
242
|
constructor(url: URL, options: StreamableHTTPClientTransportOptions);
|
|
@@ -275,7 +274,7 @@ interface WorkerTransportOptions extends WebStandardStreamableHTTPServerTranspor
|
|
|
275
274
|
*/
|
|
276
275
|
storage?: MCPStorageApi;
|
|
277
276
|
}
|
|
278
|
-
declare class WorkerTransport extends WebStandardStreamableHTTPServerTransport {
|
|
277
|
+
declare class WorkerTransport extends WebStandardStreamableHTTPServerTransport$1 {
|
|
279
278
|
private readonly _corsOptions?;
|
|
280
279
|
private readonly _storage?;
|
|
281
280
|
private _stateRestored;
|
|
@@ -353,7 +352,10 @@ declare class WorkerTransport extends WebStandardStreamableHTTPServerTransport {
|
|
|
353
352
|
* unhandled-rejection tracker can fire before the caller's own `await`
|
|
354
353
|
* observes it.
|
|
355
354
|
*/
|
|
356
|
-
send(
|
|
355
|
+
send(
|
|
356
|
+
message: JSONRPCMessage$1,
|
|
357
|
+
options?: TransportSendOptions$1
|
|
358
|
+
): Promise<void>;
|
|
357
359
|
/**
|
|
358
360
|
* If the response is an SSE stream, tee the body through a TransformStream
|
|
359
361
|
* that injects a `: keepalive\n\n` comment frame every 25s. The interval
|
|
@@ -390,42 +392,58 @@ declare class WorkerTransport extends WebStandardStreamableHTTPServerTransport {
|
|
|
390
392
|
private saveState;
|
|
391
393
|
}
|
|
392
394
|
//#endregion
|
|
393
|
-
//#region src/mcp/
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
declare function getMcpAuthContext(): McpAuthContext | undefined;
|
|
398
|
-
//#endregion
|
|
399
|
-
//#region src/mcp/handler.d.ts
|
|
400
|
-
interface CreateMcpHandlerOptions extends WorkerTransportOptions {
|
|
401
|
-
/**
|
|
402
|
-
* The route path that this MCP handler should respond to.
|
|
403
|
-
* If specified, the handler will only process requests that match this route.
|
|
404
|
-
* @default "/mcp"
|
|
405
|
-
*/
|
|
395
|
+
//#region src/mcp/handler-legacy.d.ts
|
|
396
|
+
/** Options for the retained SDK v1, sessionful handler. */
|
|
397
|
+
interface CreateLegacyMcpHandlerOptions extends WorkerTransportOptions {
|
|
398
|
+
/** Exact route handled by this handler. @default "/mcp" */
|
|
406
399
|
route?: string;
|
|
407
|
-
/**
|
|
408
|
-
* An optional auth context to use for handling MCP requests.
|
|
409
|
-
* If not provided, the handler will look for props in the execution context.
|
|
410
|
-
*/
|
|
400
|
+
/** Application props exposed through {@link getMcpAuthContext}. */
|
|
411
401
|
authContext?: McpAuthContext;
|
|
412
|
-
/**
|
|
413
|
-
* An optional transport to use for handling MCP requests.
|
|
414
|
-
* If not provided, a WorkerTransport will be created with the provided WorkerTransportOptions.
|
|
415
|
-
*/
|
|
402
|
+
/** Pre-created sessionful transport. */
|
|
416
403
|
transport?: WorkerTransport;
|
|
417
404
|
}
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
405
|
+
type CreateMcpHandlerOptions$1 = CreateLegacyMcpHandlerOptions;
|
|
406
|
+
type LegacyMcpHandler = (
|
|
407
|
+
request: Request,
|
|
408
|
+
env: unknown,
|
|
409
|
+
ctx: ExecutionContext
|
|
410
|
+
) => Promise<Response>;
|
|
411
|
+
/**
|
|
412
|
+
* Create a sessionful Legacy MCP handler backed by SDK v1.
|
|
413
|
+
*
|
|
414
|
+
* New Stateless servers should use `createMcpHandler` from
|
|
415
|
+
* `agents/mcp/server` instead.
|
|
416
|
+
*/
|
|
417
|
+
declare function createLegacyMcpHandler(
|
|
418
|
+
server: McpServer$1 | Server$2,
|
|
419
|
+
options?: CreateLegacyMcpHandlerOptions
|
|
420
|
+
): LegacyMcpHandler;
|
|
421
|
+
//#endregion
|
|
422
|
+
//#region src/mcp/handler-compat.d.ts
|
|
423
|
+
/**
|
|
424
|
+
* @deprecated Passing an SDK v1 server to createMcpHandler is deprecated and
|
|
425
|
+
* will be removed in the next major version. Pass an SDK v2 factory to
|
|
426
|
+
* createMcpHandler. Use createLegacyMcpHandler only to temporarily retain
|
|
427
|
+
* sessionful SDK v1 behavior while migrating.
|
|
428
|
+
*/
|
|
429
|
+
declare function createMcpHandler$1(
|
|
430
|
+
server: McpServer$1 | Server$2,
|
|
431
|
+
options?: CreateMcpHandlerOptions$1
|
|
432
|
+
): LegacyMcpHandler;
|
|
433
|
+
declare function createMcpHandler$1(
|
|
434
|
+
factory: McpServerFactory,
|
|
435
|
+
options?: CreateStatelessMcpHandlerOptions
|
|
436
|
+
): StatelessMcpHandler;
|
|
422
437
|
/**
|
|
423
|
-
* @deprecated
|
|
438
|
+
* @deprecated Pass an SDK v2 factory to createMcpHandler.
|
|
439
|
+
* experimental_createMcpHandler will be removed in the next major version.
|
|
440
|
+
* Use createLegacyMcpHandler only to temporarily retain sessionful SDK v1
|
|
441
|
+
* behavior while migrating.
|
|
424
442
|
*/
|
|
425
443
|
declare function experimental_createMcpHandler(
|
|
426
|
-
server: McpServer | Server$
|
|
427
|
-
options?: CreateMcpHandlerOptions
|
|
428
|
-
):
|
|
444
|
+
server: McpServer$1 | Server$2,
|
|
445
|
+
options?: CreateMcpHandlerOptions$1
|
|
446
|
+
): LegacyMcpHandler;
|
|
429
447
|
//#endregion
|
|
430
448
|
//#region src/mcp/event-store.d.ts
|
|
431
449
|
/**
|
|
@@ -481,14 +499,14 @@ declare class DurableObjectEventStore implements EventStore {
|
|
|
481
499
|
private readonly seqByStream;
|
|
482
500
|
private readonly seqInit;
|
|
483
501
|
constructor(storage: DurableObjectStorage);
|
|
484
|
-
storeEvent(streamId: StreamId, message: JSONRPCMessage): Promise<EventId>;
|
|
502
|
+
storeEvent(streamId: StreamId, message: JSONRPCMessage$1): Promise<EventId>;
|
|
485
503
|
getStreamIdForEventId(eventId: EventId): Promise<StreamId | undefined>;
|
|
486
504
|
replayEventsAfter(
|
|
487
505
|
lastEventId: EventId,
|
|
488
506
|
{
|
|
489
507
|
send
|
|
490
508
|
}: {
|
|
491
|
-
send: (eventId: EventId, message: JSONRPCMessage) => Promise<void>;
|
|
509
|
+
send: (eventId: EventId, message: JSONRPCMessage$1) => Promise<void>;
|
|
492
510
|
}
|
|
493
511
|
): Promise<StreamId>;
|
|
494
512
|
/**
|
|
@@ -515,7 +533,13 @@ interface ClearableEventStore extends EventStore$1 {
|
|
|
515
533
|
clearStream(streamId: StreamId$1): Promise<void>;
|
|
516
534
|
}
|
|
517
535
|
//#endregion
|
|
518
|
-
//#region src/mcp/
|
|
536
|
+
//#region src/mcp/legacy-agent.d.ts
|
|
537
|
+
/**
|
|
538
|
+
* @deprecated McpAgent is feature-frozen. Migrate to an SDK v2 factory with
|
|
539
|
+
* createMcpHandler from agents/mcp/server. When sessionful features prevent an
|
|
540
|
+
* immediate migration, run the stateless route beside the existing McpAgent
|
|
541
|
+
* route until clients transition and sessions drain.
|
|
542
|
+
*/
|
|
519
543
|
declare abstract class McpAgent<
|
|
520
544
|
Env extends Cloudflare.Env = Cloudflare.Env,
|
|
521
545
|
State = unknown,
|
|
@@ -528,10 +552,10 @@ declare abstract class McpAgent<
|
|
|
528
552
|
_connection: Connection$1,
|
|
529
553
|
ctx: ConnectionContext$1
|
|
530
554
|
): boolean;
|
|
531
|
-
abstract server: MaybePromise<McpServer | Server$
|
|
555
|
+
abstract server: MaybePromise<McpServer$1 | Server$2>;
|
|
532
556
|
abstract init(): Promise<void>;
|
|
533
|
-
setInitializeRequest(initializeRequest: JSONRPCMessage): Promise<void>;
|
|
534
|
-
getInitializeRequest(): Promise<JSONRPCMessage | undefined>;
|
|
557
|
+
setInitializeRequest(initializeRequest: JSONRPCMessage$1): Promise<void>;
|
|
558
|
+
getInitializeRequest(): Promise<JSONRPCMessage$1 | undefined>;
|
|
535
559
|
/**
|
|
536
560
|
* Storage key prefix for the `streamId -> requestIds` mapping used
|
|
537
561
|
* to support POST stream resumption across WebSocket reconnects.
|
|
@@ -628,7 +652,7 @@ declare abstract class McpAgent<
|
|
|
628
652
|
onSSEMcpMessage(
|
|
629
653
|
_sessionId: string,
|
|
630
654
|
messageBody: unknown,
|
|
631
|
-
extraInfo?: MessageExtraInfo
|
|
655
|
+
extraInfo?: MessageExtraInfo$1
|
|
632
656
|
): Promise<Error | null>;
|
|
633
657
|
/** Elicit user input with a message and schema */
|
|
634
658
|
elicitInput(
|
|
@@ -639,7 +663,7 @@ declare abstract class McpAgent<
|
|
|
639
663
|
options?: {
|
|
640
664
|
relatedRequestId?: RequestId;
|
|
641
665
|
}
|
|
642
|
-
): Promise<ElicitResult>;
|
|
666
|
+
): Promise<ElicitResult$1>;
|
|
643
667
|
/** Handle elicitation responses via in-memory resolver */
|
|
644
668
|
private _handleElicitationResponse;
|
|
645
669
|
/**
|
|
@@ -649,8 +673,8 @@ declare abstract class McpAgent<
|
|
|
649
673
|
* @returns The response message(s) or undefined
|
|
650
674
|
*/
|
|
651
675
|
handleMcpMessage(
|
|
652
|
-
message: JSONRPCMessage | JSONRPCMessage[]
|
|
653
|
-
): Promise<JSONRPCMessage | JSONRPCMessage[] | undefined>;
|
|
676
|
+
message: JSONRPCMessage$1 | JSONRPCMessage$1[]
|
|
677
|
+
): Promise<JSONRPCMessage$1 | JSONRPCMessage$1[] | undefined>;
|
|
654
678
|
/** Return a handler for the given path for this MCP.
|
|
655
679
|
* Defaults to Streamable HTTP transport.
|
|
656
680
|
*/
|
|
@@ -693,6 +717,8 @@ declare abstract class McpAgent<
|
|
|
693
717
|
}
|
|
694
718
|
//#endregion
|
|
695
719
|
//#region src/mcp/rpc.d.ts
|
|
720
|
+
type JSONRPCMessage$2 = JSONRPCMessage$1;
|
|
721
|
+
type MessageExtraInfo$2 = MessageExtraInfo$1;
|
|
696
722
|
declare const RPC_DO_PREFIX = "rpc:";
|
|
697
723
|
interface RPCClientTransportOptions<T extends McpAgent = McpAgent> {
|
|
698
724
|
namespace: DurableObjectNamespace<T>;
|
|
@@ -723,7 +749,7 @@ declare class RPCClientTransport implements Transport {
|
|
|
723
749
|
interface RPCServerTransportOptions {
|
|
724
750
|
timeout?: number;
|
|
725
751
|
}
|
|
726
|
-
declare class RPCServerTransport implements Transport {
|
|
752
|
+
declare class RPCServerTransport implements Transport$1 {
|
|
727
753
|
private _started;
|
|
728
754
|
private _protocolVersion?;
|
|
729
755
|
private _timeout;
|
|
@@ -732,7 +758,7 @@ declare class RPCServerTransport implements Transport {
|
|
|
732
758
|
sessionId?: string;
|
|
733
759
|
onclose?: () => void;
|
|
734
760
|
onerror?: (error: Error) => void;
|
|
735
|
-
onmessage?: (message: JSONRPCMessage, extra?: MessageExtraInfo) => void;
|
|
761
|
+
onmessage?: (message: JSONRPCMessage$2, extra?: MessageExtraInfo$2) => void;
|
|
736
762
|
constructor(options?: RPCServerTransportOptions);
|
|
737
763
|
setProtocolVersion(version: string): void;
|
|
738
764
|
getProtocolVersion(): string | undefined;
|
|
@@ -745,7 +771,10 @@ declare class RPCServerTransport implements Transport {
|
|
|
745
771
|
private _appendRequest;
|
|
746
772
|
private _completeContinuation;
|
|
747
773
|
private _appendContinuation;
|
|
748
|
-
send(
|
|
774
|
+
send(
|
|
775
|
+
message: JSONRPCMessage$2,
|
|
776
|
+
options?: TransportSendOptions$1
|
|
777
|
+
): Promise<void>;
|
|
749
778
|
/**
|
|
750
779
|
* @internal Called by McpAgent.handleMcpMessage() — not for external use.
|
|
751
780
|
*
|
|
@@ -759,11 +788,11 @@ declare class RPCServerTransport implements Transport {
|
|
|
759
788
|
* for id-based routing; this continuation waiter receives it instead.
|
|
760
789
|
*/
|
|
761
790
|
_awaitPendingResponse(): Promise<
|
|
762
|
-
JSONRPCMessage | JSONRPCMessage[] | undefined
|
|
791
|
+
JSONRPCMessage$2 | JSONRPCMessage$2[] | undefined
|
|
763
792
|
>;
|
|
764
793
|
handle(
|
|
765
|
-
message: JSONRPCMessage | JSONRPCMessage[]
|
|
766
|
-
): Promise<JSONRPCMessage | JSONRPCMessage[] | undefined>;
|
|
794
|
+
message: JSONRPCMessage$2 | JSONRPCMessage$2[]
|
|
795
|
+
): Promise<JSONRPCMessage$2 | JSONRPCMessage$2[] | undefined>;
|
|
767
796
|
}
|
|
768
797
|
//#endregion
|
|
769
798
|
//#region src/mcp/client-connection.d.ts
|
|
@@ -815,7 +844,11 @@ type MCPDiscoveryResult =
|
|
|
815
844
|
* Held in memory only — never persisted — so it must be re-supplied when a
|
|
816
845
|
* connection is recreated (e.g. after Durable Object hibernation).
|
|
817
846
|
*/
|
|
818
|
-
type MCPElicitationHandler = (
|
|
847
|
+
type MCPElicitationHandler = (
|
|
848
|
+
request: ElicitRequest /** Aborts when the originating MCP call is cancelled or exhausts its total-time budget. */,
|
|
849
|
+
|
|
850
|
+
signal?: AbortSignal
|
|
851
|
+
) => Promise<ElicitResult>;
|
|
819
852
|
type MCPElicitationHandlers = {
|
|
820
853
|
form?: MCPElicitationHandler;
|
|
821
854
|
url?: MCPElicitationHandler;
|
|
@@ -825,7 +858,7 @@ declare class MCPClientConnection {
|
|
|
825
858
|
private readonly _info;
|
|
826
859
|
options: {
|
|
827
860
|
transport: MCPTransportOptions;
|
|
828
|
-
client: McpClientOptions
|
|
861
|
+
client: NonNullable<McpClientOptions>;
|
|
829
862
|
elicitationHandlers?: MCPElicitationHandlers;
|
|
830
863
|
/**
|
|
831
864
|
* Client capabilities persisted from a previous session, advertised
|
|
@@ -833,7 +866,8 @@ declare class MCPClientConnection {
|
|
|
833
866
|
* by {@link configureElicitationHandlers} — reconfigured handlers are
|
|
834
867
|
* the source of truth. Explicit `client.capabilities` win per key.
|
|
835
868
|
*/
|
|
836
|
-
capabilitySeed?: ClientCapabilities
|
|
869
|
+
capabilitySeed?: ClientCapabilities /** SDK discovery result paired with a resumed Stateless HTTP session. */;
|
|
870
|
+
discoverResult?: DiscoverResult;
|
|
837
871
|
};
|
|
838
872
|
client: Client;
|
|
839
873
|
connectionState: MCPConnectionState;
|
|
@@ -850,9 +884,10 @@ declare class MCPClientConnection {
|
|
|
850
884
|
* endpoint when the authorization server is not at the default location.
|
|
851
885
|
*/
|
|
852
886
|
private _pendingAuthTransport?;
|
|
887
|
+
private _restoredListSubscription?;
|
|
853
888
|
prompts: Prompt[];
|
|
854
889
|
resources: Resource[];
|
|
855
|
-
resourceTemplates:
|
|
890
|
+
resourceTemplates: ResourceTemplateType[];
|
|
856
891
|
serverCapabilities: ServerCapabilities | undefined;
|
|
857
892
|
/** True when resuming a streamable-http session without cached capabilities */
|
|
858
893
|
private _probingCapabilities;
|
|
@@ -860,6 +895,8 @@ declare class MCPClientConnection {
|
|
|
860
895
|
private _discoveryAbortController;
|
|
861
896
|
private readonly _onObservabilityEvent;
|
|
862
897
|
readonly onObservabilityEvent: Event<MCPObservabilityEvent>;
|
|
898
|
+
private readonly _onListChanged;
|
|
899
|
+
readonly onListChanged: Event<void>;
|
|
863
900
|
/**
|
|
864
901
|
* Whether the connection advertised the elicitation capability. The SDK
|
|
865
902
|
* client refuses to register an `elicitation/create` request handler when
|
|
@@ -872,7 +909,7 @@ declare class MCPClientConnection {
|
|
|
872
909
|
_info: ConstructorParameters<typeof Client>[0],
|
|
873
910
|
options?: {
|
|
874
911
|
transport: MCPTransportOptions;
|
|
875
|
-
client: McpClientOptions
|
|
912
|
+
client: NonNullable<McpClientOptions>;
|
|
876
913
|
elicitationHandlers?: MCPElicitationHandlers;
|
|
877
914
|
/**
|
|
878
915
|
* Client capabilities persisted from a previous session, advertised
|
|
@@ -880,7 +917,8 @@ declare class MCPClientConnection {
|
|
|
880
917
|
* by {@link configureElicitationHandlers} — reconfigured handlers are
|
|
881
918
|
* the source of truth. Explicit `client.capabilities` win per key.
|
|
882
919
|
*/
|
|
883
|
-
capabilitySeed?: ClientCapabilities
|
|
920
|
+
capabilitySeed?: ClientCapabilities /** SDK discovery result paired with a resumed Stateless HTTP session. */;
|
|
921
|
+
discoverResult?: DiscoverResult;
|
|
884
922
|
}
|
|
885
923
|
);
|
|
886
924
|
private createClient;
|
|
@@ -912,7 +950,7 @@ declare class MCPClientConnection {
|
|
|
912
950
|
* Complete OAuth authorization
|
|
913
951
|
*/
|
|
914
952
|
completeAuthorization(
|
|
915
|
-
|
|
953
|
+
callback: string | URLSearchParams,
|
|
916
954
|
options?: {
|
|
917
955
|
alreadyAccepted?: boolean;
|
|
918
956
|
}
|
|
@@ -951,7 +989,8 @@ declare class MCPClientConnection {
|
|
|
951
989
|
* Should only be called if serverCapabilities.prompts exists
|
|
952
990
|
*/
|
|
953
991
|
registerPrompts(): Promise<Prompt[]>;
|
|
954
|
-
registerResourceTemplates(): Promise<
|
|
992
|
+
registerResourceTemplates(): Promise<ResourceTemplateType[]>;
|
|
993
|
+
private catalogFetchOptions;
|
|
955
994
|
fetchTools(): Promise<
|
|
956
995
|
{
|
|
957
996
|
inputSchema: {
|
|
@@ -959,7 +998,648 @@ declare class MCPClientConnection {
|
|
|
959
998
|
type: "object";
|
|
960
999
|
properties?:
|
|
961
1000
|
| {
|
|
962
|
-
[x: string]:
|
|
1001
|
+
[x: string]:
|
|
1002
|
+
| string
|
|
1003
|
+
| number
|
|
1004
|
+
| boolean
|
|
1005
|
+
| {
|
|
1006
|
+
[x: string]:
|
|
1007
|
+
| string
|
|
1008
|
+
| number
|
|
1009
|
+
| boolean
|
|
1010
|
+
| /*elided*/ any
|
|
1011
|
+
| (
|
|
1012
|
+
| string
|
|
1013
|
+
| number
|
|
1014
|
+
| boolean
|
|
1015
|
+
| /*elided*/ any
|
|
1016
|
+
| (
|
|
1017
|
+
| string
|
|
1018
|
+
| number
|
|
1019
|
+
| boolean
|
|
1020
|
+
| /*elided*/ any
|
|
1021
|
+
| (
|
|
1022
|
+
| string
|
|
1023
|
+
| number
|
|
1024
|
+
| boolean
|
|
1025
|
+
| /*elided*/ any
|
|
1026
|
+
| (
|
|
1027
|
+
| string
|
|
1028
|
+
| number
|
|
1029
|
+
| boolean
|
|
1030
|
+
| /*elided*/ any
|
|
1031
|
+
| (
|
|
1032
|
+
| string
|
|
1033
|
+
| number
|
|
1034
|
+
| boolean
|
|
1035
|
+
| /*elided*/ any
|
|
1036
|
+
| (
|
|
1037
|
+
| string
|
|
1038
|
+
| number
|
|
1039
|
+
| boolean
|
|
1040
|
+
| /*elided*/ any
|
|
1041
|
+
| (
|
|
1042
|
+
| string
|
|
1043
|
+
| number
|
|
1044
|
+
| boolean
|
|
1045
|
+
| /*elided*/ any
|
|
1046
|
+
| (
|
|
1047
|
+
| string
|
|
1048
|
+
| number
|
|
1049
|
+
| boolean
|
|
1050
|
+
| /*elided*/ any
|
|
1051
|
+
| (
|
|
1052
|
+
| string
|
|
1053
|
+
| number
|
|
1054
|
+
| boolean
|
|
1055
|
+
| /*elided*/ any
|
|
1056
|
+
| (
|
|
1057
|
+
| string
|
|
1058
|
+
| number
|
|
1059
|
+
| boolean
|
|
1060
|
+
| /*elided*/ any
|
|
1061
|
+
| (
|
|
1062
|
+
| string
|
|
1063
|
+
| number
|
|
1064
|
+
| boolean
|
|
1065
|
+
| /*elided*/ any
|
|
1066
|
+
| /*elided*/ any
|
|
1067
|
+
| null
|
|
1068
|
+
)[]
|
|
1069
|
+
| null
|
|
1070
|
+
)[]
|
|
1071
|
+
| null
|
|
1072
|
+
)[]
|
|
1073
|
+
| null
|
|
1074
|
+
)[]
|
|
1075
|
+
| null
|
|
1076
|
+
)[]
|
|
1077
|
+
| null
|
|
1078
|
+
)[]
|
|
1079
|
+
| null
|
|
1080
|
+
)[]
|
|
1081
|
+
| null
|
|
1082
|
+
)[]
|
|
1083
|
+
| null
|
|
1084
|
+
)[]
|
|
1085
|
+
| null
|
|
1086
|
+
)[]
|
|
1087
|
+
| null
|
|
1088
|
+
)[]
|
|
1089
|
+
| null;
|
|
1090
|
+
}
|
|
1091
|
+
| (
|
|
1092
|
+
| string
|
|
1093
|
+
| number
|
|
1094
|
+
| boolean
|
|
1095
|
+
| {
|
|
1096
|
+
[x: string]:
|
|
1097
|
+
| string
|
|
1098
|
+
| number
|
|
1099
|
+
| boolean
|
|
1100
|
+
| /*elided*/ any
|
|
1101
|
+
| (
|
|
1102
|
+
| string
|
|
1103
|
+
| number
|
|
1104
|
+
| boolean
|
|
1105
|
+
| /*elided*/ any
|
|
1106
|
+
| (
|
|
1107
|
+
| string
|
|
1108
|
+
| number
|
|
1109
|
+
| boolean
|
|
1110
|
+
| /*elided*/ any
|
|
1111
|
+
| (
|
|
1112
|
+
| string
|
|
1113
|
+
| number
|
|
1114
|
+
| boolean
|
|
1115
|
+
| /*elided*/ any
|
|
1116
|
+
| (
|
|
1117
|
+
| string
|
|
1118
|
+
| number
|
|
1119
|
+
| boolean
|
|
1120
|
+
| /*elided*/ any
|
|
1121
|
+
| (
|
|
1122
|
+
| string
|
|
1123
|
+
| number
|
|
1124
|
+
| boolean
|
|
1125
|
+
| /*elided*/ any
|
|
1126
|
+
| (
|
|
1127
|
+
| string
|
|
1128
|
+
| number
|
|
1129
|
+
| boolean
|
|
1130
|
+
| /*elided*/ any
|
|
1131
|
+
| (
|
|
1132
|
+
| string
|
|
1133
|
+
| number
|
|
1134
|
+
| boolean
|
|
1135
|
+
| /*elided*/ any
|
|
1136
|
+
| (
|
|
1137
|
+
| string
|
|
1138
|
+
| number
|
|
1139
|
+
| boolean
|
|
1140
|
+
| /*elided*/ any
|
|
1141
|
+
| (
|
|
1142
|
+
| string
|
|
1143
|
+
| number
|
|
1144
|
+
| boolean
|
|
1145
|
+
| /*elided*/ any
|
|
1146
|
+
| (
|
|
1147
|
+
| string
|
|
1148
|
+
| number
|
|
1149
|
+
| boolean
|
|
1150
|
+
| /*elided*/ any
|
|
1151
|
+
| /*elided*/ any
|
|
1152
|
+
| null
|
|
1153
|
+
)[]
|
|
1154
|
+
| null
|
|
1155
|
+
)[]
|
|
1156
|
+
| null
|
|
1157
|
+
)[]
|
|
1158
|
+
| null
|
|
1159
|
+
)[]
|
|
1160
|
+
| null
|
|
1161
|
+
)[]
|
|
1162
|
+
| null
|
|
1163
|
+
)[]
|
|
1164
|
+
| null
|
|
1165
|
+
)[]
|
|
1166
|
+
| null
|
|
1167
|
+
)[]
|
|
1168
|
+
| null
|
|
1169
|
+
)[]
|
|
1170
|
+
| null
|
|
1171
|
+
)[]
|
|
1172
|
+
| null;
|
|
1173
|
+
}
|
|
1174
|
+
| (
|
|
1175
|
+
| string
|
|
1176
|
+
| number
|
|
1177
|
+
| boolean
|
|
1178
|
+
| {
|
|
1179
|
+
[x: string]:
|
|
1180
|
+
| string
|
|
1181
|
+
| number
|
|
1182
|
+
| boolean
|
|
1183
|
+
| /*elided*/ any
|
|
1184
|
+
| (
|
|
1185
|
+
| string
|
|
1186
|
+
| number
|
|
1187
|
+
| boolean
|
|
1188
|
+
| /*elided*/ any
|
|
1189
|
+
| (
|
|
1190
|
+
| string
|
|
1191
|
+
| number
|
|
1192
|
+
| boolean
|
|
1193
|
+
| /*elided*/ any
|
|
1194
|
+
| (
|
|
1195
|
+
| string
|
|
1196
|
+
| number
|
|
1197
|
+
| boolean
|
|
1198
|
+
| /*elided*/ any
|
|
1199
|
+
| (
|
|
1200
|
+
| string
|
|
1201
|
+
| number
|
|
1202
|
+
| boolean
|
|
1203
|
+
| /*elided*/ any
|
|
1204
|
+
| (
|
|
1205
|
+
| string
|
|
1206
|
+
| number
|
|
1207
|
+
| boolean
|
|
1208
|
+
| /*elided*/ any
|
|
1209
|
+
| (
|
|
1210
|
+
| string
|
|
1211
|
+
| number
|
|
1212
|
+
| boolean
|
|
1213
|
+
| /*elided*/ any
|
|
1214
|
+
| (
|
|
1215
|
+
| string
|
|
1216
|
+
| number
|
|
1217
|
+
| boolean
|
|
1218
|
+
| /*elided*/ any
|
|
1219
|
+
| (
|
|
1220
|
+
| string
|
|
1221
|
+
| number
|
|
1222
|
+
| boolean
|
|
1223
|
+
| /*elided*/ any
|
|
1224
|
+
| (
|
|
1225
|
+
| string
|
|
1226
|
+
| number
|
|
1227
|
+
| boolean
|
|
1228
|
+
| /*elided*/ any
|
|
1229
|
+
| /*elided*/ any
|
|
1230
|
+
| null
|
|
1231
|
+
)[]
|
|
1232
|
+
| null
|
|
1233
|
+
)[]
|
|
1234
|
+
| null
|
|
1235
|
+
)[]
|
|
1236
|
+
| null
|
|
1237
|
+
)[]
|
|
1238
|
+
| null
|
|
1239
|
+
)[]
|
|
1240
|
+
| null
|
|
1241
|
+
)[]
|
|
1242
|
+
| null
|
|
1243
|
+
)[]
|
|
1244
|
+
| null
|
|
1245
|
+
)[]
|
|
1246
|
+
| null
|
|
1247
|
+
)[]
|
|
1248
|
+
| null;
|
|
1249
|
+
}
|
|
1250
|
+
| (
|
|
1251
|
+
| string
|
|
1252
|
+
| number
|
|
1253
|
+
| boolean
|
|
1254
|
+
| {
|
|
1255
|
+
[x: string]:
|
|
1256
|
+
| string
|
|
1257
|
+
| number
|
|
1258
|
+
| boolean
|
|
1259
|
+
| /*elided*/ any
|
|
1260
|
+
| (
|
|
1261
|
+
| string
|
|
1262
|
+
| number
|
|
1263
|
+
| boolean
|
|
1264
|
+
| /*elided*/ any
|
|
1265
|
+
| (
|
|
1266
|
+
| string
|
|
1267
|
+
| number
|
|
1268
|
+
| boolean
|
|
1269
|
+
| /*elided*/ any
|
|
1270
|
+
| (
|
|
1271
|
+
| string
|
|
1272
|
+
| number
|
|
1273
|
+
| boolean
|
|
1274
|
+
| /*elided*/ any
|
|
1275
|
+
| (
|
|
1276
|
+
| string
|
|
1277
|
+
| number
|
|
1278
|
+
| boolean
|
|
1279
|
+
| /*elided*/ any
|
|
1280
|
+
| (
|
|
1281
|
+
| string
|
|
1282
|
+
| number
|
|
1283
|
+
| boolean
|
|
1284
|
+
| /*elided*/ any
|
|
1285
|
+
| (
|
|
1286
|
+
| string
|
|
1287
|
+
| number
|
|
1288
|
+
| boolean
|
|
1289
|
+
| /*elided*/ any
|
|
1290
|
+
| (
|
|
1291
|
+
| string
|
|
1292
|
+
| number
|
|
1293
|
+
| boolean
|
|
1294
|
+
| /*elided*/ any
|
|
1295
|
+
| (
|
|
1296
|
+
| string
|
|
1297
|
+
| number
|
|
1298
|
+
| boolean
|
|
1299
|
+
| /*elided*/ any
|
|
1300
|
+
| /*elided*/ any
|
|
1301
|
+
| null
|
|
1302
|
+
)[]
|
|
1303
|
+
| null
|
|
1304
|
+
)[]
|
|
1305
|
+
| null
|
|
1306
|
+
)[]
|
|
1307
|
+
| null
|
|
1308
|
+
)[]
|
|
1309
|
+
| null
|
|
1310
|
+
)[]
|
|
1311
|
+
| null
|
|
1312
|
+
)[]
|
|
1313
|
+
| null
|
|
1314
|
+
)[]
|
|
1315
|
+
| null
|
|
1316
|
+
)[]
|
|
1317
|
+
| null;
|
|
1318
|
+
}
|
|
1319
|
+
| (
|
|
1320
|
+
| string
|
|
1321
|
+
| number
|
|
1322
|
+
| boolean
|
|
1323
|
+
| {
|
|
1324
|
+
[x: string]:
|
|
1325
|
+
| string
|
|
1326
|
+
| number
|
|
1327
|
+
| boolean
|
|
1328
|
+
| /*elided*/ any
|
|
1329
|
+
| (
|
|
1330
|
+
| string
|
|
1331
|
+
| number
|
|
1332
|
+
| boolean
|
|
1333
|
+
| /*elided*/ any
|
|
1334
|
+
| (
|
|
1335
|
+
| string
|
|
1336
|
+
| number
|
|
1337
|
+
| boolean
|
|
1338
|
+
| /*elided*/ any
|
|
1339
|
+
| (
|
|
1340
|
+
| string
|
|
1341
|
+
| number
|
|
1342
|
+
| boolean
|
|
1343
|
+
| /*elided*/ any
|
|
1344
|
+
| (
|
|
1345
|
+
| string
|
|
1346
|
+
| number
|
|
1347
|
+
| boolean
|
|
1348
|
+
| /*elided*/ any
|
|
1349
|
+
| (
|
|
1350
|
+
| string
|
|
1351
|
+
| number
|
|
1352
|
+
| boolean
|
|
1353
|
+
| /*elided*/ any
|
|
1354
|
+
| (
|
|
1355
|
+
| string
|
|
1356
|
+
| number
|
|
1357
|
+
| boolean
|
|
1358
|
+
| /*elided*/ any
|
|
1359
|
+
| (
|
|
1360
|
+
| string
|
|
1361
|
+
| number
|
|
1362
|
+
| boolean
|
|
1363
|
+
| /*elided*/ any
|
|
1364
|
+
| /*elided*/ any
|
|
1365
|
+
| null
|
|
1366
|
+
)[]
|
|
1367
|
+
| null
|
|
1368
|
+
)[]
|
|
1369
|
+
| null
|
|
1370
|
+
)[]
|
|
1371
|
+
| null
|
|
1372
|
+
)[]
|
|
1373
|
+
| null
|
|
1374
|
+
)[]
|
|
1375
|
+
| null
|
|
1376
|
+
)[]
|
|
1377
|
+
| null
|
|
1378
|
+
)[]
|
|
1379
|
+
| null;
|
|
1380
|
+
}
|
|
1381
|
+
| (
|
|
1382
|
+
| string
|
|
1383
|
+
| number
|
|
1384
|
+
| boolean
|
|
1385
|
+
| {
|
|
1386
|
+
[x: string]:
|
|
1387
|
+
| string
|
|
1388
|
+
| number
|
|
1389
|
+
| boolean
|
|
1390
|
+
| /*elided*/ any
|
|
1391
|
+
| (
|
|
1392
|
+
| string
|
|
1393
|
+
| number
|
|
1394
|
+
| boolean
|
|
1395
|
+
| /*elided*/ any
|
|
1396
|
+
| (
|
|
1397
|
+
| string
|
|
1398
|
+
| number
|
|
1399
|
+
| boolean
|
|
1400
|
+
| /*elided*/ any
|
|
1401
|
+
| (
|
|
1402
|
+
| string
|
|
1403
|
+
| number
|
|
1404
|
+
| boolean
|
|
1405
|
+
| /*elided*/ any
|
|
1406
|
+
| (
|
|
1407
|
+
| string
|
|
1408
|
+
| number
|
|
1409
|
+
| boolean
|
|
1410
|
+
| /*elided*/ any
|
|
1411
|
+
| (
|
|
1412
|
+
| string
|
|
1413
|
+
| number
|
|
1414
|
+
| boolean
|
|
1415
|
+
| /*elided*/ any
|
|
1416
|
+
| (
|
|
1417
|
+
| string
|
|
1418
|
+
| number
|
|
1419
|
+
| boolean
|
|
1420
|
+
| /*elided*/ any
|
|
1421
|
+
| /*elided*/ any
|
|
1422
|
+
| null
|
|
1423
|
+
)[]
|
|
1424
|
+
| null
|
|
1425
|
+
)[]
|
|
1426
|
+
| null
|
|
1427
|
+
)[]
|
|
1428
|
+
| null
|
|
1429
|
+
)[]
|
|
1430
|
+
| null
|
|
1431
|
+
)[]
|
|
1432
|
+
| null
|
|
1433
|
+
)[]
|
|
1434
|
+
| null;
|
|
1435
|
+
}
|
|
1436
|
+
| (
|
|
1437
|
+
| string
|
|
1438
|
+
| number
|
|
1439
|
+
| boolean
|
|
1440
|
+
| {
|
|
1441
|
+
[x: string]:
|
|
1442
|
+
| string
|
|
1443
|
+
| number
|
|
1444
|
+
| boolean
|
|
1445
|
+
| /*elided*/ any
|
|
1446
|
+
| (
|
|
1447
|
+
| string
|
|
1448
|
+
| number
|
|
1449
|
+
| boolean
|
|
1450
|
+
| /*elided*/ any
|
|
1451
|
+
| (
|
|
1452
|
+
| string
|
|
1453
|
+
| number
|
|
1454
|
+
| boolean
|
|
1455
|
+
| /*elided*/ any
|
|
1456
|
+
| (
|
|
1457
|
+
| string
|
|
1458
|
+
| number
|
|
1459
|
+
| boolean
|
|
1460
|
+
| /*elided*/ any
|
|
1461
|
+
| (
|
|
1462
|
+
| string
|
|
1463
|
+
| number
|
|
1464
|
+
| boolean
|
|
1465
|
+
| /*elided*/ any
|
|
1466
|
+
| (
|
|
1467
|
+
| string
|
|
1468
|
+
| number
|
|
1469
|
+
| boolean
|
|
1470
|
+
| /*elided*/ any
|
|
1471
|
+
| /*elided*/ any
|
|
1472
|
+
| null
|
|
1473
|
+
)[]
|
|
1474
|
+
| null
|
|
1475
|
+
)[]
|
|
1476
|
+
| null
|
|
1477
|
+
)[]
|
|
1478
|
+
| null
|
|
1479
|
+
)[]
|
|
1480
|
+
| null
|
|
1481
|
+
)[]
|
|
1482
|
+
| null;
|
|
1483
|
+
}
|
|
1484
|
+
| (
|
|
1485
|
+
| string
|
|
1486
|
+
| number
|
|
1487
|
+
| boolean
|
|
1488
|
+
| {
|
|
1489
|
+
[x: string]:
|
|
1490
|
+
| string
|
|
1491
|
+
| number
|
|
1492
|
+
| boolean
|
|
1493
|
+
| /*elided*/ any
|
|
1494
|
+
| (
|
|
1495
|
+
| string
|
|
1496
|
+
| number
|
|
1497
|
+
| boolean
|
|
1498
|
+
| /*elided*/ any
|
|
1499
|
+
| (
|
|
1500
|
+
| string
|
|
1501
|
+
| number
|
|
1502
|
+
| boolean
|
|
1503
|
+
| /*elided*/ any
|
|
1504
|
+
| (
|
|
1505
|
+
| string
|
|
1506
|
+
| number
|
|
1507
|
+
| boolean
|
|
1508
|
+
| /*elided*/ any
|
|
1509
|
+
| (
|
|
1510
|
+
| string
|
|
1511
|
+
| number
|
|
1512
|
+
| boolean
|
|
1513
|
+
| /*elided*/ any
|
|
1514
|
+
| /*elided*/ any
|
|
1515
|
+
| null
|
|
1516
|
+
)[]
|
|
1517
|
+
| null
|
|
1518
|
+
)[]
|
|
1519
|
+
| null
|
|
1520
|
+
)[]
|
|
1521
|
+
| null
|
|
1522
|
+
)[]
|
|
1523
|
+
| null;
|
|
1524
|
+
}
|
|
1525
|
+
| (
|
|
1526
|
+
| string
|
|
1527
|
+
| number
|
|
1528
|
+
| boolean
|
|
1529
|
+
| {
|
|
1530
|
+
[x: string]:
|
|
1531
|
+
| string
|
|
1532
|
+
| number
|
|
1533
|
+
| boolean
|
|
1534
|
+
| /*elided*/ any
|
|
1535
|
+
| (
|
|
1536
|
+
| string
|
|
1537
|
+
| number
|
|
1538
|
+
| boolean
|
|
1539
|
+
| /*elided*/ any
|
|
1540
|
+
| (
|
|
1541
|
+
| string
|
|
1542
|
+
| number
|
|
1543
|
+
| boolean
|
|
1544
|
+
| /*elided*/ any
|
|
1545
|
+
| (
|
|
1546
|
+
| string
|
|
1547
|
+
| number
|
|
1548
|
+
| boolean
|
|
1549
|
+
| /*elided*/ any
|
|
1550
|
+
| /*elided*/ any
|
|
1551
|
+
| null
|
|
1552
|
+
)[]
|
|
1553
|
+
| null
|
|
1554
|
+
)[]
|
|
1555
|
+
| null
|
|
1556
|
+
)[]
|
|
1557
|
+
| null;
|
|
1558
|
+
}
|
|
1559
|
+
| (
|
|
1560
|
+
| string
|
|
1561
|
+
| number
|
|
1562
|
+
| boolean
|
|
1563
|
+
| {
|
|
1564
|
+
[x: string]:
|
|
1565
|
+
| string
|
|
1566
|
+
| number
|
|
1567
|
+
| boolean
|
|
1568
|
+
| /*elided*/ any
|
|
1569
|
+
| (
|
|
1570
|
+
| string
|
|
1571
|
+
| number
|
|
1572
|
+
| boolean
|
|
1573
|
+
| /*elided*/ any
|
|
1574
|
+
| (
|
|
1575
|
+
| string
|
|
1576
|
+
| number
|
|
1577
|
+
| boolean
|
|
1578
|
+
| /*elided*/ any
|
|
1579
|
+
| /*elided*/ any
|
|
1580
|
+
| null
|
|
1581
|
+
)[]
|
|
1582
|
+
| null
|
|
1583
|
+
)[]
|
|
1584
|
+
| null;
|
|
1585
|
+
}
|
|
1586
|
+
| (
|
|
1587
|
+
| string
|
|
1588
|
+
| number
|
|
1589
|
+
| boolean
|
|
1590
|
+
| {
|
|
1591
|
+
[x: string]:
|
|
1592
|
+
| string
|
|
1593
|
+
| number
|
|
1594
|
+
| boolean
|
|
1595
|
+
| /*elided*/ any
|
|
1596
|
+
| (
|
|
1597
|
+
| string
|
|
1598
|
+
| number
|
|
1599
|
+
| boolean
|
|
1600
|
+
| /*elided*/ any
|
|
1601
|
+
| /*elided*/ any
|
|
1602
|
+
| null
|
|
1603
|
+
)[]
|
|
1604
|
+
| null;
|
|
1605
|
+
}
|
|
1606
|
+
| (
|
|
1607
|
+
| string
|
|
1608
|
+
| number
|
|
1609
|
+
| boolean
|
|
1610
|
+
| {
|
|
1611
|
+
[x: string]:
|
|
1612
|
+
| string
|
|
1613
|
+
| number
|
|
1614
|
+
| boolean
|
|
1615
|
+
| /*elided*/ any
|
|
1616
|
+
| /*elided*/ any
|
|
1617
|
+
| null;
|
|
1618
|
+
}
|
|
1619
|
+
| /*elided*/ any
|
|
1620
|
+
| null
|
|
1621
|
+
)[]
|
|
1622
|
+
| null
|
|
1623
|
+
)[]
|
|
1624
|
+
| null
|
|
1625
|
+
)[]
|
|
1626
|
+
| null
|
|
1627
|
+
)[]
|
|
1628
|
+
| null
|
|
1629
|
+
)[]
|
|
1630
|
+
| null
|
|
1631
|
+
)[]
|
|
1632
|
+
| null
|
|
1633
|
+
)[]
|
|
1634
|
+
| null
|
|
1635
|
+
)[]
|
|
1636
|
+
| null
|
|
1637
|
+
)[]
|
|
1638
|
+
| null
|
|
1639
|
+
)[]
|
|
1640
|
+
| null
|
|
1641
|
+
)[]
|
|
1642
|
+
| null;
|
|
963
1643
|
}
|
|
964
1644
|
| undefined;
|
|
965
1645
|
required?: string[] | undefined;
|
|
@@ -969,13 +1649,7 @@ declare class MCPClientConnection {
|
|
|
969
1649
|
outputSchema?:
|
|
970
1650
|
| {
|
|
971
1651
|
[x: string]: unknown;
|
|
972
|
-
|
|
973
|
-
properties?:
|
|
974
|
-
| {
|
|
975
|
-
[x: string]: object;
|
|
976
|
-
}
|
|
977
|
-
| undefined;
|
|
978
|
-
required?: string[] | undefined;
|
|
1652
|
+
$schema?: string | undefined;
|
|
979
1653
|
}
|
|
980
1654
|
| undefined;
|
|
981
1655
|
annotations?:
|
|
@@ -1102,11 +1776,17 @@ declare class MCPClientConnection {
|
|
|
1102
1776
|
* @deprecated Overriding or instance-patching this method directly is
|
|
1103
1777
|
* deprecated — pass the `elicitationHandlers` connection option instead.
|
|
1104
1778
|
*/
|
|
1105
|
-
handleElicitationRequest(
|
|
1779
|
+
handleElicitationRequest(
|
|
1780
|
+
request: ElicitRequest,
|
|
1781
|
+
signal?: AbortSignal
|
|
1782
|
+
): Promise<ElicitResult>;
|
|
1106
1783
|
private isResumedStreamableHttpSession;
|
|
1107
1784
|
get sessionId(): string | undefined;
|
|
1108
1785
|
/** @internal Clear a restored session before reconnecting. */
|
|
1109
1786
|
clearResumedSession(): void;
|
|
1787
|
+
get protocolVersion(): string | undefined;
|
|
1788
|
+
get discoverResult(): DiscoverResult | undefined;
|
|
1789
|
+
private openRestoredListSubscription;
|
|
1110
1790
|
private getTransportName;
|
|
1111
1791
|
close(): Promise<void>;
|
|
1112
1792
|
/**
|
|
@@ -1123,7 +1803,7 @@ declare class MCPClientConnection {
|
|
|
1123
1803
|
//#endregion
|
|
1124
1804
|
//#region src/mcp/client-storage.d.ts
|
|
1125
1805
|
/**
|
|
1126
|
-
* Represents a row in the cf_agents_mcp_servers table
|
|
1806
|
+
* Represents a row in the cf_agents_mcp_servers table.
|
|
1127
1807
|
*/
|
|
1128
1808
|
type MCPServerRow = {
|
|
1129
1809
|
id: string;
|
|
@@ -1134,6 +1814,42 @@ type MCPServerRow = {
|
|
|
1134
1814
|
callback_url: string;
|
|
1135
1815
|
server_options: string | null;
|
|
1136
1816
|
};
|
|
1817
|
+
/** Explicitly supported durable subset of MCP SDK client options. */
|
|
1818
|
+
type PersistedMcpClientOptions = Pick<
|
|
1819
|
+
McpClientOptions,
|
|
1820
|
+
| "capabilities"
|
|
1821
|
+
| "supportedProtocolVersions"
|
|
1822
|
+
| "enforceStrictCapabilities"
|
|
1823
|
+
| "debouncedNotificationMethods"
|
|
1824
|
+
| "versionNegotiation"
|
|
1825
|
+
| "inputRequired"
|
|
1826
|
+
| "listMaxPages"
|
|
1827
|
+
| "cachePartition"
|
|
1828
|
+
| "defaultCacheTtlMs"
|
|
1829
|
+
>;
|
|
1830
|
+
type PersistedMcpTransportOptions = {
|
|
1831
|
+
type?: TransportType;
|
|
1832
|
+
headers?: HeadersInit;
|
|
1833
|
+
requestInit?: RequestInit;
|
|
1834
|
+
reconnectionOptions?: StreamableHTTPReconnectionOptions;
|
|
1835
|
+
skipIssuerMetadataValidation?: boolean;
|
|
1836
|
+
onInsufficientScope?: "reauthorize" | "throw";
|
|
1837
|
+
maxStepUpRetries?: number;
|
|
1838
|
+
sessionId?: string;
|
|
1839
|
+
protocolVersion?: string;
|
|
1840
|
+
};
|
|
1841
|
+
type PersistedMcpServerOptions = {
|
|
1842
|
+
client?: PersistedMcpClientOptions;
|
|
1843
|
+
transport?: PersistedMcpTransportOptions;
|
|
1844
|
+
discoverResult?: DiscoverResult;
|
|
1845
|
+
retry?: RetryOptions /** Durable Object binding used to restore an RPC MCP connection. */;
|
|
1846
|
+
bindingName?: string /** Application props passed back to a restored RPC MCP connection. */;
|
|
1847
|
+
props?: Record<
|
|
1848
|
+
string,
|
|
1849
|
+
unknown
|
|
1850
|
+
> /** One-wake capability seed; handler functions remain memory-only. */;
|
|
1851
|
+
capabilities?: ClientCapabilities;
|
|
1852
|
+
};
|
|
1137
1853
|
//#endregion
|
|
1138
1854
|
//#region src/mcp/client.d.ts
|
|
1139
1855
|
type MCPAITool = {
|
|
@@ -1177,25 +1893,7 @@ declare const MCP_SERVER_ID_MAX_LENGTH = 64;
|
|
|
1177
1893
|
* normalizeServerId("42-things"); // "id-42-things"
|
|
1178
1894
|
*/
|
|
1179
1895
|
declare function normalizeServerId(input: string): string;
|
|
1180
|
-
|
|
1181
|
-
* Options that can be stored in the server_options column
|
|
1182
|
-
* This is what gets JSON.stringify'd and stored in the database
|
|
1183
|
-
*/
|
|
1184
|
-
type MCPServerOptions = {
|
|
1185
|
-
client?: ConstructorParameters<typeof Client>[1];
|
|
1186
|
-
transport?: {
|
|
1187
|
-
headers?: HeadersInit;
|
|
1188
|
-
type?: TransportType;
|
|
1189
|
-
sessionId?: string;
|
|
1190
|
-
} /** Retry options for connection and reconnection attempts */;
|
|
1191
|
-
retry?: RetryOptions;
|
|
1192
|
-
/**
|
|
1193
|
-
* Client capabilities advertised from configured handlers (currently the
|
|
1194
|
-
* elicitation modes). Handlers are functions and cannot be persisted, so
|
|
1195
|
-
* this records what they advertised for restores after hibernation.
|
|
1196
|
-
*/
|
|
1197
|
-
capabilities?: ClientCapabilities;
|
|
1198
|
-
};
|
|
1896
|
+
type MCPServerOptions = PersistedMcpServerOptions;
|
|
1199
1897
|
/**
|
|
1200
1898
|
* Result of an OAuth callback request
|
|
1201
1899
|
*/
|
|
@@ -1217,7 +1915,7 @@ type RegisterServerOptions = {
|
|
|
1217
1915
|
url: string;
|
|
1218
1916
|
name: string;
|
|
1219
1917
|
callbackUrl?: string;
|
|
1220
|
-
client?:
|
|
1918
|
+
client?: McpClientOptions;
|
|
1221
1919
|
transport?: MCPTransportOptions;
|
|
1222
1920
|
authUrl?: string;
|
|
1223
1921
|
clientId?: string /** Retry options for connection and reconnection attempts */;
|
|
@@ -1269,7 +1967,9 @@ type MCPClientOAuthResult =
|
|
|
1269
1967
|
};
|
|
1270
1968
|
type MCPClientElicitationHandler = (
|
|
1271
1969
|
request: ElicitRequest,
|
|
1272
|
-
serverId: string
|
|
1970
|
+
serverId: string /** Aborts when the originating MCP operation is cancelled. */,
|
|
1971
|
+
|
|
1972
|
+
signal?: AbortSignal
|
|
1273
1973
|
) => Promise<ElicitResult>;
|
|
1274
1974
|
type MCPClientElicitationHandlers = {
|
|
1275
1975
|
form?: MCPClientElicitationHandler;
|
|
@@ -1382,7 +2082,7 @@ declare class MCPClientManager {
|
|
|
1382
2082
|
*/
|
|
1383
2083
|
private getServerRetryOptions;
|
|
1384
2084
|
private clearServerAuthUrl;
|
|
1385
|
-
private
|
|
2085
|
+
private updateStoredSession;
|
|
1386
2086
|
private failConnection;
|
|
1387
2087
|
private isAuthAcceptedConnection;
|
|
1388
2088
|
private oauthCallbackSuccess;
|
|
@@ -1464,7 +2164,7 @@ declare class MCPClientManager {
|
|
|
1464
2164
|
oauthCode?: string;
|
|
1465
2165
|
};
|
|
1466
2166
|
transport?: MCPTransportOptions;
|
|
1467
|
-
client?:
|
|
2167
|
+
client?: McpClientOptions;
|
|
1468
2168
|
}
|
|
1469
2169
|
): Promise<{
|
|
1470
2170
|
id: string;
|
|
@@ -1486,6 +2186,8 @@ declare class MCPClientManager {
|
|
|
1486
2186
|
* @returns Server ID
|
|
1487
2187
|
*/
|
|
1488
2188
|
registerServer(id: string, options: RegisterServerOptions): Promise<string>;
|
|
2189
|
+
/** Persist and emit an OAuth continuation produced by connect or discovery. */
|
|
2190
|
+
private persistAuthContinuation;
|
|
1489
2191
|
/**
|
|
1490
2192
|
* Connect to an already registered MCP server and initialize the connection.
|
|
1491
2193
|
*
|
|
@@ -1645,136 +2347,19 @@ declare class MCPClientManager {
|
|
|
1645
2347
|
params: CallToolRequest["params"] & {
|
|
1646
2348
|
serverId: string;
|
|
1647
2349
|
},
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
audience?: ("user" | "assistant")[] | undefined;
|
|
1662
|
-
priority?: number | undefined;
|
|
1663
|
-
lastModified?: string | undefined;
|
|
1664
|
-
}
|
|
1665
|
-
| undefined;
|
|
1666
|
-
_meta?: Record<string, unknown> | undefined;
|
|
1667
|
-
}
|
|
1668
|
-
| {
|
|
1669
|
-
type: "image";
|
|
1670
|
-
data: string;
|
|
1671
|
-
mimeType: string;
|
|
1672
|
-
annotations?:
|
|
1673
|
-
| {
|
|
1674
|
-
audience?: ("user" | "assistant")[] | undefined;
|
|
1675
|
-
priority?: number | undefined;
|
|
1676
|
-
lastModified?: string | undefined;
|
|
1677
|
-
}
|
|
1678
|
-
| undefined;
|
|
1679
|
-
_meta?: Record<string, unknown> | undefined;
|
|
1680
|
-
}
|
|
1681
|
-
| {
|
|
1682
|
-
type: "audio";
|
|
1683
|
-
data: string;
|
|
1684
|
-
mimeType: string;
|
|
1685
|
-
annotations?:
|
|
1686
|
-
| {
|
|
1687
|
-
audience?: ("user" | "assistant")[] | undefined;
|
|
1688
|
-
priority?: number | undefined;
|
|
1689
|
-
lastModified?: string | undefined;
|
|
1690
|
-
}
|
|
1691
|
-
| undefined;
|
|
1692
|
-
_meta?: Record<string, unknown> | undefined;
|
|
1693
|
-
}
|
|
1694
|
-
| {
|
|
1695
|
-
type: "resource";
|
|
1696
|
-
resource:
|
|
1697
|
-
| {
|
|
1698
|
-
uri: string;
|
|
1699
|
-
text: string;
|
|
1700
|
-
mimeType?: string | undefined;
|
|
1701
|
-
_meta?: Record<string, unknown> | undefined;
|
|
1702
|
-
}
|
|
1703
|
-
| {
|
|
1704
|
-
uri: string;
|
|
1705
|
-
blob: string;
|
|
1706
|
-
mimeType?: string | undefined;
|
|
1707
|
-
_meta?: Record<string, unknown> | undefined;
|
|
1708
|
-
};
|
|
1709
|
-
annotations?:
|
|
1710
|
-
| {
|
|
1711
|
-
audience?: ("user" | "assistant")[] | undefined;
|
|
1712
|
-
priority?: number | undefined;
|
|
1713
|
-
lastModified?: string | undefined;
|
|
1714
|
-
}
|
|
1715
|
-
| undefined;
|
|
1716
|
-
_meta?: Record<string, unknown> | undefined;
|
|
1717
|
-
}
|
|
1718
|
-
| {
|
|
1719
|
-
uri: string;
|
|
1720
|
-
name: string;
|
|
1721
|
-
type: "resource_link";
|
|
1722
|
-
description?: string | undefined;
|
|
1723
|
-
mimeType?: string | undefined;
|
|
1724
|
-
size?: number | undefined;
|
|
1725
|
-
annotations?:
|
|
1726
|
-
| {
|
|
1727
|
-
audience?: ("user" | "assistant")[] | undefined;
|
|
1728
|
-
priority?: number | undefined;
|
|
1729
|
-
lastModified?: string | undefined;
|
|
1730
|
-
}
|
|
1731
|
-
| undefined;
|
|
1732
|
-
_meta?:
|
|
1733
|
-
| {
|
|
1734
|
-
[x: string]: unknown;
|
|
1735
|
-
}
|
|
1736
|
-
| undefined;
|
|
1737
|
-
icons?:
|
|
1738
|
-
| {
|
|
1739
|
-
src: string;
|
|
1740
|
-
mimeType?: string | undefined;
|
|
1741
|
-
sizes?: string[] | undefined;
|
|
1742
|
-
theme?: "light" | "dark" | undefined;
|
|
1743
|
-
}[]
|
|
1744
|
-
| undefined;
|
|
1745
|
-
title?: string | undefined;
|
|
1746
|
-
}
|
|
1747
|
-
)[];
|
|
1748
|
-
_meta?:
|
|
1749
|
-
| {
|
|
1750
|
-
[x: string]: unknown;
|
|
1751
|
-
progressToken?: string | number | undefined;
|
|
1752
|
-
"io.modelcontextprotocol/related-task"?:
|
|
1753
|
-
| {
|
|
1754
|
-
taskId: string;
|
|
1755
|
-
}
|
|
1756
|
-
| undefined;
|
|
1757
|
-
}
|
|
1758
|
-
| undefined;
|
|
1759
|
-
structuredContent?: Record<string, unknown> | undefined;
|
|
1760
|
-
isError?: boolean | undefined;
|
|
1761
|
-
}
|
|
1762
|
-
| {
|
|
1763
|
-
[x: string]: unknown;
|
|
1764
|
-
toolResult: unknown;
|
|
1765
|
-
_meta?:
|
|
1766
|
-
| {
|
|
1767
|
-
[x: string]: unknown;
|
|
1768
|
-
progressToken?: string | number | undefined;
|
|
1769
|
-
"io.modelcontextprotocol/related-task"?:
|
|
1770
|
-
| {
|
|
1771
|
-
taskId: string;
|
|
1772
|
-
}
|
|
1773
|
-
| undefined;
|
|
1774
|
-
}
|
|
1775
|
-
| undefined;
|
|
1776
|
-
}
|
|
1777
|
-
>;
|
|
2350
|
+
options?: CallToolRequestOptions
|
|
2351
|
+
): ReturnType<Client["callTool"]>;
|
|
2352
|
+
/**
|
|
2353
|
+
* @deprecated Prefer the v2 request-options overload. Explicit legacy result
|
|
2354
|
+
* schemas remain honored through the v2 SDK request funnel.
|
|
2355
|
+
*/
|
|
2356
|
+
callTool(
|
|
2357
|
+
params: CallToolRequest["params"] & {
|
|
2358
|
+
serverId: string;
|
|
2359
|
+
},
|
|
2360
|
+
resultSchema: LegacyCallToolResultSchema,
|
|
2361
|
+
options?: CallToolRequestOptions
|
|
2362
|
+
): ReturnType<Client["callTool"]>;
|
|
1778
2363
|
/**
|
|
1779
2364
|
* Namespaced version of readResource
|
|
1780
2365
|
*/
|
|
@@ -1782,7 +2367,7 @@ declare class MCPClientManager {
|
|
|
1782
2367
|
params: ReadResourceRequest["params"] & {
|
|
1783
2368
|
serverId: string;
|
|
1784
2369
|
},
|
|
1785
|
-
options
|
|
2370
|
+
options?: CacheableRequestOptions
|
|
1786
2371
|
): Promise<{
|
|
1787
2372
|
[x: string]: unknown;
|
|
1788
2373
|
contents: (
|
|
@@ -1790,22 +2375,41 @@ declare class MCPClientManager {
|
|
|
1790
2375
|
uri: string;
|
|
1791
2376
|
text: string;
|
|
1792
2377
|
mimeType?: string | undefined;
|
|
1793
|
-
_meta?:
|
|
2378
|
+
_meta?:
|
|
2379
|
+
| {
|
|
2380
|
+
[x: string]: unknown;
|
|
2381
|
+
}
|
|
2382
|
+
| undefined;
|
|
1794
2383
|
}
|
|
1795
2384
|
| {
|
|
1796
2385
|
uri: string;
|
|
1797
2386
|
blob: string;
|
|
1798
2387
|
mimeType?: string | undefined;
|
|
1799
|
-
_meta?:
|
|
2388
|
+
_meta?:
|
|
2389
|
+
| {
|
|
2390
|
+
[x: string]: unknown;
|
|
2391
|
+
}
|
|
2392
|
+
| undefined;
|
|
1800
2393
|
}
|
|
1801
2394
|
)[];
|
|
1802
2395
|
_meta?:
|
|
1803
2396
|
| {
|
|
1804
2397
|
[x: string]: unknown;
|
|
1805
|
-
|
|
1806
|
-
"io.modelcontextprotocol/related-task"?:
|
|
2398
|
+
"io.modelcontextprotocol/serverInfo"?:
|
|
1807
2399
|
| {
|
|
1808
|
-
|
|
2400
|
+
version: string;
|
|
2401
|
+
name: string;
|
|
2402
|
+
websiteUrl?: string | undefined;
|
|
2403
|
+
description?: string | undefined;
|
|
2404
|
+
icons?:
|
|
2405
|
+
| {
|
|
2406
|
+
src: string;
|
|
2407
|
+
mimeType?: string | undefined;
|
|
2408
|
+
sizes?: string[] | undefined;
|
|
2409
|
+
theme?: "light" | "dark" | undefined;
|
|
2410
|
+
}[]
|
|
2411
|
+
| undefined;
|
|
2412
|
+
title?: string | undefined;
|
|
1809
2413
|
}
|
|
1810
2414
|
| undefined;
|
|
1811
2415
|
}
|
|
@@ -1818,7 +2422,7 @@ declare class MCPClientManager {
|
|
|
1818
2422
|
params: GetPromptRequest["params"] & {
|
|
1819
2423
|
serverId: string;
|
|
1820
2424
|
},
|
|
1821
|
-
options
|
|
2425
|
+
options?: RequestOptions
|
|
1822
2426
|
): Promise<{
|
|
1823
2427
|
[x: string]: unknown;
|
|
1824
2428
|
messages: {
|
|
@@ -1834,7 +2438,11 @@ declare class MCPClientManager {
|
|
|
1834
2438
|
lastModified?: string | undefined;
|
|
1835
2439
|
}
|
|
1836
2440
|
| undefined;
|
|
1837
|
-
_meta?:
|
|
2441
|
+
_meta?:
|
|
2442
|
+
| {
|
|
2443
|
+
[x: string]: unknown;
|
|
2444
|
+
}
|
|
2445
|
+
| undefined;
|
|
1838
2446
|
}
|
|
1839
2447
|
| {
|
|
1840
2448
|
type: "image";
|
|
@@ -1847,7 +2455,11 @@ declare class MCPClientManager {
|
|
|
1847
2455
|
lastModified?: string | undefined;
|
|
1848
2456
|
}
|
|
1849
2457
|
| undefined;
|
|
1850
|
-
_meta?:
|
|
2458
|
+
_meta?:
|
|
2459
|
+
| {
|
|
2460
|
+
[x: string]: unknown;
|
|
2461
|
+
}
|
|
2462
|
+
| undefined;
|
|
1851
2463
|
}
|
|
1852
2464
|
| {
|
|
1853
2465
|
type: "audio";
|
|
@@ -1860,31 +2472,11 @@ declare class MCPClientManager {
|
|
|
1860
2472
|
lastModified?: string | undefined;
|
|
1861
2473
|
}
|
|
1862
2474
|
| undefined;
|
|
1863
|
-
_meta?:
|
|
1864
|
-
}
|
|
1865
|
-
| {
|
|
1866
|
-
type: "resource";
|
|
1867
|
-
resource:
|
|
1868
|
-
| {
|
|
1869
|
-
uri: string;
|
|
1870
|
-
text: string;
|
|
1871
|
-
mimeType?: string | undefined;
|
|
1872
|
-
_meta?: Record<string, unknown> | undefined;
|
|
1873
|
-
}
|
|
1874
|
-
| {
|
|
1875
|
-
uri: string;
|
|
1876
|
-
blob: string;
|
|
1877
|
-
mimeType?: string | undefined;
|
|
1878
|
-
_meta?: Record<string, unknown> | undefined;
|
|
1879
|
-
};
|
|
1880
|
-
annotations?:
|
|
2475
|
+
_meta?:
|
|
1881
2476
|
| {
|
|
1882
|
-
|
|
1883
|
-
priority?: number | undefined;
|
|
1884
|
-
lastModified?: string | undefined;
|
|
2477
|
+
[x: string]: unknown;
|
|
1885
2478
|
}
|
|
1886
2479
|
| undefined;
|
|
1887
|
-
_meta?: Record<string, unknown> | undefined;
|
|
1888
2480
|
}
|
|
1889
2481
|
| {
|
|
1890
2482
|
uri: string;
|
|
@@ -1914,15 +2506,62 @@ declare class MCPClientManager {
|
|
|
1914
2506
|
}[]
|
|
1915
2507
|
| undefined;
|
|
1916
2508
|
title?: string | undefined;
|
|
2509
|
+
}
|
|
2510
|
+
| {
|
|
2511
|
+
type: "resource";
|
|
2512
|
+
resource:
|
|
2513
|
+
| {
|
|
2514
|
+
uri: string;
|
|
2515
|
+
text: string;
|
|
2516
|
+
mimeType?: string | undefined;
|
|
2517
|
+
_meta?:
|
|
2518
|
+
| {
|
|
2519
|
+
[x: string]: unknown;
|
|
2520
|
+
}
|
|
2521
|
+
| undefined;
|
|
2522
|
+
}
|
|
2523
|
+
| {
|
|
2524
|
+
uri: string;
|
|
2525
|
+
blob: string;
|
|
2526
|
+
mimeType?: string | undefined;
|
|
2527
|
+
_meta?:
|
|
2528
|
+
| {
|
|
2529
|
+
[x: string]: unknown;
|
|
2530
|
+
}
|
|
2531
|
+
| undefined;
|
|
2532
|
+
};
|
|
2533
|
+
annotations?:
|
|
2534
|
+
| {
|
|
2535
|
+
audience?: ("user" | "assistant")[] | undefined;
|
|
2536
|
+
priority?: number | undefined;
|
|
2537
|
+
lastModified?: string | undefined;
|
|
2538
|
+
}
|
|
2539
|
+
| undefined;
|
|
2540
|
+
_meta?:
|
|
2541
|
+
| {
|
|
2542
|
+
[x: string]: unknown;
|
|
2543
|
+
}
|
|
2544
|
+
| undefined;
|
|
1917
2545
|
};
|
|
1918
2546
|
}[];
|
|
1919
2547
|
_meta?:
|
|
1920
2548
|
| {
|
|
1921
2549
|
[x: string]: unknown;
|
|
1922
|
-
|
|
1923
|
-
"io.modelcontextprotocol/related-task"?:
|
|
2550
|
+
"io.modelcontextprotocol/serverInfo"?:
|
|
1924
2551
|
| {
|
|
1925
|
-
|
|
2552
|
+
version: string;
|
|
2553
|
+
name: string;
|
|
2554
|
+
websiteUrl?: string | undefined;
|
|
2555
|
+
description?: string | undefined;
|
|
2556
|
+
icons?:
|
|
2557
|
+
| {
|
|
2558
|
+
src: string;
|
|
2559
|
+
mimeType?: string | undefined;
|
|
2560
|
+
sizes?: string[] | undefined;
|
|
2561
|
+
theme?: "light" | "dark" | undefined;
|
|
2562
|
+
}[]
|
|
2563
|
+
| undefined;
|
|
2564
|
+
title?: string | undefined;
|
|
1926
2565
|
}
|
|
1927
2566
|
| undefined;
|
|
1928
2567
|
}
|
|
@@ -1940,7 +2579,7 @@ type NamespacedData = {
|
|
|
1940
2579
|
resources: (Resource & {
|
|
1941
2580
|
serverId: string;
|
|
1942
2581
|
})[];
|
|
1943
|
-
resourceTemplates: (
|
|
2582
|
+
resourceTemplates: (ResourceTemplateType & {
|
|
1944
2583
|
serverId: string;
|
|
1945
2584
|
})[];
|
|
1946
2585
|
};
|
|
@@ -2394,10 +3033,16 @@ type AddMcpServerOptions = {
|
|
|
2394
3033
|
*/
|
|
2395
3034
|
callbackPath?: string /** Agents routing prefix (default: "agents") */;
|
|
2396
3035
|
agentsPrefix?: string /** MCP client options */;
|
|
2397
|
-
client?:
|
|
3036
|
+
client?: McpClientOptions /** Transport options */;
|
|
2398
3037
|
transport?: {
|
|
2399
3038
|
/** Custom headers for authentication (e.g., bearer tokens, CF Access) */ headers?: HeadersInit /** Transport type: "sse", "streamable-http", or "auto" (default) */;
|
|
2400
3039
|
type?: TransportType;
|
|
3040
|
+
/**
|
|
3041
|
+
* Compatibility escape hatch for a trusted legacy authorization server
|
|
3042
|
+
* whose RFC 8414 issuer does not match its metadata discovery URL.
|
|
3043
|
+
* Security-weakening; leave false unless the server is explicitly known.
|
|
3044
|
+
*/
|
|
3045
|
+
skipIssuerMetadataValidation?: boolean;
|
|
2401
3046
|
} /** Retry options for connection and reconnection attempts */;
|
|
2402
3047
|
retry?: RetryOptions;
|
|
2403
3048
|
};
|
|
@@ -4769,13 +5414,7 @@ declare class Agent<
|
|
|
4769
5414
|
url: string,
|
|
4770
5415
|
callbackHostOrOptions?: string | AddMcpServerOptions,
|
|
4771
5416
|
agentsPrefix?: string,
|
|
4772
|
-
options?:
|
|
4773
|
-
client?: ConstructorParameters<typeof Client>[1];
|
|
4774
|
-
transport?: {
|
|
4775
|
-
headers?: HeadersInit;
|
|
4776
|
-
type?: TransportType;
|
|
4777
|
-
};
|
|
4778
|
-
}
|
|
5417
|
+
options?: Pick<AddMcpServerOptions, "client" | "transport">
|
|
4779
5418
|
): Promise<
|
|
4780
5419
|
| {
|
|
4781
5420
|
id: string;
|
|
@@ -5401,72 +6040,73 @@ type AgentToolEventState<Part extends AgentToolRunPart = AgentToolRunPart> = {
|
|
|
5401
6040
|
//#endregion
|
|
5402
6041
|
export {
|
|
5403
6042
|
RoutingRetryOptions as $,
|
|
5404
|
-
|
|
6043
|
+
LegacyMcpHandler as $t,
|
|
5405
6044
|
AgentGetOptions as A,
|
|
5406
|
-
|
|
6045
|
+
MCPServerFilter as At,
|
|
5407
6046
|
EmailSendBinding as B,
|
|
5408
|
-
|
|
6047
|
+
RPCServerTransport as Bt,
|
|
5409
6048
|
DetachedRunAgentToolResult as C,
|
|
5410
|
-
|
|
6049
|
+
MCPClientManager as Ct,
|
|
5411
6050
|
AddRpcMcpServerOptions as D,
|
|
5412
|
-
|
|
6051
|
+
MCPConnectionResult as Dt,
|
|
5413
6052
|
AddMcpServerOptions as E,
|
|
5414
|
-
|
|
6053
|
+
MCPClientOAuthResult as Et,
|
|
5415
6054
|
Connection$1 as F,
|
|
5416
|
-
|
|
6055
|
+
normalizeServerId as Ft,
|
|
5417
6056
|
FiberStatus as G,
|
|
5418
|
-
|
|
6057
|
+
ElicitResult$3 as Gt,
|
|
5419
6058
|
FiberInspection as H,
|
|
5420
|
-
|
|
6059
|
+
RPC_DO_PREFIX as Ht,
|
|
5421
6060
|
ConnectionContext$1 as I,
|
|
5422
|
-
|
|
6061
|
+
MCPElicitationHandler as It,
|
|
5423
6062
|
MCPServerMessage as J,
|
|
5424
|
-
|
|
6063
|
+
DurableObjectEventStore as Jt,
|
|
5425
6064
|
ListFibersOptions as K,
|
|
5426
|
-
|
|
6065
|
+
McpAgent as Kt,
|
|
5427
6066
|
DEFAULT_AGENT_STATIC_OPTIONS as L,
|
|
5428
|
-
|
|
6067
|
+
MCPElicitationHandlers as Lt,
|
|
5429
6068
|
AgentOptions as M,
|
|
5430
|
-
|
|
6069
|
+
MCP_SERVER_ID_MAX_LENGTH as Mt,
|
|
5431
6070
|
AgentStaticOptions as N,
|
|
5432
|
-
|
|
6071
|
+
RegisterServerOptions as Nt,
|
|
5433
6072
|
Agent as O,
|
|
5434
|
-
|
|
6073
|
+
MCPDiscoverResult as Ot,
|
|
5435
6074
|
CallableMetadata as P,
|
|
5436
|
-
|
|
6075
|
+
getNamespacedData as Pt,
|
|
5437
6076
|
RPCResponse as Q,
|
|
5438
|
-
|
|
6077
|
+
CreateMcpHandlerOptions$1 as Qt,
|
|
5439
6078
|
DeleteFibersOptions as R,
|
|
5440
|
-
|
|
6079
|
+
RPCClientTransport as Rt,
|
|
5441
6080
|
DetachedAgentToolConfig as S,
|
|
5442
|
-
|
|
6081
|
+
MCPClientElicitationHandlers as St,
|
|
5443
6082
|
RunAgentToolResult as T,
|
|
5444
|
-
|
|
6083
|
+
MCPClientOAuthCallbackConfig as Tt,
|
|
5445
6084
|
FiberRecoveryContext as U,
|
|
5446
|
-
|
|
6085
|
+
ElicitRequest$2 as Ut,
|
|
5447
6086
|
FiberContext as V,
|
|
5448
|
-
|
|
6087
|
+
RPCServerTransportOptions as Vt,
|
|
5449
6088
|
FiberRecoveryResult as W,
|
|
5450
|
-
|
|
6089
|
+
ElicitRequestSchema as Wt,
|
|
5451
6090
|
QueueItem as X,
|
|
5452
|
-
|
|
6091
|
+
experimental_createMcpHandler as Xt,
|
|
5453
6092
|
MCPServersState as Y,
|
|
5454
|
-
|
|
6093
|
+
createMcpHandler$1 as Yt,
|
|
5455
6094
|
RPCRequest as Z,
|
|
5456
|
-
|
|
6095
|
+
CreateLegacyMcpHandlerOptions as Zt,
|
|
5457
6096
|
AgentToolRunState as _,
|
|
5458
|
-
|
|
6097
|
+
ElicitRequest$1 as _t,
|
|
5459
6098
|
AgentToolEvent as a,
|
|
5460
|
-
|
|
6099
|
+
SSEEdgeClientTransport as an,
|
|
5461
6100
|
StartFiberResult as at,
|
|
5462
6101
|
AgentToolTerminalStatus as b,
|
|
5463
|
-
|
|
6102
|
+
MCPAIToolSet as bt,
|
|
5464
6103
|
AgentToolFailure as c,
|
|
5465
|
-
|
|
6104
|
+
SubAgentPathMatch as cn,
|
|
5466
6105
|
SubAgentClass as ct,
|
|
5467
6106
|
AgentToolMilestone as d,
|
|
6107
|
+
routeSubAgentRequest as dn,
|
|
5468
6108
|
callable as dt,
|
|
5469
|
-
|
|
6109
|
+
createLegacyMcpHandler as en,
|
|
5470
6110
|
Schedule as et,
|
|
5471
6111
|
AgentToolProgress as f,
|
|
5472
6112
|
getAgentByName as ft,
|
|
@@ -5475,47 +6115,48 @@ export {
|
|
|
5475
6115
|
AgentToolRunInspection as h,
|
|
5476
6116
|
routeAgentRequest as ht,
|
|
5477
6117
|
AgentToolDisplayMetadata as i,
|
|
5478
|
-
|
|
6118
|
+
WorkerTransportOptions as in,
|
|
5479
6119
|
StartFiberOptions as it,
|
|
5480
6120
|
AgentNamespace as j,
|
|
5481
|
-
|
|
6121
|
+
MCPServerOptions as jt,
|
|
5482
6122
|
AgentContext as k,
|
|
5483
|
-
|
|
6123
|
+
MCPOAuthCallbackResult as kt,
|
|
5484
6124
|
AgentToolInterruptedReason as l,
|
|
5485
|
-
|
|
6125
|
+
getSubAgentByName as ln,
|
|
5486
6126
|
SubAgentStub as lt,
|
|
5487
6127
|
AgentToolRunInfo as m,
|
|
5488
6128
|
routeAgentEmail as mt,
|
|
5489
6129
|
AGENT_TOOL_PROGRESS_PART as n,
|
|
5490
|
-
|
|
6130
|
+
TransportState as nn,
|
|
5491
6131
|
SendEmailOptions as nt,
|
|
5492
6132
|
AgentToolEventMessage as o,
|
|
5493
|
-
|
|
6133
|
+
StreamableHTTPEdgeClientTransport as on,
|
|
5494
6134
|
StateUpdateMessage as ot,
|
|
5495
6135
|
AgentToolProgressSnapshot as p,
|
|
5496
6136
|
getCurrentAgent as pt,
|
|
5497
6137
|
MCPServer as q,
|
|
5498
|
-
|
|
6138
|
+
ClearableEventStore as qt,
|
|
5499
6139
|
AgentToolChildAdapter as r,
|
|
5500
|
-
|
|
6140
|
+
WorkerTransport as rn,
|
|
5501
6141
|
SqlError as rt,
|
|
5502
6142
|
AgentToolEventState as s,
|
|
5503
|
-
|
|
6143
|
+
SUB_PREFIX as sn,
|
|
5504
6144
|
StreamingResponse as st,
|
|
5505
6145
|
AGENT_TOOL_MILESTONE_PART as t,
|
|
5506
|
-
|
|
6146
|
+
MCPStorageApi as tn,
|
|
5507
6147
|
ScheduleCriteria as tt,
|
|
5508
6148
|
AgentToolLifecycleResult as u,
|
|
6149
|
+
parseSubAgentPath as un,
|
|
5509
6150
|
WSMessage$1 as ut,
|
|
5510
6151
|
AgentToolRunStatus as v,
|
|
5511
|
-
|
|
6152
|
+
ElicitResult$2 as vt,
|
|
5512
6153
|
RunAgentToolOptions as w,
|
|
5513
|
-
|
|
6154
|
+
MCPClientManagerOptions as wt,
|
|
5514
6155
|
ChatCapableAgentClass as x,
|
|
5515
|
-
|
|
6156
|
+
MCPClientElicitationHandler as xt,
|
|
5516
6157
|
AgentToolStoredChunk as y,
|
|
5517
|
-
|
|
6158
|
+
MCPAITool as yt,
|
|
5518
6159
|
EmailRoutingOptions as z,
|
|
5519
|
-
|
|
6160
|
+
RPCClientTransportOptions as zt
|
|
5520
6161
|
};
|
|
5521
|
-
//# sourceMappingURL=agent-tool-types-
|
|
6162
|
+
//# sourceMappingURL=agent-tool-types-Btk9ETS-.d.ts.map
|