[PR #24141] [CLOSED] fix: apply OAUTH_TIMEOUT to MCP tool server OAuth 2.1 path #66375

Closed
opened 2026-05-06 12:43:09 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/open-webui/open-webui/pull/24141
Author: @SymbolStar
Created: 4/26/2026
Status: Closed

Base: mainHead: fix/mcp-oauth-timeout


📝 Commits (1)

  • 7a6b336 fix: apply OAUTH_TIMEOUT to MCP tool server OAuth 2.1 path (#24138)

📊 Changes

1 file changed (+2 additions, -0 deletions)

View changed files

📝 backend/open_webui/utils/oauth.py (+2 -0)

📄 Description

Summary

Fixes #24138OAUTH_TIMEOUT has no effect on the MCP tool server OAuth 2.1 path, causing httpx.ReadTimeout for token endpoints that respond in >5 seconds.

Root Cause

PR #15366 added OAUTH_TIMEOUT to OIDC SSO login flows in config.py, but the MCP tool server OAuth 2.1 path in oauth.py's add_client() was not updated. The client_kwargs dict is built without reading OAUTH_TIMEOUT, so the default httpx timeout (5s) applies regardless of the env var.

Fix

Import OAUTH_TIMEOUT from config and apply the same timeout pattern used in all OIDC client_kwargs entries:

'client_kwargs': {
    'follow_redirects': True,
    **({'timeout': int(OAUTH_TIMEOUT.value)} if OAUTH_TIMEOUT.value else {}),
    ...
}

Testing

  • MCP tool server with slow token endpoint (~5.7s) + OAUTH_TIMEOUT=60 → succeeds
  • No OAUTH_TIMEOUT set → default httpx timeout applies (unchanged behavior)
  • OIDC SSO path → unchanged

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/open-webui/open-webui/pull/24141 **Author:** [@SymbolStar](https://github.com/SymbolStar) **Created:** 4/26/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `fix/mcp-oauth-timeout` --- ### 📝 Commits (1) - [`7a6b336`](https://github.com/open-webui/open-webui/commit/7a6b336020aee86bc1409e0c4142ba4e0e57e8d2) fix: apply OAUTH_TIMEOUT to MCP tool server OAuth 2.1 path (#24138) ### 📊 Changes **1 file changed** (+2 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `backend/open_webui/utils/oauth.py` (+2 -0) </details> ### 📄 Description ## Summary Fixes #24138 — `OAUTH_TIMEOUT` has no effect on the MCP tool server OAuth 2.1 path, causing `httpx.ReadTimeout` for token endpoints that respond in >5 seconds. ## Root Cause PR #15366 added `OAUTH_TIMEOUT` to OIDC SSO login flows in `config.py`, but the MCP tool server OAuth 2.1 path in `oauth.py`'s `add_client()` was not updated. The `client_kwargs` dict is built without reading `OAUTH_TIMEOUT`, so the default httpx timeout (5s) applies regardless of the env var. ## Fix Import `OAUTH_TIMEOUT` from `config` and apply the same timeout pattern used in all OIDC `client_kwargs` entries: ```python 'client_kwargs': { 'follow_redirects': True, **({'timeout': int(OAUTH_TIMEOUT.value)} if OAUTH_TIMEOUT.value else {}), ... } ``` ## Testing - MCP tool server with slow token endpoint (~5.7s) + `OAUTH_TIMEOUT=60` → succeeds ✅ - No `OAUTH_TIMEOUT` set → default httpx timeout applies (unchanged behavior) ✅ - OIDC SSO path → unchanged ✅ --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-05-06 12:43:09 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/open-webui#66375