[GH-ISSUE #115] feat: Support OAuth Authorization #52

Open
opened 2026-10-18 21:10:55 +00:00 by bsakaguchi · 7 comments
Owner

Originally created by @pew on GitHub (May 2, 2025).
Original GitHub issue: https://github.com/open-webui/mcpo/issues/115

Check Existing Issues

  • I have searched the existing issues and discussions.

Problem Description

I tried adding an MCP Server which requires authentication via an OAuth flow to mcpo. When I started the container, it returned this error message and crashed:

| Traceback (most recent call last):
|   File "/app/.venv/lib/python3.11/site-packages/mcp/client/sse.py", line 53, in sse_client
|     event_source.response.raise_for_status()
|   File "/app/.venv/lib/python3.11/site-packages/httpx/_models.py", line 829, in raise_for_status
|     raise HTTPStatusError(message, request=request, response=self)
| httpx.HTTPStatusError: Client error '401 Unauthorized' for url 'https://browser.mcp.cloudflare.com/sse'
| For more information check: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/401
+------------------------------------

This might be related to this question: https://github.com/open-webui/mcpo/issues/19

Desired Solution you'd like

Support OAuth authentication for MCP servers, ideally through the UI when it's been added to the mcpo config.

Alternatives Considered

No response

Additional Context

No response

Originally created by @pew on GitHub (May 2, 2025). Original GitHub issue: https://github.com/open-webui/mcpo/issues/115 ### Check Existing Issues - [x] I have searched the existing issues and discussions. ### Problem Description I tried adding an [MCP Server which requires authentication](https://github.com/cloudflare/mcp-server-cloudflare/tree/main/apps/browser-rendering) via an OAuth flow to mcpo. When I started the container, it returned this error message and crashed: ``` | Traceback (most recent call last): | File "/app/.venv/lib/python3.11/site-packages/mcp/client/sse.py", line 53, in sse_client | event_source.response.raise_for_status() | File "/app/.venv/lib/python3.11/site-packages/httpx/_models.py", line 829, in raise_for_status | raise HTTPStatusError(message, request=request, response=self) | httpx.HTTPStatusError: Client error '401 Unauthorized' for url 'https://browser.mcp.cloudflare.com/sse' | For more information check: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/401 +------------------------------------ ``` This might be related to this question: https://github.com/open-webui/mcpo/issues/19 ### Desired Solution you'd like Support OAuth authentication for MCP servers, ideally through the UI when it's been added to the mcpo config. - https://modelcontextprotocol.io/specification/2025-03-26/basic/authorization - https://support.anthropic.com/en/articles/11175166-about-custom-integrations-using-remote-mcp ### Alternatives Considered _No response_ ### Additional Context _No response_
Author
Owner

@t-j-thomas commented on GitHub (May 14, 2025):

@tjbck Hoping we can start some discussion around this as there has been more & more remote mcp needs. I saw a similar past Issue (https://github.com/open-webui/mcpo/issues/19) where you responded, but I think there was some misunderstanding/missing context.

As of the latest MCP spec (3/26/2025) linked in the above post, remote MCP servers with auth (for ex hosted SaaS mcp like Confluence/Jira) require the MCP client to initiate an Oauth request with the MCP server, which then will redirect the end user (through the user agent/browser) to either their own auth server or delegate to an external auth provider.

Open WebUI (or another UI client) + mcpo does not currently seem to support this, or correct me if I'm mistaken.

Approximate Flow

My understanding is that both the WebUI & mcpo will need some changes to accommodate the new auth flows required by many remote MCP servers:

  • mcpo acting as the MCP client will need to discover the MCP servers' oauth server metadata
  • Somehow mcpo along with Open WebUI will need to redirect the user to the mcp auth URL
  • User authenticates & authorizes & the browser calls the MCP server's /authorize endpoint
  • Browser redirects to auth callback URL in WebUI/mcpo with the new auth token
  • mcpo for all further requests to the MCP server will have to pass the above auth token in the headers
  • WebUI/mcpo manages refresh of mcp oauth token

Alternatives:

  1. One stop-gap/alternative is to hard code the ouath tokens in mcpo config when launching the mcp server. The user may need to manually take care of creating/ updating tokens using other direct Oauth methods. There is an open PR which kind of supports this only for SSE (but not for Streamable HTTP): https://github.com/open-webui/mcpo/pull/103
  2. Instead of the token itself, hard code the OAuth clientID + secret in mcpo & have mcp always call the MCP oauth server with these values to generate the token & refresh when needed. This will prevent the user from needing to update & restart the mcpo proxy every time the token needs to be updated

But neither of these alternatives will allow custom user authorization for non admin users in Open WebUI. An admin could configure one instance of these remote MCP servers perhaps using a company wide shared user or something like that. However, if every user will need their own scoped auth permissions for tools like Jira/Confluence mcp access, this won't be possible. However, I see this being a very useful & important enterprise use case

<!-- gh-comment-id:2881569293 --> @t-j-thomas commented on GitHub (May 14, 2025): @tjbck Hoping we can start some discussion around this as there has been more & more remote mcp needs. I saw a similar past Issue (https://github.com/open-webui/mcpo/issues/19) where you responded, but I think there was some misunderstanding/missing context. As of the latest MCP spec (3/26/2025) linked in the above post, remote MCP servers with auth (for ex hosted SaaS mcp like Confluence/Jira) require the MCP client to initiate an Oauth request with the MCP server, which then will redirect the end user (through the user agent/browser) to either their own auth server or delegate to an external auth provider. Open WebUI (or another UI client) + mcpo does not currently seem to support this, or correct me if I'm mistaken. ### Approximate Flow My understanding is that both the WebUI & mcpo will need some changes to accommodate the new auth flows required by many remote MCP servers: - mcpo acting as the MCP client will need to discover the MCP servers' oauth server metadata - Somehow mcpo along with Open WebUI will need to redirect the user to the mcp auth URL - User authenticates & authorizes & the browser calls the MCP server's `/authorize` endpoint - Browser redirects to auth callback URL in WebUI/mcpo with the new auth token - mcpo for all further requests to the MCP server will have to pass the above auth token in the headers - WebUI/mcpo manages refresh of mcp oauth token ### Alternatives: 1. One stop-gap/alternative is to hard code the ouath tokens in mcpo config when launching the mcp server. The user may need to manually take care of creating/ updating tokens using other direct Oauth methods. There is an open PR which kind of supports this only for SSE (but not for Streamable HTTP): https://github.com/open-webui/mcpo/pull/103 2. Instead of the token itself, hard code the OAuth clientID + secret in mcpo & have mcp always call the MCP oauth server with these values to generate the token & refresh when needed. This will prevent the user from needing to update & restart the mcpo proxy every time the token needs to be updated But neither of these alternatives will allow custom user authorization for non admin users in Open WebUI. An admin could configure one instance of these remote MCP servers perhaps using a company wide shared user or something like that. However, if every user will need their own scoped auth permissions for tools like Jira/Confluence mcp access, this won't be possible. However, I see this being a very useful & important enterprise use case
Author
Owner

@LukeScrewdriver commented on GitHub (May 18, 2025):

@pew I had the same error.
To get around it I used mcp-proxy.

Check issue #72 latest message

<!-- gh-comment-id:2888904854 --> @LukeScrewdriver commented on GitHub (May 18, 2025): @pew I had the same error. To get around it I used mcp-proxy. Check issue #72 latest message
Author
Owner

@tjbck commented on GitHub (Jun 6, 2025):

Custom header support has been added to mcpo with 0.0.15

<!-- gh-comment-id:2949905638 --> @tjbck commented on GitHub (Jun 6, 2025): Custom header support has been added to mcpo with 0.0.15
Author
Owner

@tjbck commented on GitHub (Jun 6, 2025):

@t-j-thomas do we have a screenrecording of implementations for what the workflow you've described?

<!-- gh-comment-id:2949910099 --> @tjbck commented on GitHub (Jun 6, 2025): @t-j-thomas do we have a screenrecording of implementations for what the workflow you've described?
Author
Owner

@JorgeRuizITCL commented on GitHub (Jun 9, 2025):

Custom header support has been added to mcpo with 0.0.15

Hi!

Does this new feature include the injection of the client headers?

Let's say i have an MCP SSE server that has JWT-based auth, and i want my client, Open WEB UI, to use one an api key that connects directly to the server.

Header A:
This Header is generated by OpenWeb UI / Client
{Authorization: Bearer my-secret-key}

And i want the header to be redirected to the MCP Server.

Like: OpenWebUI -> HTTP Req (Header A)-> MCPO -> HTTP SSE Req (Header A) -> MCP Server

Thanks!

<!-- gh-comment-id:2955589198 --> @JorgeRuizITCL commented on GitHub (Jun 9, 2025): > Custom header support has been added to mcpo with 0.0.15 Hi! Does this new feature include the injection of the client headers? Let's say i have an MCP SSE server that has JWT-based auth, and i want my client, Open WEB UI, to use one an api key that connects directly to the server. Header A: This Header is generated by OpenWeb UI / Client {Authorization: Bearer my-secret-key} And i want the header to be redirected to the MCP Server. Like: OpenWebUI -> HTTP Req (Header A)-> MCPO -> HTTP SSE Req (Header A) -> MCP Server Thanks!
Author
Owner

@MBueschelberger commented on GitHub (Jun 22, 2025):

Custom header support has been added to mcpo with 0.0.15

Hi!

Does this new feature include the injection of the client headers?

Let's say i have an MCP SSE server that has JWT-based auth, and i want my client, Open WEB UI, to use one an api key that connects directly to the server.

Header A: This Header is generated by OpenWeb UI / Client {Authorization: Bearer my-secret-key}

And i want the header to be redirected to the MCP Server.

Like: OpenWebUI -> HTTP Req (Header A)-> MCPO -> HTTP SSE Req (Header A) -> MCP Server

Thanks!

@JorgeRuizITCL , I am looking for the same solution but was not successful as well.

I openend an issues here: https://github.com/open-webui/mcpo/issues/182

<!-- gh-comment-id:2994273839 --> @MBueschelberger commented on GitHub (Jun 22, 2025): > > Custom header support has been added to mcpo with 0.0.15 > > Hi! > > Does this new feature include the injection of the client headers? > > Let's say i have an MCP SSE server that has JWT-based auth, and i want my client, Open WEB UI, to use one an api key that connects directly to the server. > > Header A: This Header is generated by OpenWeb UI / Client {Authorization: Bearer my-secret-key} > > And i want the header to be redirected to the MCP Server. > > Like: OpenWebUI -> HTTP Req (Header A)-> MCPO -> HTTP SSE Req (Header A) -> MCP Server > > Thanks! @JorgeRuizITCL , I am looking for the same solution but was not successful as well. I openend an issues here: https://github.com/open-webui/mcpo/issues/182
Author
Owner

@rkconsulting commented on GitHub (Sep 18, 2025):

@JorgeRuizITCL implemented tool-level client header forwarding in this PR: https://github.com/open-webui/mcpo/pull/251

<!-- gh-comment-id:3308640545 --> @rkconsulting commented on GitHub (Sep 18, 2025): @JorgeRuizITCL implemented tool-level client header forwarding in this PR: https://github.com/open-webui/mcpo/pull/251
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
open-webui/mcpo#52
No description provided.