mirror of
https://github.com/open-webui/open-webui.git
synced 2026-05-06 10:58:17 -05:00
[PR #19796] [CLOSED] fix: MCP OAuth discovery via Protected Resource metadata flow #64204
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/open-webui/open-webui/pull/19796
Author: @jamie-dit
Created: 12/7/2025
Status: ❌ Closed
Base:
dev← Head:fix/mcp-oauth-protected-resource-discovery-v2📝 Commits (7)
fe6783cMerge pull request #19030 from open-webui/devfc05e0aMerge pull request #19405 from open-webui/deve3faec6Merge pull request #19416 from open-webui/dev9899293Merge pull request #19448 from open-webui/dev140605eMerge pull request #19462 from open-webui/dev6f1486fMerge pull request #19466 from open-webui/devb766a23fix: MCP OAuth discovery via Protected Resource metadata flow📊 Changes
1 file changed (+77 additions, -2 deletions)
View changed files
📝
backend/open_webui/utils/oauth.py(+77 -2)📄 Description
Summary
This PR fixes MCP OAuth 2.1 client registration failing when the OAuth authorization server is on a different domain than the MCP server (e.g., Todoist MCP at
ai.todoist.netwith OAuth attodoist.com).Problem
Currently, Open WebUI only looks for OAuth metadata at:
But according to the MCP Authorization spec, clients should follow the Protected Resource discovery flow when the OAuth server is on a different domain.
Solution
Implements the full MCP Protected Resource discovery flow:
WWW-Authenticateheaderresource_metadataURL from the headerauthorization_serversarrayExample flow for Todoist:
Changes
discover_authorization_server_from_mcp()function that implements the Protected Resource discovery flowget_oauth_client_info_with_dynamic_client_registration()to:Backwards Compatibility
The fix is fully backwards-compatible. If Protected Resource discovery fails (no
WWW-Authenticateheader, network error, etc.), it falls back to the existing discovery behavior.Pull Request Checklist
devTesting
✅ I have personally tested ALL changes in this PR
How I tested it:
https://ai.todoist.net/mcpVerification of discovery flow:
Related Issues
Fixes #19794
Contributor License Agreement
By submitting this pull request, I confirm that I have read and fully agree to the Contributor License Agreement (CLA), and I am providing my contributions under its terms.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.