fix(mcp): start OAuth when initialize succeeds without tokens#36352
Open
Epochex wants to merge 1 commit into
Open
fix(mcp): start OAuth when initialize succeeds without tokens#36352Epochex wants to merge 1 commit into
Epochex wants to merge 1 commit into
Conversation
Author
|
Actions checks haven’t started for this fork PR yet (workflow runs show “Action required”). I ran the focused checks locally and they pass:
Could a maintainer please approve/run the workflows so CI can execute? |
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.
What
Fix MCP OAuth authorization flow for servers that return
200 OKoninitializeeven when no tokens are present.Today
ToolMCPAuthApimarks the provider asauthed=trueas soon as it can connect, which breaks OAuth-protected servers like Google Drive MCP:initializesucceeds, but later tool calls fail because no access token was ever obtained.How
After a successful connect, if the provider has
client_informationconfigured but still has no tokens, start the OAuth flow viacore.mcp.auth.auth_flow.auth()and return theauthorization_urlresponse instead of savingauthed=true.Tests
uv run --project api pytest -q api/tests/unit_tests/controllers/console/workspace/test_tool_providers.py -k mcp_authuv run --project api ruff check api/controllers/console/workspace/tool_providers.py api/tests/unit_tests/controllers/console/workspace/test_tool_providers.pyFixes #36230