fix(mcp): generate OAuth state on-the-fly during initial connection#16248
Open
jonahsnider wants to merge 1 commit intoanomalyco:devfrom
Open
fix(mcp): generate OAuth state on-the-fly during initial connection#16248jonahsnider wants to merge 1 commit intoanomalyco:devfrom
jonahsnider wants to merge 1 commit intoanomalyco:devfrom
Conversation
Contributor
|
The following comment was made by an LLM, it may be inaccurate: Based on the search results, I found a potentially related PR: Related PR:
The search also returned several other OAuth-related PRs (#11477, #11925, #13085, #9034) but these appear to be feature additions rather than duplicate fixes for the same issue. |
This was referenced Mar 6, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue for this PR
Closes #16247
Type of change
What does this PR do?
When connecting to a remote MCP server requiring OAuth, the SDK's auth flow calls
provider.state()to get the state parameter.This method was throwing when no state had been pre-generated, causing a non-
UnauthorizedErrorthat prevented the server from being recognized as needing auth.The error fell through to the SSE transport fallback, which also failed, resulting in a generic "Non-200 status code" status instead of
needs_auth.How did you verify your code works?
Following the reproduction steps in #16247, you'll see that the TUI properly marks the server as needing authentication, rather than having an SSE transport error:
Screenshots / recordings
N/A - not a UI change
Checklist