-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Describe the bug
When using SSE and connecting to a server that uses Cookies for credentials I configured the requestInit
option in the StreamableHTTPClientTransport
constructor to include credentials
new StreamableHTTPClientTransport(new URL(config.url), {
requestInit: { credentials: 'include', mode: 'cors' },
...
when it connects to the SSE server the following requests happend
- POST /mcp (cookies are included)
- POST /mcp (cookies are included)
- GET /mcp (cookies are NOT included)
The last GET request then fails our auth check because it does not include credentials.
To Reproduce
- Connect to a https SSE server that requires auth cookies (make the cookies SameSite=Lax, Secure, HttpOnly)
- The server must be on a domain other than localhost
- During the connection you will notice the GET request with header Accept: "text/eventstream" does not include cookies
Expected behavior
The same requestInit parameters/options must always be used on all requests.
Additional context
the _startOrAuthSSE
function does not include the requestInit structure when calling fetch:
typescript-sdk/src/client/streamableHttp.ts
Line 210 in 3bc2235
const response = await (this._fetch ?? fetch)(this._url, { |
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working