Allow the token to be refreshed without triggering a reauthentication#936
Allow the token to be refreshed without triggering a reauthentication#936guschnwg wants to merge 3 commits intomodelcontextprotocol:mainfrom
Conversation
|
Thanks for working on this - token refresh is an important missing feature (#665). Apologies for the delay in reviewing; this has been open for a while and we appreciate your patience. The implementation works, but I have a suggestion that would make it cleaner: Consider using the client-side import { refreshAuthorization, discoverAuthorizationServerMetadata } from "@modelcontextprotocol/sdk/client/auth.js";
// Instead of ProxyOAuthServerProvider.exchangeRefreshToken(), use:
const newTokens = await refreshAuthorization(serverUrl, {
metadata: authServerMeta,
clientInformation: clientInfo,
refreshToken: authState.oauthTokens.refresh_token,
});Why?
This isn't blocking - the current approach works. But using the client function would be more aligned with the SDK's intended usage. Let me know if you'd like help with the refactor, or if there's a reason you chose This comment was drafted with assistance from Claude (AI). |
Way better with your suggestion. Updated. Sorry the delay |
Summary
When refreshing the token, it was triggering a reauthentication.
Since clients should use refresh tokens, when available, this feature is a good way to test that our MCP servers don't trigger unnecessary oauth flows.
Gravacao.de.Tela.2025-11-24.as.20.25.58.mov
Closes #665