agents 0.0.0-87b44ab → 0.0.0-885b3db
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 +127 -22
- package/dist/ai-chat-agent.d.ts +6 -4
- package/dist/ai-chat-agent.js +64 -26
- package/dist/ai-chat-agent.js.map +1 -1
- package/dist/ai-react.d.ts +10 -9
- package/dist/ai-react.js +27 -27
- package/dist/ai-react.js.map +1 -1
- package/dist/{chunk-VCSB47AK.js → chunk-KUH345EY.js} +8 -8
- package/dist/chunk-KUH345EY.js.map +1 -0
- package/dist/{chunk-BZXOAZUX.js → chunk-PVQZBKN7.js} +5 -5
- package/dist/chunk-PVQZBKN7.js.map +1 -0
- package/dist/{chunk-Y67CHZBI.js → chunk-UNG3FXYX.js} +80 -19
- package/dist/chunk-UNG3FXYX.js.map +1 -0
- package/dist/{chunk-VNSFDJYL.js → chunk-Z2OUUKK4.js} +616 -129
- package/dist/chunk-Z2OUUKK4.js.map +1 -0
- package/dist/client.d.ts +2 -2
- package/dist/client.js +1 -1
- package/dist/index-BIJvkfYt.d.ts +614 -0
- package/dist/index.d.ts +34 -405
- package/dist/index.js +10 -4
- package/dist/mcp/client.d.ts +290 -19
- package/dist/mcp/client.js +1 -1
- package/dist/mcp/do-oauth-client-provider.js +1 -1
- package/dist/mcp/index.d.ts +34 -11
- package/dist/mcp/index.js +61 -52
- package/dist/mcp/index.js.map +1 -1
- package/dist/observability/index.d.ts +13 -0
- package/dist/observability/index.js +10 -0
- package/dist/observability/index.js.map +1 -0
- package/dist/react.d.ts +9 -8
- package/dist/react.js +7 -7
- package/dist/react.js.map +1 -1
- package/dist/schedule.d.ts +6 -6
- package/dist/schedule.js +4 -4
- package/dist/schedule.js.map +1 -1
- package/package.json +76 -71
- package/src/index.ts +817 -173
- package/dist/chunk-BZXOAZUX.js.map +0 -1
- package/dist/chunk-VCSB47AK.js.map +0 -1
- package/dist/chunk-VNSFDJYL.js.map +0 -1
- package/dist/chunk-Y67CHZBI.js.map +0 -1
package/dist/mcp/client.js
CHANGED
package/dist/mcp/index.d.ts
CHANGED
|
@@ -1,17 +1,40 @@
|
|
|
1
1
|
import { MCPClientManager } from './client.js';
|
|
2
2
|
import { DurableObject } from 'cloudflare:workers';
|
|
3
|
-
import { Connection, WSMessage } from 'partyserver';
|
|
4
|
-
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
5
3
|
import { Server } from '@modelcontextprotocol/sdk/server/index.js';
|
|
4
|
+
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
5
|
+
import { Connection, WSMessage } from 'partyserver';
|
|
6
|
+
import { SSEClientTransport, SSEClientTransportOptions } from '@modelcontextprotocol/sdk/client/sse.js';
|
|
7
|
+
import { StreamableHTTPClientTransport, StreamableHTTPClientTransportOptions } from '@modelcontextprotocol/sdk/client/streamableHttp.js';
|
|
6
8
|
import 'zod';
|
|
7
|
-
import '@modelcontextprotocol/sdk/types.js';
|
|
8
9
|
import '@modelcontextprotocol/sdk/client/index.js';
|
|
9
|
-
import '@modelcontextprotocol/sdk/
|
|
10
|
+
import '@modelcontextprotocol/sdk/shared/protocol.js';
|
|
11
|
+
import '@modelcontextprotocol/sdk/types.js';
|
|
12
|
+
import 'ai';
|
|
10
13
|
import './do-oauth-client-provider.js';
|
|
11
14
|
import '@modelcontextprotocol/sdk/client/auth.js';
|
|
12
15
|
import '@modelcontextprotocol/sdk/shared/auth.js';
|
|
13
|
-
|
|
14
|
-
|
|
16
|
+
|
|
17
|
+
declare class SSEEdgeClientTransport extends SSEClientTransport {
|
|
18
|
+
private authProvider;
|
|
19
|
+
/**
|
|
20
|
+
* Creates a new EdgeSSEClientTransport, which overrides fetch to be compatible with the CF workers environment
|
|
21
|
+
*/
|
|
22
|
+
constructor(url: URL, options: SSEClientTransportOptions);
|
|
23
|
+
authHeaders(): Promise<{
|
|
24
|
+
Authorization: string;
|
|
25
|
+
} | undefined>;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
declare class StreamableHTTPEdgeClientTransport extends StreamableHTTPClientTransport {
|
|
29
|
+
private authProvider;
|
|
30
|
+
/**
|
|
31
|
+
* Creates a new StreamableHTTPEdgeClientTransport, which overrides fetch to be compatible with the CF workers environment
|
|
32
|
+
*/
|
|
33
|
+
constructor(url: URL, options: StreamableHTTPClientTransportOptions);
|
|
34
|
+
authHeaders(): Promise<{
|
|
35
|
+
Authorization: string;
|
|
36
|
+
} | undefined>;
|
|
37
|
+
}
|
|
15
38
|
|
|
16
39
|
interface CORSOptions {
|
|
17
40
|
origin?: string;
|
|
@@ -57,23 +80,23 @@ declare abstract class McpAgent<Env = unknown, State = unknown, Props extends Re
|
|
|
57
80
|
getWebSocket(): WebSocket | null;
|
|
58
81
|
getWebSocketForResponseID(id: string): WebSocket | null;
|
|
59
82
|
onMessage(connection: Connection, event: WSMessage): Promise<void>;
|
|
60
|
-
onSSEMcpMessage(
|
|
83
|
+
onSSEMcpMessage(_sessionId: string, request: Request): Promise<Error | null>;
|
|
61
84
|
webSocketMessage(ws: WebSocket, event: ArrayBuffer | string): Promise<void>;
|
|
62
85
|
webSocketError(ws: WebSocket, error: unknown): Promise<void>;
|
|
63
86
|
webSocketClose(ws: WebSocket, code: number, reason: string, wasClean: boolean): Promise<void>;
|
|
64
|
-
static mount(path: string, { binding, corsOptions
|
|
87
|
+
static mount(path: string, { binding, corsOptions }?: {
|
|
65
88
|
binding?: string;
|
|
66
89
|
corsOptions?: CORSOptions;
|
|
67
90
|
}): {
|
|
68
91
|
fetch<Env>(this: void, request: Request, env: Env, ctx: ExecutionContext): Promise<Response>;
|
|
69
92
|
};
|
|
70
|
-
static serveSSE(path: string, { binding, corsOptions
|
|
93
|
+
static serveSSE(path: string, { binding, corsOptions }?: {
|
|
71
94
|
binding?: string;
|
|
72
95
|
corsOptions?: CORSOptions;
|
|
73
96
|
}): {
|
|
74
97
|
fetch<Env>(this: void, request: Request, env: Env, ctx: ExecutionContext): Promise<Response>;
|
|
75
98
|
};
|
|
76
|
-
static serve(path: string, { binding, corsOptions
|
|
99
|
+
static serve(path: string, { binding, corsOptions }?: {
|
|
77
100
|
binding?: string;
|
|
78
101
|
corsOptions?: CORSOptions;
|
|
79
102
|
}): {
|
|
@@ -81,4 +104,4 @@ declare abstract class McpAgent<Env = unknown, State = unknown, Props extends Re
|
|
|
81
104
|
};
|
|
82
105
|
}
|
|
83
106
|
|
|
84
|
-
export { McpAgent };
|
|
107
|
+
export { McpAgent, SSEEdgeClientTransport, StreamableHTTPEdgeClientTransport };
|
package/dist/mcp/index.js
CHANGED
|
@@ -1,31 +1,37 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Agent
|
|
3
|
-
} from "../chunk-
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
} from "../chunk-Z2OUUKK4.js";
|
|
4
|
+
import {
|
|
5
|
+
SSEEdgeClientTransport,
|
|
6
|
+
StreamableHTTPEdgeClientTransport
|
|
7
|
+
} from "../chunk-UNG3FXYX.js";
|
|
8
|
+
import "../chunk-PVQZBKN7.js";
|
|
9
|
+
import "../chunk-KUH345EY.js";
|
|
7
10
|
|
|
8
11
|
// src/mcp/index.ts
|
|
9
12
|
import { DurableObject } from "cloudflare:workers";
|
|
10
13
|
import {
|
|
11
14
|
InitializeRequestSchema,
|
|
15
|
+
JSONRPCMessageSchema,
|
|
12
16
|
isJSONRPCError,
|
|
13
17
|
isJSONRPCNotification,
|
|
14
18
|
isJSONRPCRequest,
|
|
15
|
-
isJSONRPCResponse
|
|
16
|
-
JSONRPCMessageSchema
|
|
19
|
+
isJSONRPCResponse
|
|
17
20
|
} from "@modelcontextprotocol/sdk/types.js";
|
|
18
21
|
var MAXIMUM_MESSAGE_SIZE_BYTES = 4 * 1024 * 1024;
|
|
19
|
-
function corsHeaders(
|
|
22
|
+
function corsHeaders(_request, corsOptions = {}) {
|
|
20
23
|
const origin = "*";
|
|
21
24
|
return {
|
|
22
|
-
"Access-Control-Allow-
|
|
25
|
+
"Access-Control-Allow-Headers": corsOptions.headers || "Content-Type, mcp-session-id, mcp-protocol-version",
|
|
23
26
|
"Access-Control-Allow-Methods": corsOptions.methods || "GET, POST, OPTIONS",
|
|
24
|
-
"Access-Control-Allow-
|
|
25
|
-
"Access-Control-
|
|
26
|
-
"Access-Control-
|
|
27
|
+
"Access-Control-Allow-Origin": corsOptions.origin || origin,
|
|
28
|
+
"Access-Control-Expose-Headers": corsOptions.exposeHeaders || "mcp-session-id",
|
|
29
|
+
"Access-Control-Max-Age": (corsOptions.maxAge || 86400).toString()
|
|
27
30
|
};
|
|
28
31
|
}
|
|
32
|
+
function isDurableObjectNamespace(namespace) {
|
|
33
|
+
return typeof namespace === "object" && namespace !== null && "newUniqueId" in namespace && typeof namespace.newUniqueId === "function" && "idFromName" in namespace && typeof namespace.idFromName === "function";
|
|
34
|
+
}
|
|
29
35
|
function handleCORS(request, corsOptions) {
|
|
30
36
|
if (request.method === "OPTIONS") {
|
|
31
37
|
return new Response(null, { headers: corsHeaders(request, corsOptions) });
|
|
@@ -138,6 +144,7 @@ var McpAgent = class _McpAgent extends DurableObject {
|
|
|
138
144
|
setState(state) {
|
|
139
145
|
return this._agent.setState(state);
|
|
140
146
|
}
|
|
147
|
+
// biome-ignore lint/correctness/noUnusedFunctionParameters: overriden later
|
|
141
148
|
onStateUpdate(state, source) {
|
|
142
149
|
}
|
|
143
150
|
async onStart() {
|
|
@@ -284,7 +291,7 @@ var McpAgent = class _McpAgent extends DurableObject {
|
|
|
284
291
|
}
|
|
285
292
|
// All messages received over SSE after the initial connection has been established
|
|
286
293
|
// will be passed here
|
|
287
|
-
async onSSEMcpMessage(
|
|
294
|
+
async onSSEMcpMessage(_sessionId, request) {
|
|
288
295
|
if (this._status !== "started") {
|
|
289
296
|
await this._initialize();
|
|
290
297
|
}
|
|
@@ -356,7 +363,7 @@ var McpAgent = class _McpAgent extends DurableObject {
|
|
|
356
363
|
);
|
|
357
364
|
return new Response("Invalid binding", { status: 500 });
|
|
358
365
|
}
|
|
359
|
-
if (bindingValue
|
|
366
|
+
if (!isDurableObjectNamespace(bindingValue)) {
|
|
360
367
|
return new Response("Invalid binding", { status: 500 });
|
|
361
368
|
}
|
|
362
369
|
const namespace = bindingValue;
|
|
@@ -417,10 +424,10 @@ data: ${JSON.stringify(result.data)}
|
|
|
417
424
|
onMessage(event).catch(console.error);
|
|
418
425
|
});
|
|
419
426
|
ws.addEventListener("error", (error) => {
|
|
420
|
-
async function onError(
|
|
427
|
+
async function onError(_error) {
|
|
421
428
|
try {
|
|
422
429
|
await writer.close();
|
|
423
|
-
} catch (
|
|
430
|
+
} catch (_e) {
|
|
424
431
|
}
|
|
425
432
|
}
|
|
426
433
|
onError(error).catch(console.error);
|
|
@@ -437,9 +444,9 @@ data: ${JSON.stringify(result.data)}
|
|
|
437
444
|
});
|
|
438
445
|
return new Response(readable, {
|
|
439
446
|
headers: {
|
|
440
|
-
"Content-Type": "text/event-stream",
|
|
441
447
|
"Cache-Control": "no-cache",
|
|
442
448
|
Connection: "keep-alive",
|
|
449
|
+
"Content-Type": "text/event-stream",
|
|
443
450
|
...corsHeaders(request, corsOptions)
|
|
444
451
|
}
|
|
445
452
|
});
|
|
@@ -475,23 +482,23 @@ data: ${JSON.stringify(result.data)}
|
|
|
475
482
|
const error = await doStub.onSSEMcpMessage(sessionId, request);
|
|
476
483
|
if (error) {
|
|
477
484
|
return new Response(error.message, {
|
|
478
|
-
status: 400,
|
|
479
485
|
headers: {
|
|
480
|
-
"Content-Type": "text/event-stream",
|
|
481
486
|
"Cache-Control": "no-cache",
|
|
482
487
|
Connection: "keep-alive",
|
|
488
|
+
"Content-Type": "text/event-stream",
|
|
483
489
|
...corsHeaders(request, corsOptions)
|
|
484
|
-
}
|
|
490
|
+
},
|
|
491
|
+
status: 400
|
|
485
492
|
});
|
|
486
493
|
}
|
|
487
494
|
return new Response("Accepted", {
|
|
488
|
-
status: 202,
|
|
489
495
|
headers: {
|
|
490
|
-
"Content-Type": "text/event-stream",
|
|
491
496
|
"Cache-Control": "no-cache",
|
|
492
497
|
Connection: "keep-alive",
|
|
498
|
+
"Content-Type": "text/event-stream",
|
|
493
499
|
...corsHeaders(request, corsOptions)
|
|
494
|
-
}
|
|
500
|
+
},
|
|
501
|
+
status: 202
|
|
495
502
|
});
|
|
496
503
|
}
|
|
497
504
|
return new Response("Not Found", { status: 404 });
|
|
@@ -521,7 +528,7 @@ data: ${JSON.stringify(result.data)}
|
|
|
521
528
|
);
|
|
522
529
|
return new Response("Invalid binding", { status: 500 });
|
|
523
530
|
}
|
|
524
|
-
if (bindingValue
|
|
531
|
+
if (!isDurableObjectNamespace(bindingValue)) {
|
|
525
532
|
return new Response("Invalid binding", { status: 500 });
|
|
526
533
|
}
|
|
527
534
|
const namespace = bindingValue;
|
|
@@ -529,24 +536,24 @@ data: ${JSON.stringify(result.data)}
|
|
|
529
536
|
const acceptHeader = request.headers.get("accept");
|
|
530
537
|
if (!acceptHeader?.includes("application/json") || !acceptHeader.includes("text/event-stream")) {
|
|
531
538
|
const body2 = JSON.stringify({
|
|
532
|
-
jsonrpc: "2.0",
|
|
533
539
|
error: {
|
|
534
540
|
code: -32e3,
|
|
535
541
|
message: "Not Acceptable: Client must accept both application/json and text/event-stream"
|
|
536
542
|
},
|
|
537
|
-
id: null
|
|
543
|
+
id: null,
|
|
544
|
+
jsonrpc: "2.0"
|
|
538
545
|
});
|
|
539
546
|
return new Response(body2, { status: 406 });
|
|
540
547
|
}
|
|
541
548
|
const ct = request.headers.get("content-type");
|
|
542
549
|
if (!ct || !ct.includes("application/json")) {
|
|
543
550
|
const body2 = JSON.stringify({
|
|
544
|
-
jsonrpc: "2.0",
|
|
545
551
|
error: {
|
|
546
552
|
code: -32e3,
|
|
547
553
|
message: "Unsupported Media Type: Content-Type must be application/json"
|
|
548
554
|
},
|
|
549
|
-
id: null
|
|
555
|
+
id: null,
|
|
556
|
+
jsonrpc: "2.0"
|
|
550
557
|
});
|
|
551
558
|
return new Response(body2, { status: 415 });
|
|
552
559
|
}
|
|
@@ -556,12 +563,12 @@ data: ${JSON.stringify(result.data)}
|
|
|
556
563
|
);
|
|
557
564
|
if (contentLength > MAXIMUM_MESSAGE_SIZE_BYTES) {
|
|
558
565
|
const body2 = JSON.stringify({
|
|
559
|
-
jsonrpc: "2.0",
|
|
560
566
|
error: {
|
|
561
567
|
code: -32e3,
|
|
562
568
|
message: `Request body too large. Maximum size is ${MAXIMUM_MESSAGE_SIZE_BYTES} bytes`
|
|
563
569
|
},
|
|
564
|
-
id: null
|
|
570
|
+
id: null,
|
|
571
|
+
jsonrpc: "2.0"
|
|
565
572
|
});
|
|
566
573
|
return new Response(body2, { status: 413 });
|
|
567
574
|
}
|
|
@@ -569,14 +576,14 @@ data: ${JSON.stringify(result.data)}
|
|
|
569
576
|
let rawMessage;
|
|
570
577
|
try {
|
|
571
578
|
rawMessage = await request.json();
|
|
572
|
-
} catch (
|
|
579
|
+
} catch (_error) {
|
|
573
580
|
const body2 = JSON.stringify({
|
|
574
|
-
jsonrpc: "2.0",
|
|
575
581
|
error: {
|
|
576
582
|
code: -32700,
|
|
577
583
|
message: "Parse error: Invalid JSON"
|
|
578
584
|
},
|
|
579
|
-
id: null
|
|
585
|
+
id: null,
|
|
586
|
+
jsonrpc: "2.0"
|
|
580
587
|
});
|
|
581
588
|
return new Response(body2, { status: 400 });
|
|
582
589
|
}
|
|
@@ -590,12 +597,12 @@ data: ${JSON.stringify(result.data)}
|
|
|
590
597
|
for (const msg of arrayMessage) {
|
|
591
598
|
if (!JSONRPCMessageSchema.safeParse(msg).success) {
|
|
592
599
|
const body2 = JSON.stringify({
|
|
593
|
-
jsonrpc: "2.0",
|
|
594
600
|
error: {
|
|
595
601
|
code: -32700,
|
|
596
602
|
message: "Parse error: Invalid JSON-RPC message"
|
|
597
603
|
},
|
|
598
|
-
id: null
|
|
604
|
+
id: null,
|
|
605
|
+
jsonrpc: "2.0"
|
|
599
606
|
});
|
|
600
607
|
return new Response(body2, { status: 400 });
|
|
601
608
|
}
|
|
@@ -606,34 +613,34 @@ data: ${JSON.stringify(result.data)}
|
|
|
606
613
|
);
|
|
607
614
|
if (isInitializationRequest && sessionId) {
|
|
608
615
|
const body2 = JSON.stringify({
|
|
609
|
-
jsonrpc: "2.0",
|
|
610
616
|
error: {
|
|
611
617
|
code: -32600,
|
|
612
618
|
message: "Invalid Request: Initialization requests must not include a sessionId"
|
|
613
619
|
},
|
|
614
|
-
id: null
|
|
620
|
+
id: null,
|
|
621
|
+
jsonrpc: "2.0"
|
|
615
622
|
});
|
|
616
623
|
return new Response(body2, { status: 400 });
|
|
617
624
|
}
|
|
618
625
|
if (isInitializationRequest && messages.length > 1) {
|
|
619
626
|
const body2 = JSON.stringify({
|
|
620
|
-
jsonrpc: "2.0",
|
|
621
627
|
error: {
|
|
622
628
|
code: -32600,
|
|
623
629
|
message: "Invalid Request: Only one initialization request is allowed"
|
|
624
630
|
},
|
|
625
|
-
id: null
|
|
631
|
+
id: null,
|
|
632
|
+
jsonrpc: "2.0"
|
|
626
633
|
});
|
|
627
634
|
return new Response(body2, { status: 400 });
|
|
628
635
|
}
|
|
629
636
|
if (!isInitializationRequest && !sessionId) {
|
|
630
637
|
const body2 = JSON.stringify({
|
|
631
|
-
jsonrpc: "2.0",
|
|
632
638
|
error: {
|
|
633
639
|
code: -32e3,
|
|
634
640
|
message: "Bad Request: Mcp-Session-Id header is required"
|
|
635
641
|
},
|
|
636
|
-
id: null
|
|
642
|
+
id: null,
|
|
643
|
+
jsonrpc: "2.0"
|
|
637
644
|
});
|
|
638
645
|
return new Response(body2, { status: 400 });
|
|
639
646
|
}
|
|
@@ -646,12 +653,12 @@ data: ${JSON.stringify(result.data)}
|
|
|
646
653
|
await doStub.setInitialized();
|
|
647
654
|
} else if (!isInitialized) {
|
|
648
655
|
const body2 = JSON.stringify({
|
|
649
|
-
jsonrpc: "2.0",
|
|
650
656
|
error: {
|
|
651
657
|
code: -32001,
|
|
652
658
|
message: "Session not found"
|
|
653
659
|
},
|
|
654
|
-
id: null
|
|
660
|
+
id: null,
|
|
661
|
+
jsonrpc: "2.0"
|
|
655
662
|
});
|
|
656
663
|
return new Response(body2, { status: 404 });
|
|
657
664
|
}
|
|
@@ -674,12 +681,12 @@ data: ${JSON.stringify(result.data)}
|
|
|
674
681
|
console.error("Failed to establish WebSocket connection");
|
|
675
682
|
await writer.close();
|
|
676
683
|
const body2 = JSON.stringify({
|
|
677
|
-
jsonrpc: "2.0",
|
|
678
684
|
error: {
|
|
679
685
|
code: -32001,
|
|
680
686
|
message: "Failed to establish WebSocket connection"
|
|
681
687
|
},
|
|
682
|
-
id: null
|
|
688
|
+
id: null,
|
|
689
|
+
jsonrpc: "2.0"
|
|
683
690
|
});
|
|
684
691
|
return new Response(body2, { status: 500 });
|
|
685
692
|
}
|
|
@@ -712,10 +719,10 @@ data: ${JSON.stringify(result.data)}
|
|
|
712
719
|
onMessage(event).catch(console.error);
|
|
713
720
|
});
|
|
714
721
|
ws.addEventListener("error", (error) => {
|
|
715
|
-
async function onError(
|
|
722
|
+
async function onError(_error) {
|
|
716
723
|
try {
|
|
717
724
|
await writer.close();
|
|
718
|
-
} catch (
|
|
725
|
+
} catch (_e) {
|
|
719
726
|
}
|
|
720
727
|
}
|
|
721
728
|
onError(error).catch(console.error);
|
|
@@ -739,8 +746,8 @@ data: ${JSON.stringify(result.data)}
|
|
|
739
746
|
}
|
|
740
747
|
ws.close();
|
|
741
748
|
return new Response(null, {
|
|
742
|
-
|
|
743
|
-
|
|
749
|
+
headers: corsHeaders(request, corsOptions),
|
|
750
|
+
status: 202
|
|
744
751
|
});
|
|
745
752
|
}
|
|
746
753
|
for (const message of messages) {
|
|
@@ -751,9 +758,9 @@ data: ${JSON.stringify(result.data)}
|
|
|
751
758
|
}
|
|
752
759
|
return new Response(readable, {
|
|
753
760
|
headers: {
|
|
754
|
-
"Content-Type": "text/event-stream",
|
|
755
761
|
"Cache-Control": "no-cache",
|
|
756
762
|
Connection: "keep-alive",
|
|
763
|
+
"Content-Type": "text/event-stream",
|
|
757
764
|
"mcp-session-id": sessionId,
|
|
758
765
|
...corsHeaders(request, corsOptions)
|
|
759
766
|
},
|
|
@@ -761,12 +768,12 @@ data: ${JSON.stringify(result.data)}
|
|
|
761
768
|
});
|
|
762
769
|
}
|
|
763
770
|
const body = JSON.stringify({
|
|
764
|
-
jsonrpc: "2.0",
|
|
765
771
|
error: {
|
|
766
772
|
code: -32e3,
|
|
767
773
|
message: "Method not allowed"
|
|
768
774
|
},
|
|
769
|
-
id: null
|
|
775
|
+
id: null,
|
|
776
|
+
jsonrpc: "2.0"
|
|
770
777
|
});
|
|
771
778
|
return new Response(body, { status: 405 });
|
|
772
779
|
}
|
|
@@ -774,6 +781,8 @@ data: ${JSON.stringify(result.data)}
|
|
|
774
781
|
}
|
|
775
782
|
};
|
|
776
783
|
export {
|
|
777
|
-
McpAgent
|
|
784
|
+
McpAgent,
|
|
785
|
+
SSEEdgeClientTransport,
|
|
786
|
+
StreamableHTTPEdgeClientTransport
|
|
778
787
|
};
|
|
779
788
|
//# sourceMappingURL=index.js.map
|