Skip to content

Fix cancellation being reported as missing OAuth metadata - #1891

Open
Empiree wants to merge 1 commit into
modelcontextprotocol:mainfrom
Empiree:fix/oauth-metadata-cancellation
Open

Empiree wants to merge 1 commit into
modelcontextprotocol:mainfrom
Empiree:fix/oauth-metadata-cancellation

Conversation

@Empiree

@Empiree Empiree commented Sep 26, 2026

Copy link
Copy Markdown

If CreateAsync is cancelled or InitializationTimeout hits while the client loads auth server metadata, the catch in GetAuthServerMetadataAsync treats it like failed endpoint and tries the next one. So the user gets "Failed to find .well-known/... metadata" instead of OperationCanceledException / TimeoutException.

Now OperationCanceledException is rethrown when our token is cancelled. Other errors (also HttpClient timeout) still go to the next endpoint like before.

Added 2 tests, they fail without the fix.

Related to #1806

This branch has not been deployed

No deployments
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