I have searched the existing issues and discussions.
I am using the latest version of Open WebUI.
Open WebUI Version
0.9.2 (latest as of April 2026)
Installation Method
Docker
Description
PR #15366 added OAUTH_TIMEOUT to fix httpx.ReadTimeout for OIDC SSO login flows. However, the fix was not applied to the MCP tool server OAuth 2.1 path. The add_client() function in oauth.py (used for MCP tool connections) still has a hardcoded default httpx timeout with no env var override.
Expected Behavior
OAUTH_TIMEOUT should control the timeout for all OAuth flows, including MCP tool server OAuth 2.1 token exchanges.
Actual Behavior
When connecting an MCP tool server that uses OAuth 2.1 (e.g. Lucid: https://mcp.lucid.app/mcp), the token endpoint at https://mcp.lucid.app/oauth/token takes ~5.71 seconds to respond. The default httpx timeout of 5 seconds causes the callback to fail:
Setting OAUTH_TIMEOUT=60 in the environment has no effect on the MCP path — confirmed by inspecting the source: OAUTH_TIMEOUT has 0 references in add_client() in v0.9.2.
Root Cause
In backend/open_webui/utils/oauth.py, the add_client() method builds client_kwargs without reading OAUTH_TIMEOUT:
'client_kwargs':{'follow_redirects':True,# OAUTH_TIMEOUT is NOT applied here — unlike the OIDC path fixed by #15366},
Workaround
Manually adding 'timeout': 60.0 to client_kwargs in add_client() resolves the issue.
Suggested Fix
Apply OAUTH_TIMEOUT to the client_kwargs in add_client(), consistent with how #15366 fixed the OIDC path:
Related PR: #15366 (fixed OIDC SSO path but missed the MCP add_client() path in the same file)
Token endpoint latency confirmed at ~5.71s from container via direct httpx test
OAUTH_TIMEOUT=60 env var has 0 references in add_client() — it has no effect on the MCP OAuth path
Originally created by @dennis-vanstrien on GitHub (Apr 25, 2026).
Original GitHub issue: https://github.com/open-webui/open-webui/issues/24138
### Check Existing Issues
I have searched the existing issues and discussions.
I am using the latest version of Open WebUI.
### Open WebUI Version
0.9.2 (latest as of April 2026)
### Installation Method
Docker
### Description
PR #15366 added `OAUTH_TIMEOUT` to fix `httpx.ReadTimeout` for OIDC SSO login flows. However, the fix was **not applied** to the MCP tool server OAuth 2.1 path. The `add_client()` function in `oauth.py` (used for MCP tool connections) still has a hardcoded default httpx timeout with no env var override.
### Expected Behavior
`OAUTH_TIMEOUT` should control the timeout for all OAuth flows, including MCP tool server OAuth 2.1 token exchanges.
### Actual Behavior
When connecting an MCP tool server that uses OAuth 2.1 (e.g. Lucid: `https://mcp.lucid.app/mcp`), the token endpoint at `https://mcp.lucid.app/oauth/token` takes ~5.71 seconds to respond. The default httpx timeout of 5 seconds causes the callback to fail:
```
httpx.ReadTimeout
OAuth callback failed: ReadTimeout
```
Setting `OAUTH_TIMEOUT=60` in the environment has **no effect** on the MCP path — confirmed by inspecting the source: `OAUTH_TIMEOUT` has 0 references in `add_client()` in v0.9.2.
### Root Cause
In `backend/open_webui/utils/oauth.py`, the `add_client()` method builds `client_kwargs` without reading `OAUTH_TIMEOUT`:
```python
'client_kwargs': {
'follow_redirects': True,
# OAUTH_TIMEOUT is NOT applied here — unlike the OIDC path fixed by #15366
},
```
### Workaround
Manually adding `'timeout': 60.0` to `client_kwargs` in `add_client()` resolves the issue.
### Suggested Fix
Apply `OAUTH_TIMEOUT` to the `client_kwargs` in `add_client()`, consistent with how #15366 fixed the OIDC path:
```python
'client_kwargs': {
'follow_redirects': True,
'timeout': OAUTH_TIMEOUT,
},
```
### Steps to Reproduce
1. Add an MCP tool server with OAuth 2.1 auth (e.g. `https://mcp.lucid.app/mcp`)
2. Complete the OAuth authorization flow (login + consent)
3. Observe "OAuth callback failed: ReadTimeout" in the UI
4. Check container logs for `httpx.ReadTimeout` when POSTing to the token endpoint
### Additional Information
- Related issue: #15365
- Related PR: #15366 (fixed OIDC SSO path but missed the MCP `add_client()` path in the same file)
- Token endpoint latency confirmed at ~5.71s from container via direct `httpx` test
- `OAUTH_TIMEOUT=60` env var has 0 references in `add_client()` — it has no effect on the MCP OAuth path
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.
Originally created by @dennis-vanstrien on GitHub (Apr 25, 2026).
Original GitHub issue: https://github.com/open-webui/open-webui/issues/24138
Check Existing Issues
I have searched the existing issues and discussions.
I am using the latest version of Open WebUI.
Open WebUI Version
0.9.2 (latest as of April 2026)
Installation Method
Docker
Description
PR #15366 added
OAUTH_TIMEOUTto fixhttpx.ReadTimeoutfor OIDC SSO login flows. However, the fix was not applied to the MCP tool server OAuth 2.1 path. Theadd_client()function inoauth.py(used for MCP tool connections) still has a hardcoded default httpx timeout with no env var override.Expected Behavior
OAUTH_TIMEOUTshould control the timeout for all OAuth flows, including MCP tool server OAuth 2.1 token exchanges.Actual Behavior
When connecting an MCP tool server that uses OAuth 2.1 (e.g. Lucid:
https://mcp.lucid.app/mcp), the token endpoint athttps://mcp.lucid.app/oauth/tokentakes ~5.71 seconds to respond. The default httpx timeout of 5 seconds causes the callback to fail:Setting
OAUTH_TIMEOUT=60in the environment has no effect on the MCP path — confirmed by inspecting the source:OAUTH_TIMEOUThas 0 references inadd_client()in v0.9.2.Root Cause
In
backend/open_webui/utils/oauth.py, theadd_client()method buildsclient_kwargswithout readingOAUTH_TIMEOUT:Workaround
Manually adding
'timeout': 60.0toclient_kwargsinadd_client()resolves the issue.Suggested Fix
Apply
OAUTH_TIMEOUTto theclient_kwargsinadd_client(), consistent with how #15366 fixed the OIDC path:Steps to Reproduce
https://mcp.lucid.app/mcp)httpx.ReadTimeoutwhen POSTing to the token endpointAdditional Information
add_client()path in the same file)httpxtestOAUTH_TIMEOUT=60env var has 0 references inadd_client()— it has no effect on the MCP OAuth path