mirror of
https://github.com/open-webui/open-webui.git
synced 2026-07-17 08:21:12 -05:00
[GH-ISSUE #23749] perf: MCP tool server reconnects on every message causing 15-20s silent delay #35588
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?
Originally created by @DSavaliya-gh on GitHub (Apr 15, 2026).
Original GitHub issue: https://github.com/open-webui/open-webui/issues/23749
Bug Description
When an MCP (Model Context Protocol) tool server is enabled in Open WebUI, every chat message triggers a full MCP connection lifecycle from scratch:
MCPClient()— new instanceconnect()— TCP → TLS → HTTP session → MCPinitialize()handshake (10 s timeout)list_tool_specs()— fulllist_tools()round-tripThis happens before the model is ever called, and no status event is emitted to the frontend during this phase. The user sees a blinking dot for 15–20 seconds with zero feedback, followed by the model thinking phase.
Steps to Reproduce
Expected Behavior
Actual Behavior
Analysis
In
backend/open_webui/utils/middleware.py, the block insideprocess_chat_payloadthat handlestool_idsstarting withserver:mcp:does:No
event_emittercall is made before this block. The two fixes needed are:type: 'status'withaction: 'mcp_connect'before and after the handshake so the user sees progressMCPClientsession from a previous request instead of reconnecting every timeEnvironment
dev/mcp)Linked PR
A fix is ready at: https://github.com/DSavaliya-gh/open-webui/tree/fix/mcp-connection-pool-status-events
@Classic298 commented on GitHub (Apr 15, 2026):
STOP OPENING / SPAMMING THE ISSUES SECTION