oauth: fix redirect_uri in CE mode for local callback#366
Open
Pnkcaht wants to merge 1 commit intodocker:mainfrom
Open
oauth: fix redirect_uri in CE mode for local callback#366Pnkcaht wants to merge 1 commit intodocker:mainfrom
Pnkcaht wants to merge 1 commit intodocker:mainfrom
Conversation
Signed-off-by: pnkcaht <samzoovsk19@gmail.com>
7 tasks
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.
What I did
Updated the MCP Gateway authentication and OAuth handling to correctly support local Community Edition (CE) usage without forcing OAuth redirects.
The gateway now behaves correctly when running locally in HTTP mode, ensuring that authentication and request handling work as expected without requiring Docker Desktop–specific OAuth flows.
This allows the MCP Gateway to be tested and used locally in CE environments without unexpected redirects or blocked requests.
Related issue
Fixed #347
What was the problem?
When running the MCP Gateway locally (Community Edition, HTTP transport), the gateway behavior was inconsistent with expected CE usage.
Specifically:
The gateway was tightly coupled to OAuth / Desktop assumptions
Local HTTP runs could trigger incorrect OAuth-related behavior
This made it difficult or impossible to:
As a result:
How this change fixes it
The gateway logic was updated to ensure safe and correct behavior in local HTTP mode, without forcing OAuth redirects or Desktop-only assumptions.
Specifically:
This preserves security guarantees while restoring a clean local developer experience.
Before / After (Summary)
Before
After
Screenshot (Test)
Local MCP Gateway running in CE (HTTP transport)
This screenshot shows the MCP Gateway successfully built and executed locally in Community Edition using the HTTP transport.
Steps demonstrated:
This confirms that:
Normalize tool arguments for evaluation
MCP tool arguments can arrive either as already-decoded map[string]any or as raw JSON ([]byte / json.RawMessage), depending on the transport.
This block normalizes all cases into a single map[string]any, decoding JSON when needed and failing safely when input is missing or malformed, preventing arguments from being silently dropped or causing runtime panics.
Select OAuth redirect URI based on runtime mode
This logic switches the OAuth redirect URI when running in CE mode, ensuring the callback is handled by the local mcp-gateway instead of Docker SaaS.
A custom redirect can be provided via DOCKER_MCP_OAUTH_REDIRECT_URI, otherwise a safe local default is used.
Forward tool arguments without coercion
This handler forwards MCP tool arguments as raw JSON without unmarshalling, keeping the gateway schema-agnostic and preserving full input fidelity for tools that expect structured or typed data.
Preserve raw tool arguments
Converts CallToolParamsRaw to CallToolParams while forwarding arguments as raw JSON, avoiding schema interpretation by the gateway and ensuring full fidelity for typed and schema-driven tools, as expected by the MCP Go SDK.