🔐 fix: Respect Server's Token Endpoint Auth Methods for MCP OAuth Refresh (#9717)

* fix: respect server's token endpoint auth methods for MCP OAuth refresh

Previously, LibreChat always used Basic Auth when refreshing OAuth tokens if a
client_secret was present. This caused issues with servers (like FastMCP) that
only support client_secret_post. Now properly checks and respects the server's
advertised token_endpoint_auth_methods_supported.

Fixes token refresh failures with error: "refresh_token.client_id: Field required"

* chore: remove MCP OAuth URL Logging
This commit is contained in:
Danny Avila 2025-09-19 06:50:02 -04:00 committed by GitHub
parent e5d2a932bc
commit 344e7c44b5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 503 additions and 13 deletions

View file

@ -44,7 +44,7 @@ async function reinitMCPServer({
const oauthStart =
_oauthStart ??
(async (authURL) => {
logger.info(`[MCP Reinitialize] OAuth URL received: ${authURL}`);
logger.info(`[MCP Reinitialize] OAuth URL received for ${serverName}`);
oauthUrl = authURL;
oauthRequired = true;
});