We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 671bdf7 commit 7e52f41Copy full SHA for 7e52f41
packages/agents/src/mcp/index.ts
@@ -558,7 +558,11 @@ export abstract class McpAgent<
558
const encoder = new TextEncoder();
559
560
// Send the endpoint event
561
- const endpointMessage = `event: endpoint\ndata: ${encodeURI(`${pathname}/message`)}?sessionId=${sessionId}\n\n`;
+ const endpointUrl = new URL(request.url)
562
+ endpointUrl.pathname = encodeURI(`${pathname}/message`)
563
+ endpointUrl.searchParams.set('sessionId', sessionId)
564
+ const relativeUrlWithSession = endpointUrl.pathname + endpointUrl.search + endpointUrl.hash;
565
+ const endpointMessage = `event: endpoint\ndata: ${relativeUrlWithSession}\n\n`;
566
writer.write(encoder.encode(endpointMessage));
567
568
// Get the Durable Object
0 commit comments