Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions packages/client/src/client/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1439,6 +1439,10 @@ export async function executeTokenRequest(
applyClientAuthentication(authMethod, clientInformation as OAuthClientInformation, headers, tokenRequestParams);
}

// Ensure Content-Type is always form-urlencoded for the token endpoint (OAuth 2.1 §3.2).
// Some addClientAuthentication implementations may have inadvertently set a different value.
headers.set('Content-Type', 'application/x-www-form-urlencoded');

const response = await (fetchFn ?? fetch)(tokenUrl, {
method: 'POST',
headers,
Expand Down
4 changes: 4 additions & 0 deletions packages/server/src/server/streamableHttp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,7 @@ export class WebStandardStreamableHTTPServerTransport implements Transport {
private _requestResponseMap: Map<RequestId, JSONRPCMessage> = new Map();
private _initialized: boolean = false;
private _enableJsonResponse: boolean = false;
private _closed: boolean = false;
private _standaloneSseStreamId: string = '_GET_stream';
private _eventStore?: EventStore;
private _onsessioninitialized?: (sessionId: string) => void | Promise<void>;
Expand Down Expand Up @@ -900,6 +901,9 @@ export class WebStandardStreamableHTTPServerTransport implements Transport {
}

async close(): Promise<void> {
if (this._closed) return;
this._closed = true;

// Close all SSE connections
for (const { cleanup } of this._streamMapping.values()) {
cleanup();
Expand Down
Loading