[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 #105639

Closed
opened 2026-05-18 03:40:59 -05:00 by GiteaMirror · 7 comments
Owner

Originally created by @alew3 on GitHub (Oct 24, 2025).
Original GitHub issue: https://github.com/open-webui/open-webui/issues/18586

Check Existing Issues

  • I have searched all existing open AND closed issues and discussions for similar requests. I have found none that is comparable to my request.

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

Originally created by @alew3 on GitHub (Oct 24, 2025). Original GitHub issue: https://github.com/open-webui/open-webui/issues/18586 ### Check Existing Issues - [x] I have searched all existing open AND closed issues and discussions for similar requests. I have found none that is comparable to my request. ### 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_
Author
Owner

@tjbck commented on GitHub (Oct 26, 2025):

You should use token forwarding instead.

<!-- gh-comment-id:3448033664 --> @tjbck commented on GitHub (Oct 26, 2025): You should use token forwarding instead.
Author
Owner

@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.

<!-- gh-comment-id:3448567834 --> @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.
Author
Owner

@Harii75 commented on GitHub (Nov 5, 2025):

@alew3 did you find any solution? im facing the same issue..

<!-- gh-comment-id:3491051531 --> @Harii75 commented on GitHub (Nov 5, 2025): @alew3 did you find any solution? im facing the same issue..
Author
Owner

@alew3 commented on GitHub (Nov 7, 2025):

@Harii75 unfortunately not

<!-- gh-comment-id:3505269677 --> @alew3 commented on GitHub (Nov 7, 2025): @Harii75 unfortunately not
Author
Owner

@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)

<!-- gh-comment-id:3536913920 --> @Yambr commented on GitHub (Nov 15, 2025): [fix_mcp_user_headers.py](https://github.com/user-attachments/files/23564160/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)
Author
Owner

@lgnam commented on GitHub (Dec 16, 2025):

@alew3 I have the same issue, did you find a solution yet?

<!-- gh-comment-id:3660491958 --> @lgnam commented on GitHub (Dec 16, 2025): @alew3 I have the same issue, did you find a solution yet?
Author
Owner

@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?

<!-- gh-comment-id:3718322966 --> @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?
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/open-webui#105639