mirror of
https://github.com/open-webui/open-webui.git
synced 2026-07-11 10:34:13 -05:00
[PR #18892] [CLOSED] fix: Enhance error handling of mcp server in chat payload processing by emitting error events to the frontend. #48063
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/18892
Author: @mmlmt2604
Created: 11/3/2025
Status: ❌ Closed
Base:
dev← Head:mcp_server_fail_handle📝 Commits (1)
002568eEnhance error handling of mcp server in chat payload processing by emitting error events to the frontend.📊 Changes
1 file changed (+12 additions, -1 deletions)
View changed files
📝
backend/open_webui/utils/middleware.py(+12 -1)📄 Description
Pull Request Checklist
Note to first-time contributors: Please open a discussion post in Discussions and describe your changes before submitting a pull request.
Before submitting, make sure you've checked the following:
devbranch. Not targeting thedevbranch may lead to immediate closure of the PR.Changelog Entry
Description
When an MCP server connection fails (e.g., server not found, 401 unauthorized, network error), the exception is caught but not surfaced to the user. The chat request continues without MCP tools, producing a response that appears normal. Users have no indication that MCP tools were unavailable, which is misleading.
Root cause:
Connection exceptions are caught during MCP initialization, logged at debug level, and execution continues silently. No error is emitted to the frontend, so users don't know MCP tools were skipped.
Solution:
Emit error events to the frontend when MCP connection fails, following the existing error handling pattern. Users are notified via chat error messages when MCP servers fail to connect, providing visibility into tool availability.
Added
Changed
process_chat_payload()to emit error events when MCP connection failsDeprecated
Removed
Fixed
Security
Breaking Changes
Additional Information
Screenshots or Videos
Contributor License Agreement
By submitting this pull request, I confirm that I have read and fully agree to the Contributor License Agreement (CLA), and I am providing my contributions under its terms.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.