Skip to content
Closed
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
13 changes: 7 additions & 6 deletions packages/server/src/server/mcp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import type {
ListResourcesResult,
ListToolsResult,
LoggingMessageNotification,
NotificationOptions,
Prompt,
PromptReference,
ReadResourceResult,
Expand Down Expand Up @@ -973,27 +974,27 @@ export class McpServer {
/**
* Sends a resource list changed event to the client, if connected.
*/
sendResourceListChanged() {
sendResourceListChanged(options?: NotificationOptions) {
if (this.isConnected()) {
this.server.sendResourceListChanged();
this.server.sendResourceListChanged(options);
}
}

/**
* Sends a tool list changed event to the client, if connected.
*/
sendToolListChanged() {
sendToolListChanged(options?: NotificationOptions) {
if (this.isConnected()) {
this.server.sendToolListChanged();
this.server.sendToolListChanged(options);
}
}

/**
* Sends a prompt list changed event to the client, if connected.
*/
sendPromptListChanged() {
sendPromptListChanged(options?: NotificationOptions) {
if (this.isConnected()) {
this.server.sendPromptListChanged();
this.server.sendPromptListChanged(options);
}
}
}
Expand Down
12 changes: 6 additions & 6 deletions packages/server/src/server/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -660,17 +660,17 @@ export class Server extends Protocol<ServerContext> {
});
}

async sendResourceListChanged() {
async sendResourceListChanged(options?: NotificationOptions) {
return this.notification({
method: 'notifications/resources/list_changed'
});
}, options);
}

async sendToolListChanged() {
return this.notification({ method: 'notifications/tools/list_changed' });
async sendToolListChanged(options?: NotificationOptions) {
return this.notification({ method: 'notifications/tools/list_changed' }, options);
}

async sendPromptListChanged() {
return this.notification({ method: 'notifications/prompts/list_changed' });
async sendPromptListChanged(options?: NotificationOptions) {
return this.notification({ method: 'notifications/prompts/list_changed' }, options);
}
}
Loading