mirror of
https://github.com/open-webui/open-webui.git
synced 2026-05-06 19:08:59 -05:00
[PR #19795] [CLOSED] fix: MCP OAuth discovery via Protected Resource metadata flow #40977
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/19795
Author: @jamie-dit
Created: 12/7/2025
Status: ❌ Closed
Base:
main← Head:fix/mcp-oauth-protected-resource-discovery📝 Commits (1)
b766a23fix: 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.Testing
Tested with:
https://ai.todoist.net/mcp) - previously failing, now worksRelated Issues
Fixes #19794
Checklist
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.