[PR #24815] [CLOSED] [JAWA-1228] fix: interpolate template vars in MCP connection headers #131532

Closed
opened 2026-05-21 17:08:47 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/open-webui/open-webui/pull/24815
Author: @JawafdehiBot
Created: 5/16/2026
Status: Closed

Base: mainHead: fix/mcp-header-interpolation-JAWA-1228


📝 Commits (1)

  • fe6c257 fix: 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. This PR fixes that by using get_custom_headers() (same pattern used by tools.py for OpenAPI tool servers) to interpolate template variables before applying connection headers.

Changes

  • backend/open_webui/utils/middleware.py: Import get_custom_headers and use it to process MCP connection headers instead of raw assignment

Rollback

Revert commit fe6c257db on the fix/mcp-header-interpolation-JAWA-1228 branch. The change is trivially reversible.


🔄 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/24815 **Author:** [@JawafdehiBot](https://github.com/JawafdehiBot) **Created:** 5/16/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `fix/mcp-header-interpolation-JAWA-1228` --- ### 📝 Commits (1) - [`fe6c257`](https://github.com/open-webui/open-webui/commit/fe6c257db9fc05fcfd93aa98d528bf26e65cd9a6) fix: interpolate template vars in MCP connection headers ### 📊 Changes **1 file changed** (+3 additions, -3 deletions) <details> <summary>View changed files</summary> 📝 `backend/open_webui/utils/middleware.py` (+3 -3) </details> ### 📄 Description ## Summary MCP connection headers containing template variables ({{USER_ID}}, {{USER_NAME}}, {{CHAT_ID}}, {{MESSAGE_ID}}) were being sent literally to MCP servers. This PR fixes that by using `get_custom_headers()` (same pattern used by tools.py for OpenAPI tool servers) to interpolate template variables before applying connection headers. ## Changes - `backend/open_webui/utils/middleware.py`: Import `get_custom_headers` and use it to process MCP connection headers instead of raw assignment ## Related - Originating issue: [/JAWA/issues/JAWA-1228](/JAWA/issues/JAWA-1228) - Paperclip-Run-Id: 99315b6b-3d0a-41cf-be52-f30aeaf5b387 ## Rollback Revert commit `fe6c257db` on the `fix/mcp-header-interpolation-JAWA-1228` branch. The change is trivially reversible. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-05-21 17:08:47 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/open-webui#131532