mirror of
https://github.com/open-webui/open-webui.git
synced 2026-07-17 17:02:01 -05:00
[PR #24816] [CLOSED] fix: interpolate template vars in MCP connection headers #115177
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/24816
Author: @JawafdehiBot
Created: 5/16/2026
Status: ❌ Closed
Base:
main← Head:upstream/mcp-header-interpolation📝 Commits (1)
e41874afix: interpolate template vars in MCP connection headers📊 Changes
1 file changed (+3 additions, -3 deletions)
View changed files
📝
backend/open_webui/utils/middleware.py(+3 -3)📄 Description
Summary
MCP connection headers containing template variables ({{USER_ID}}, {{USER_NAME}}, {{CHAT_ID}}, {{MESSAGE_ID}}) were being sent literally to MCP servers in
middleware.py. This PR fixes that by usingget_custom_headers()— the same pattern already used bytools.pyfor OpenAPI tool servers — to interpolate template variables before applying connection headers.Changes
backend/open_webui/utils/middleware.py: Importget_custom_headersfromopen_webui.utils.headersand use it to process MCP connection headers instead of raw assignment (3 insertions, 3 deletions)Context
get_custom_headersis already used in:tools.py:343— OpenAPI tool server connectionsopenai.py:218— OpenAI-compatible connectionsconfigs.py:441,486— Config evaluationThis fix adds MCP connections as the missing consumer.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.