feat: MCP OAuth flow should open the original chat where you enabled the tool #6661

Closed
opened 2025-11-11 17:02:43 -06:00 by GiteaMirror · 0 comments
Owner

Originally created by @schveiguy on GitHub (Oct 12, 2025).

Check Existing Issues

  • I have searched the existing issues and discussions.

Problem Description

When enabling an MCP tool with OAuth 2.1 flow, the original chat window is replaced with the authentication url.

Once the auth url completes the authentication, the window is redirected back to the callback, which then just opens the default page without anything selected (including the tool). This also pops up the changelog for me.

Then I have to set up a new chat and enable the tool. This time the connection is authenticated, so the switch turns green.

Desired Solution you'd like

A better experience would be to pick up where the chat left off when the switch was clicked, but with the switch enabled. The fact that an OAuth occurred should be transparent to the chat flow.

Alternatives Considered

None

Additional Context

The code which initiates the oauth: 46ae3f4f5d/src/lib/components/chat/MessageInput/IntegrationsMenu.svelte (L341)

The code which handles the callback on the backend: 46ae3f4f5d/backend/open_webui/utils/oauth.py (L636)

I feel the right way to handle this is to use the state parameter in oauth flow to communicate the chat id being run, and return to that chat id. May also want to save any text that has been typed into the input field.

Originally created by @schveiguy on GitHub (Oct 12, 2025). ### Check Existing Issues - [x] I have searched the existing issues and discussions. ### Problem Description When enabling an MCP tool with OAuth 2.1 flow, the original chat window is replaced with the authentication url. Once the auth url completes the authentication, the window is redirected back to the callback, which then just opens the default page without anything selected (including the tool). This also pops up the changelog for me. Then I have to set up a new chat and enable the tool. This time the connection is authenticated, so the switch turns green. ### Desired Solution you'd like A better experience would be to pick up where the chat left off when the switch was clicked, but with the switch enabled. The fact that an OAuth occurred should be transparent to the chat flow. ### Alternatives Considered None ### Additional Context The code which initiates the oauth: https://github.com/open-webui/open-webui/blob/46ae3f4f5d7d4d706041bdae4ad2d802e568712b/src/lib/components/chat/MessageInput/IntegrationsMenu.svelte#L341 The code which handles the callback on the backend: https://github.com/open-webui/open-webui/blob/46ae3f4f5d7d4d706041bdae4ad2d802e568712b/backend/open_webui/utils/oauth.py#L636 I feel the right way to handle this is to use the `state` parameter in oauth flow to communicate the chat id being run, and return to that chat id. May also want to save any text that has been typed into the input field.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/open-webui#6661