Skip to content

refresh token if necessary when starting a connection #612

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant