agents 0.0.0-2a6e66e → 0.0.0-2bea91f
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 +129 -7
- package/dist/_esm-LV5FJ3HK.js +3922 -0
- package/dist/_esm-LV5FJ3HK.js.map +1 -0
- package/dist/ai-chat-agent.d.ts +8 -6
- package/dist/ai-chat-agent.js +442 -48
- package/dist/ai-chat-agent.js.map +1 -1
- package/dist/ai-chat-v5-migration.d.ts +152 -0
- package/dist/ai-chat-v5-migration.js +20 -0
- package/dist/ai-chat-v5-migration.js.map +1 -0
- package/dist/ai-react.d.ts +64 -69
- package/dist/ai-react.js +252 -99
- package/dist/ai-react.js.map +1 -1
- package/dist/ai-types.d.ts +37 -19
- package/dist/ai-types.js +7 -0
- package/dist/ccip-CMBYN64O.js +15 -0
- package/dist/ccip-CMBYN64O.js.map +1 -0
- package/dist/{chunk-CV3L6FQZ.js → chunk-254F4GDT.js} +159 -106
- package/dist/chunk-254F4GDT.js.map +1 -0
- package/dist/{chunk-HY7ZLHJB.js → chunk-3OT2NNEW.js} +412 -69
- package/dist/chunk-3OT2NNEW.js.map +1 -0
- package/dist/chunk-5Y6BEZDY.js +276 -0
- package/dist/chunk-5Y6BEZDY.js.map +1 -0
- package/dist/chunk-BER7KXUJ.js +18 -0
- package/dist/chunk-BER7KXUJ.js.map +1 -0
- package/dist/chunk-JJBFIGUC.js +5202 -0
- package/dist/chunk-JJBFIGUC.js.map +1 -0
- package/dist/chunk-PR4QN5HX.js +43 -0
- package/dist/chunk-PR4QN5HX.js.map +1 -0
- package/dist/{chunk-KUH345EY.js → chunk-QEVM4BVL.js} +5 -5
- package/dist/chunk-QEVM4BVL.js.map +1 -0
- package/dist/chunk-TYAY6AU6.js +159 -0
- package/dist/chunk-TYAY6AU6.js.map +1 -0
- package/dist/chunk-UJVEAURM.js +150 -0
- package/dist/chunk-UJVEAURM.js.map +1 -0
- package/dist/{chunk-PVQZBKN7.js → chunk-Z44WASMA.js} +11 -3
- package/dist/chunk-Z44WASMA.js.map +1 -0
- package/dist/{client-DgyzBU_8.d.ts → client-DVoPb3-C.d.ts} +555 -36
- package/dist/client.js +3 -1
- package/dist/codemode/ai.d.ts +25 -0
- package/dist/codemode/ai.js +5112 -0
- package/dist/codemode/ai.js.map +1 -0
- package/dist/index.d.ts +48 -38
- package/dist/index.js +8 -4
- package/dist/mcp/client.d.ts +2 -1
- package/dist/mcp/client.js +2 -1
- package/dist/mcp/do-oauth-client-provider.d.ts +1 -0
- package/dist/mcp/do-oauth-client-provider.js +2 -1
- package/dist/mcp/index.d.ts +50 -83
- package/dist/mcp/index.js +904 -760
- package/dist/mcp/index.js.map +1 -1
- package/dist/mcp/x402.d.ts +39 -0
- package/dist/mcp/x402.js +3195 -0
- package/dist/mcp/x402.js.map +1 -0
- package/dist/mcp-BH1fJeiU.d.ts +58 -0
- package/dist/observability/index.d.ts +12 -24
- package/dist/observability/index.js +6 -4
- package/dist/react.d.ts +11 -6
- package/dist/react.js +107 -7
- package/dist/react.js.map +1 -1
- package/dist/schedule.d.ts +76 -2
- package/dist/schedule.js +17 -2
- package/dist/schedule.js.map +1 -1
- package/dist/secp256k1-M22GZP2U.js +2193 -0
- package/dist/secp256k1-M22GZP2U.js.map +1 -0
- package/package.json +27 -7
- package/src/index.ts +237 -126
- package/dist/chunk-CV3L6FQZ.js.map +0 -1
- package/dist/chunk-HY7ZLHJB.js.map +0 -1
- package/dist/chunk-KUH345EY.js.map +0 -1
- package/dist/chunk-PVQZBKN7.js.map +0 -1
package/dist/index.d.ts
CHANGED
|
@@ -8,11 +8,17 @@ import {
|
|
|
8
8
|
} from "@modelcontextprotocol/sdk/types.js";
|
|
9
9
|
import { Server, Connection, PartyServerOptions } from "partyserver";
|
|
10
10
|
export { Connection, ConnectionContext, WSMessage } from "partyserver";
|
|
11
|
-
import {
|
|
11
|
+
import {
|
|
12
|
+
e as MCPClientManager,
|
|
13
|
+
T as TransportType,
|
|
14
|
+
f as MCPConnectionState
|
|
15
|
+
} from "./client-DVoPb3-C.js";
|
|
12
16
|
import { Observability } from "./observability/index.js";
|
|
17
|
+
import { MessageType } from "./ai-types.js";
|
|
13
18
|
import "zod";
|
|
14
19
|
import "@modelcontextprotocol/sdk/shared/protocol.js";
|
|
15
20
|
import "ai";
|
|
21
|
+
import "./mcp-BH1fJeiU.js";
|
|
16
22
|
import "@modelcontextprotocol/sdk/client/sse.js";
|
|
17
23
|
import "@modelcontextprotocol/sdk/client/streamableHttp.js";
|
|
18
24
|
import "./mcp/do-oauth-client-provider.js";
|
|
@@ -32,14 +38,14 @@ type RPCRequest = {
|
|
|
32
38
|
* State update message from client
|
|
33
39
|
*/
|
|
34
40
|
type StateUpdateMessage = {
|
|
35
|
-
type:
|
|
41
|
+
type: MessageType.CF_AGENT_STATE;
|
|
36
42
|
state: unknown;
|
|
37
43
|
};
|
|
38
44
|
/**
|
|
39
45
|
* RPC response message to client
|
|
40
46
|
*/
|
|
41
47
|
type RPCResponse = {
|
|
42
|
-
type:
|
|
48
|
+
type: MessageType.RPC;
|
|
43
49
|
id: string;
|
|
44
50
|
} & (
|
|
45
51
|
| {
|
|
@@ -70,12 +76,18 @@ type CallableMetadata = {
|
|
|
70
76
|
* Decorator that marks a method as callable by clients
|
|
71
77
|
* @param metadata Optional metadata about the callable method
|
|
72
78
|
*/
|
|
73
|
-
declare function
|
|
79
|
+
declare function callable(
|
|
74
80
|
metadata?: CallableMetadata
|
|
75
81
|
): <This, Args extends unknown[], Return>(
|
|
76
82
|
target: (this: This, ...args: Args) => Return,
|
|
77
83
|
context: ClassMethodDecoratorContext
|
|
78
84
|
) => (this: This, ...args: Args) => Return;
|
|
85
|
+
/**
|
|
86
|
+
* Decorator that marks a method as callable by clients
|
|
87
|
+
* @deprecated this has been renamed to callable, and unstable_callable will be removed in the next major version
|
|
88
|
+
* @param metadata Optional metadata about the callable method
|
|
89
|
+
*/
|
|
90
|
+
declare const unstable_callable: (metadata?: CallableMetadata) => void;
|
|
79
91
|
type QueueItem<T = string> = {
|
|
80
92
|
id: string;
|
|
81
93
|
payload: T;
|
|
@@ -117,11 +129,12 @@ type Schedule<T = string> = {
|
|
|
117
129
|
cron: string;
|
|
118
130
|
}
|
|
119
131
|
);
|
|
132
|
+
|
|
120
133
|
/**
|
|
121
134
|
* MCP Server state update message from server -> Client
|
|
122
135
|
*/
|
|
123
136
|
type MCPServerMessage = {
|
|
124
|
-
type:
|
|
137
|
+
type: MessageType.CF_AGENT_MCP_SERVERS;
|
|
125
138
|
mcp: MCPServersState;
|
|
126
139
|
};
|
|
127
140
|
type MCPServersState = {
|
|
@@ -136,7 +149,7 @@ type MCPServer = {
|
|
|
136
149
|
name: string;
|
|
137
150
|
server_url: string;
|
|
138
151
|
auth_url: string | null;
|
|
139
|
-
state:
|
|
152
|
+
state: MCPConnectionState;
|
|
140
153
|
instructions: string | null;
|
|
141
154
|
capabilities: ServerCapabilities | null;
|
|
142
155
|
};
|
|
@@ -153,10 +166,15 @@ declare function getCurrentAgent<
|
|
|
153
166
|
* @template Env Environment type containing bindings
|
|
154
167
|
* @template State State type to store within the Agent
|
|
155
168
|
*/
|
|
156
|
-
declare class Agent<
|
|
169
|
+
declare class Agent<
|
|
170
|
+
Env = typeof env,
|
|
171
|
+
State = unknown,
|
|
172
|
+
Props extends Record<string, unknown> = Record<string, unknown>
|
|
173
|
+
> extends Server<Env, Props> {
|
|
157
174
|
private _state;
|
|
175
|
+
private _disposables;
|
|
158
176
|
private _ParentClass;
|
|
159
|
-
mcp: MCPClientManager;
|
|
177
|
+
readonly mcp: MCPClientManager;
|
|
160
178
|
/**
|
|
161
179
|
* Initial state for the Agent
|
|
162
180
|
* Override to provide default state values
|
|
@@ -333,55 +351,40 @@ declare class Agent<Env = typeof env, State = unknown> extends Server<Env> {
|
|
|
333
351
|
/**
|
|
334
352
|
* Connect to a new MCP Server
|
|
335
353
|
*
|
|
354
|
+
* @param serverName Name of the MCP server
|
|
336
355
|
* @param url MCP Server SSE URL
|
|
337
|
-
* @param callbackHost Base host for the agent, used for the redirect URI.
|
|
356
|
+
* @param callbackHost Base host for the agent, used for the redirect URI. If not provided, will be derived from the current request.
|
|
338
357
|
* @param agentsPrefix agents routing prefix if not using `agents`
|
|
339
|
-
* @param options MCP client and transport
|
|
358
|
+
* @param options MCP client and transport options
|
|
340
359
|
* @returns authUrl
|
|
341
360
|
*/
|
|
342
361
|
addMcpServer(
|
|
343
362
|
serverName: string,
|
|
344
363
|
url: string,
|
|
345
|
-
callbackHost
|
|
364
|
+
callbackHost?: string,
|
|
346
365
|
agentsPrefix?: string,
|
|
347
366
|
options?: {
|
|
348
367
|
client?: ConstructorParameters<typeof Client>[1];
|
|
349
|
-
transport?: {
|
|
350
|
-
headers: HeadersInit;
|
|
351
|
-
};
|
|
352
|
-
}
|
|
353
|
-
): Promise<{
|
|
354
|
-
id: string;
|
|
355
|
-
authUrl: string | undefined;
|
|
356
|
-
}>;
|
|
357
|
-
_connectToMcpServerInternal(
|
|
358
|
-
_serverName: string,
|
|
359
|
-
url: string,
|
|
360
|
-
callbackUrl: string,
|
|
361
|
-
options?: {
|
|
362
|
-
client?: ConstructorParameters<typeof Client>[1];
|
|
363
|
-
/**
|
|
364
|
-
* We don't expose the normal set of transport options because:
|
|
365
|
-
* 1) we can't serialize things like the auth provider or a fetch function into the DB for reconnection purposes
|
|
366
|
-
* 2) We probably want these options to be agnostic to the transport type (SSE vs Streamable)
|
|
367
|
-
*
|
|
368
|
-
* This has the limitation that you can't override fetch, but I think headers should handle nearly all cases needed (i.e. non-standard bearer auth).
|
|
369
|
-
*/
|
|
370
368
|
transport?: {
|
|
371
369
|
headers?: HeadersInit;
|
|
370
|
+
type?: TransportType;
|
|
372
371
|
};
|
|
373
|
-
},
|
|
374
|
-
reconnect?: {
|
|
375
|
-
id: string;
|
|
376
|
-
oauthClientId?: string;
|
|
377
372
|
}
|
|
378
373
|
): Promise<{
|
|
379
374
|
id: string;
|
|
380
375
|
authUrl: string | undefined;
|
|
381
|
-
clientId: string | undefined;
|
|
382
376
|
}>;
|
|
377
|
+
private _connectToMcpServerInternal;
|
|
383
378
|
removeMcpServer(id: string): Promise<void>;
|
|
384
379
|
getMcpServers(): MCPServersState;
|
|
380
|
+
private broadcastMcpServers;
|
|
381
|
+
/**
|
|
382
|
+
* Handle OAuth callback response using MCPClientManager configuration
|
|
383
|
+
* @param result OAuth callback result
|
|
384
|
+
* @param request The original request (needed for base URL)
|
|
385
|
+
* @returns Response for the OAuth callback
|
|
386
|
+
*/
|
|
387
|
+
private handleOAuthCallbackResponse;
|
|
385
388
|
}
|
|
386
389
|
/**
|
|
387
390
|
* Namespace for creating Agent instances
|
|
@@ -489,12 +492,17 @@ type EmailSendOptions = {
|
|
|
489
492
|
* @param options Options for Agent creation
|
|
490
493
|
* @returns Promise resolving to an Agent instance stub
|
|
491
494
|
*/
|
|
492
|
-
declare function getAgentByName<
|
|
495
|
+
declare function getAgentByName<
|
|
496
|
+
Env,
|
|
497
|
+
T extends Agent<Env>,
|
|
498
|
+
Props extends Record<string, unknown> = Record<string, unknown>
|
|
499
|
+
>(
|
|
493
500
|
namespace: AgentNamespace<T>,
|
|
494
501
|
name: string,
|
|
495
502
|
options?: {
|
|
496
503
|
jurisdiction?: DurableObjectJurisdiction;
|
|
497
504
|
locationHint?: DurableObjectLocationHint;
|
|
505
|
+
props?: Props;
|
|
498
506
|
}
|
|
499
507
|
): Promise<DurableObjectStub<T>>;
|
|
500
508
|
/**
|
|
@@ -536,6 +544,8 @@ export {
|
|
|
536
544
|
type Schedule,
|
|
537
545
|
type StateUpdateMessage,
|
|
538
546
|
StreamingResponse,
|
|
547
|
+
TransportType,
|
|
548
|
+
callable,
|
|
539
549
|
createAddressBasedEmailResolver,
|
|
540
550
|
createCatchAllEmailResolver,
|
|
541
551
|
createHeaderBasedEmailResolver,
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Agent,
|
|
3
3
|
StreamingResponse,
|
|
4
|
+
callable,
|
|
4
5
|
createAddressBasedEmailResolver,
|
|
5
6
|
createCatchAllEmailResolver,
|
|
6
7
|
createHeaderBasedEmailResolver,
|
|
@@ -9,13 +10,16 @@ import {
|
|
|
9
10
|
routeAgentEmail,
|
|
10
11
|
routeAgentRequest,
|
|
11
12
|
unstable_callable
|
|
12
|
-
} from "./chunk-
|
|
13
|
-
import "./chunk-
|
|
14
|
-
import "./chunk-
|
|
15
|
-
import "./chunk-
|
|
13
|
+
} from "./chunk-254F4GDT.js";
|
|
14
|
+
import "./chunk-3OT2NNEW.js";
|
|
15
|
+
import "./chunk-Z44WASMA.js";
|
|
16
|
+
import "./chunk-QEVM4BVL.js";
|
|
17
|
+
import "./chunk-BER7KXUJ.js";
|
|
18
|
+
import "./chunk-PR4QN5HX.js";
|
|
16
19
|
export {
|
|
17
20
|
Agent,
|
|
18
21
|
StreamingResponse,
|
|
22
|
+
callable,
|
|
19
23
|
createAddressBasedEmailResolver,
|
|
20
24
|
createCatchAllEmailResolver,
|
|
21
25
|
createHeaderBasedEmailResolver,
|
package/dist/mcp/client.d.ts
CHANGED
|
@@ -3,7 +3,8 @@ import '@modelcontextprotocol/sdk/client/index.js';
|
|
|
3
3
|
import '@modelcontextprotocol/sdk/shared/protocol.js';
|
|
4
4
|
import '@modelcontextprotocol/sdk/types.js';
|
|
5
5
|
import 'ai';
|
|
6
|
-
export {
|
|
6
|
+
export { e as MCPClientManager, d as MCPClientOAuthCallbackConfig, c as MCPClientOAuthResult, g as getNamespacedData } from '../client-DVoPb3-C.js';
|
|
7
|
+
import '../mcp-BH1fJeiU.js';
|
|
7
8
|
import '@modelcontextprotocol/sdk/client/sse.js';
|
|
8
9
|
import '@modelcontextprotocol/sdk/client/streamableHttp.js';
|
|
9
10
|
import './do-oauth-client-provider.js';
|
package/dist/mcp/client.js
CHANGED
|
@@ -15,6 +15,7 @@ declare class DurableObjectOAuthClientProvider implements AgentsOAuthProvider {
|
|
|
15
15
|
private _clientId_;
|
|
16
16
|
constructor(storage: DurableObjectStorage, clientName: string, baseRedirectUrl: string);
|
|
17
17
|
get clientMetadata(): OAuthClientMetadata;
|
|
18
|
+
get clientUri(): string;
|
|
18
19
|
get redirectUrl(): string;
|
|
19
20
|
get clientId(): string;
|
|
20
21
|
set clientId(clientId_: string);
|
package/dist/mcp/index.d.ts
CHANGED
|
@@ -1,110 +1,77 @@
|
|
|
1
|
-
import { M as MCPClientManager } from '../client-DgyzBU_8.js';
|
|
2
|
-
export { S as SSEEdgeClientTransport, a as StreamableHTTPEdgeClientTransport } from '../client-DgyzBU_8.js';
|
|
3
|
-
import { DurableObject } from 'cloudflare:workers';
|
|
4
1
|
import { Server } from '@modelcontextprotocol/sdk/server/index.js';
|
|
5
2
|
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
6
|
-
import { ElicitResult } from '@modelcontextprotocol/sdk/types.js';
|
|
3
|
+
import { JSONRPCMessage, ElicitResult } from '@modelcontextprotocol/sdk/types.js';
|
|
7
4
|
export { ElicitRequest, ElicitRequestSchema, ElicitResult } from '@modelcontextprotocol/sdk/types.js';
|
|
8
|
-
import {
|
|
9
|
-
import '
|
|
5
|
+
import { Agent } from '../index.js';
|
|
6
|
+
import { M as MaybePromise, B as BaseTransportType, S as ServeOptions } from '../client-DVoPb3-C.js';
|
|
7
|
+
export { d as MCPClientOAuthCallbackConfig, c as MCPClientOAuthResult, a as SSEEdgeClientTransport, b as StreamableHTTPEdgeClientTransport } from '../client-DVoPb3-C.js';
|
|
8
|
+
import { Connection, ConnectionContext } from 'partyserver';
|
|
9
|
+
import 'cloudflare:workers';
|
|
10
10
|
import '@modelcontextprotocol/sdk/client/index.js';
|
|
11
|
-
import '
|
|
11
|
+
import '../observability/index.js';
|
|
12
|
+
import '../mcp-BH1fJeiU.js';
|
|
13
|
+
import '../ai-types.js';
|
|
12
14
|
import 'ai';
|
|
15
|
+
import 'zod';
|
|
16
|
+
import '@modelcontextprotocol/sdk/shared/protocol.js';
|
|
13
17
|
import '@modelcontextprotocol/sdk/client/sse.js';
|
|
14
18
|
import '@modelcontextprotocol/sdk/client/streamableHttp.js';
|
|
15
19
|
import './do-oauth-client-provider.js';
|
|
16
20
|
import '@modelcontextprotocol/sdk/client/auth.js';
|
|
17
21
|
import '@modelcontextprotocol/sdk/shared/auth.js';
|
|
18
22
|
|
|
19
|
-
|
|
20
|
-
origin?: string;
|
|
21
|
-
methods?: string;
|
|
22
|
-
headers?: string;
|
|
23
|
-
maxAge?: number;
|
|
24
|
-
exposeHeaders?: string;
|
|
25
|
-
}
|
|
26
|
-
type MaybePromise<T> = T | Promise<T>;
|
|
27
|
-
declare abstract class McpAgent<Env = unknown, State = unknown, Props extends Record<string, unknown> = Record<string, unknown>> extends DurableObject<Env> {
|
|
28
|
-
private _status;
|
|
23
|
+
declare abstract class McpAgent<Env = unknown, State = unknown, Props extends Record<string, unknown> = Record<string, unknown>> extends Agent<Env, State, Props> {
|
|
29
24
|
private _transport?;
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
protected constructor(ctx: DurableObjectState, env: Env);
|
|
39
|
-
/**
|
|
40
|
-
* Agents API allowlist
|
|
25
|
+
props?: Props;
|
|
26
|
+
abstract server: MaybePromise<McpServer | Server>;
|
|
27
|
+
abstract init(): Promise<void>;
|
|
28
|
+
setInitializeRequest(initializeRequest: JSONRPCMessage): Promise<void>;
|
|
29
|
+
getInitializeRequest(): Promise<JSONRPCMessage | undefined>;
|
|
30
|
+
/** Read the transport type for this agent.
|
|
31
|
+
* This relies on the naming scheme being `sse:${sessionId}`
|
|
32
|
+
* or `streamable-http:${sessionId}`.
|
|
41
33
|
*/
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
/**
|
|
47
|
-
* Elicit user input with a message and schema
|
|
34
|
+
getTransportType(): BaseTransportType;
|
|
35
|
+
/** Read the sessionId for this agent.
|
|
36
|
+
* This relies on the naming scheme being `sse:${sessionId}`
|
|
37
|
+
* or `streamable-http:${sessionId}`.
|
|
48
38
|
*/
|
|
39
|
+
getSessionId(): string;
|
|
40
|
+
/** Get the unique WebSocket. SSE transport only. */
|
|
41
|
+
private getWebSocket;
|
|
42
|
+
/** Returns a new transport matching the type of the Agent. */
|
|
43
|
+
private initTransport;
|
|
44
|
+
/** Update and store the props */
|
|
45
|
+
updateProps(props?: Props): Promise<void>;
|
|
46
|
+
reinitializeServer(): Promise<void>;
|
|
47
|
+
/** Sets up the MCP transport and server every time the Agent is started.*/
|
|
48
|
+
onStart(props?: Props): Promise<void>;
|
|
49
|
+
/** Validates new WebSocket connections. */
|
|
50
|
+
onConnect(conn: Connection, { request: req }: ConnectionContext): Promise<void>;
|
|
51
|
+
/** Handles MCP Messages for the legacy SSE transport. */
|
|
52
|
+
onSSEMcpMessage(_sessionId: string, messageBody: unknown): Promise<Error | null>;
|
|
53
|
+
/** Elicit user input with a message and schema */
|
|
49
54
|
elicitInput(params: {
|
|
50
55
|
message: string;
|
|
51
56
|
requestedSchema: unknown;
|
|
52
57
|
}): Promise<ElicitResult>;
|
|
53
|
-
|
|
54
|
-
onStart(): Promise<void>;
|
|
55
|
-
/**
|
|
56
|
-
* McpAgent API
|
|
57
|
-
*/
|
|
58
|
-
abstract server: MaybePromise<McpServer | Server>;
|
|
59
|
-
props: Props;
|
|
60
|
-
initRun: boolean;
|
|
61
|
-
abstract init(): Promise<void>;
|
|
62
|
-
/**
|
|
63
|
-
* Handle errors that occur during initialization or operation.
|
|
64
|
-
* Override this method to provide custom error handling.
|
|
65
|
-
* @param error - The error that occurred
|
|
66
|
-
* @returns An error response object with status code and message
|
|
67
|
-
*/
|
|
68
|
-
onError(error: Error): {
|
|
69
|
-
status: number;
|
|
70
|
-
message: string;
|
|
71
|
-
};
|
|
72
|
-
_init(props: Props): Promise<void>;
|
|
73
|
-
setInitialized(): Promise<void>;
|
|
74
|
-
isInitialized(): Promise<boolean>;
|
|
75
|
-
updateProps(props: Props): Promise<void>;
|
|
76
|
-
private _initialize;
|
|
77
|
-
fetch(request: Request): Promise<Response>;
|
|
78
|
-
getWebSocket(): WebSocket | null;
|
|
79
|
-
getWebSocketForResponseID(id: string): WebSocket | null;
|
|
80
|
-
onMessage(connection: Connection, event: WSMessage): Promise<void>;
|
|
81
|
-
/**
|
|
82
|
-
* Wait for elicitation response through storage polling
|
|
83
|
-
*/
|
|
58
|
+
/** Wait for elicitation response through storage polling */
|
|
84
59
|
private _waitForElicitationResponse;
|
|
85
|
-
/**
|
|
86
|
-
* Handle elicitation responses */
|
|
60
|
+
/** Handle elicitation responses */
|
|
87
61
|
private _handleElicitationResponse;
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
static mount(path: string, { binding, corsOptions }?: {
|
|
93
|
-
binding?: string;
|
|
94
|
-
corsOptions?: CORSOptions;
|
|
95
|
-
}): {
|
|
62
|
+
/** Return a handler for the given path for this MCP.
|
|
63
|
+
* Defaults to Streamable HTTP transport.
|
|
64
|
+
*/
|
|
65
|
+
static serve(path: string, { binding, corsOptions, transport }?: ServeOptions): {
|
|
96
66
|
fetch<Env>(this: void, request: Request, env: Env, ctx: ExecutionContext): Promise<Response>;
|
|
97
67
|
};
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
68
|
+
/**
|
|
69
|
+
* Legacy api
|
|
70
|
+
**/
|
|
71
|
+
static mount(path: string, opts?: Omit<ServeOptions, "transport">): {
|
|
102
72
|
fetch<Env>(this: void, request: Request, env: Env, ctx: ExecutionContext): Promise<Response>;
|
|
103
73
|
};
|
|
104
|
-
static
|
|
105
|
-
binding?: string;
|
|
106
|
-
corsOptions?: CORSOptions;
|
|
107
|
-
}): {
|
|
74
|
+
static serveSSE(path: string, opts?: Omit<ServeOptions, "transport">): {
|
|
108
75
|
fetch<Env>(this: void, request: Request, env: Env, ctx: ExecutionContext): Promise<Response>;
|
|
109
76
|
};
|
|
110
77
|
}
|