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#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:
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>
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
📋 Pull Request Information
Original PR: https://github.com/open-webui/open-webui/pull/24141
Author: @SymbolStar
Created: 4/26/2026
Status: ❌ Closed
Base:
main← Head:fix/mcp-oauth-timeout📝 Commits (1)
7a6b336fix: 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 #24138 —
OAUTH_TIMEOUThas no effect on the MCP tool server OAuth 2.1 path, causinghttpx.ReadTimeoutfor token endpoints that respond in >5 seconds.Root Cause
PR #15366 added
OAUTH_TIMEOUTto OIDC SSO login flows inconfig.py, but the MCP tool server OAuth 2.1 path inoauth.py'sadd_client()was not updated. Theclient_kwargsdict is built without readingOAUTH_TIMEOUT, so the default httpx timeout (5s) applies regardless of the env var.Fix
Import
OAUTH_TIMEOUTfromconfigand apply the same timeout pattern used in all OIDCclient_kwargsentries:Testing
OAUTH_TIMEOUT=60→ succeeds ✅OAUTH_TIMEOUTset → default httpx timeout applies (unchanged behavior) ✅🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.