mirror of
https://github.com/open-webui/open-webui.git
synced 2026-07-16 14:39:31 -05:00
[GH-ISSUE #18586] feat: Add user/session headers for MCP requests (like ENABLE_FORWARD_USER_INFO_HEADERS) Support forwarding user info headers to MCP endpoints #18644
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 @alew3 on GitHub (Oct 24, 2025).
Original GitHub issue: https://github.com/open-webui/open-webui/issues/18586
Check Existing Issues
Problem Description
Allow OpenWebUI to include user/session identifiers in MCP tool requests — similar to how it forwards user info headers (ENABLE_FORWARD_USER_INFO_HEADERS) for OpenAI-compatible endpoints — so that external MCPs can maintain user-specific memory and state.
Desired Solution you'd like
ENABLE_FORWARD_USER_INFO_HEADERS or another variable should enable forwarding of user data via headers to MCP
Alternatives Considered
No response
Additional Context
No response
@tjbck commented on GitHub (Oct 26, 2025):
You should use token forwarding instead.
@alew3 commented on GitHub (Oct 26, 2025):
@tjbck thanks for the feedback, how does token forwarding work? Searched on google but couldn't find anything.
What I'm trying to achieve is to forward an unique identifier (such as the ChatId) from OpenWebUI to the MCP via http streamable protocol so I can have memory with the same user between many interactions.
@Harii75 commented on GitHub (Nov 5, 2025):
@alew3 did you find any solution? im facing the same issue..
@alew3 commented on GitHub (Nov 7, 2025):
@Harii75 unfortunately not
@Yambr commented on GitHub (Nov 15, 2025):
fix_mcp_user_headers.py
Test Dockerfile для проверки MCP user headers patch
FROM ghcr.io/open-webui/open-webui:main
USER root
Копировать патч
COPY patches/fix_mcp_user_headers.py /tmp/fix_mcp_user_headers.py
Применить патч и показать результат
RUN echo "=== Applying MCP User Headers Patch ===" &&
python /tmp/fix_mcp_user_headers.py &&
echo "" &&
echo "=== Verifying patch was applied ===" &&
grep -A 10 "X-OpenWebUI-User-Name" /app/backend/open_webui/utils/middleware.py || echo "ERROR: Patch not applied!" &&
rm /tmp/fix_mcp_user_headers.py
USER openwebui
Just a little patch for you man. (by Claude Code actually)
@lgnam commented on GitHub (Dec 16, 2025):
@alew3 I have the same issue, did you find a solution yet?
@elad663 commented on GitHub (Jan 7, 2026):
@tjbck the use case I have is passing sso details to the mcp server. I don't think that token forward will work for this use case as the mcp will need to go from token back to identity as various systems will need the actual username and not a token.
maybe this can be revisited?