Fix CE mode OAuth to use localhost redirect for unregistered providers#349
Draft
OzairP wants to merge 3 commits into
Draft
Fix CE mode OAuth to use localhost redirect for unregistered providers#349OzairP wants to merge 3 commits into
OzairP wants to merge 3 commits into
Conversation
Add a new constructor that accepts a custom redirect URI parameter. This enables callers to specify localhost callbacks instead of the default mcp.docker.com proxy, which is needed for OAuth providers not registered in Docker's provider registry. The existing NewManager() delegates to the new constructor with the default redirect URI, maintaining backward compatibility.
Fix OAuth authorization for remote MCP servers not registered in Docker's provider registry (e.g., Honeycomb). Problem: CE mode registered DCR clients with mcp.docker.com/oauth/callback as the redirect URI, but Docker's proxy only routes callbacks for pre-registered providers. Unregistered providers like Honeycomb would complete the OAuth consent flow successfully, but the callback routing would fail with 'provider not found'. Solution: - Create the callback server first to get the localhost URL - Register DCR client with localhost redirect URI directly - Only apply CE mode to remote servers (container-based servers like github-official still use Docker Desktop OAuth) This allows any remote MCP server that supports OAuth Discovery (RFC 9728) and Dynamic Client Registration (RFC 7591) to work with the MCP Gateway, regardless of whether it's in Docker's provider registry.
Verify that the new constructor correctly initializes all manager components with the custom redirect URI.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
When using CE mode (
DOCKER_MCP_USE_CE=true) to authorize remote MCP servers not in Docker's provider registry (e.g., Honeycomb), OAuth fails with "provider not found" after completing consent.Root cause: CE mode registered DCR clients with
mcp.docker.com/oauth/callback, but Docker's proxy only routes callbacks for pre-registered providers.Solution
Changes
pkg/oauth/manager.go: AddNewManagerWithRedirectURI()constructorcmd/docker-mcp/oauth/auth.go: CE mode uses localhost redirect for remote serverspkg/oauth/manager_test.go: Test for new constructorTesting