Skip to content

Conversation

rinormaloku
Copy link

@rinormaloku rinormaloku commented Jul 12, 2025

Implements the usage of refresh tokens when a new connection is started.

How to test:

  • You need an MCP server that uses OAuth with access and refresh tokens.
  • Set the expiry low for the access token so that you can test it quickly.
  • Connect first (this will trigger the full MCP Authorization Flow)
  • Wait for the token to expire
  • Refresh the page and connect again

Observe: The new connection will use refresh token to get a new access token (The full OAuth flow won't be required).

This partially addresses the issue: #608.

To fully support it we need to udpate this function to make use of the refresh token, but it proved rather difficult:

https://github.com/modelcontextprotocol/inspector/blob/main/client/src/lib/hooks/useConnection.ts#L106-L167

@rinormaloku
Copy link
Author

@felixweinberger tagging you for visibility

@olaservo olaservo added the auth Issues and PRs related to authorization label Jul 26, 2025
Copy link
Member

@pcarleton pcarleton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hey thanks for putting this together.

this reimplements some features of the typescript sdk, so i'd rather we find a way to leverage those instead of maintaining 2 implementations.

I think the right path forward here is to start including the "InspectorOAuthProvider" on the transport, since that will cause the transport to use the provider to refresh the tokens automatically

@olaservo olaservo added the waiting on submitter Waiting for the submitter to provide more info label Aug 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

auth Issues and PRs related to authorization waiting on submitter Waiting for the submitter to provide more info

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants