Skip to content

feat(mcp): support custom OAuth callbackRedirectURL for remote toolsets#2494

Merged
dgageot merged 1 commit intodocker:mainfrom
dgageot:oauth-indirection
Apr 22, 2026
Merged

feat(mcp): support custom OAuth callbackRedirectURL for remote toolsets#2494
dgageot merged 1 commit intodocker:mainfrom
dgageot:oauth-indirection

Conversation

@dgageot
Copy link
Copy Markdown
Member

@dgageot dgageot commented Apr 22, 2026

Add an optional callbackRedirectURL field to the remote MCP OAuth config. When set, it is advertised to the authorization server as the OAuth redirect_uri instead of the default http://127.0.0.1:{callbackPort}/callback. The literal placeholder ${callbackPort} is substituted with the actual port the local callback server is listening on.

This lets users put a public-facing proxy (HTTPS or pre-registered static redirect) in front of the local loopback callback, working around auth servers that refuse http://localhost redirect URIs. The local callback server still listens on 127.0.0.1:{callbackPort}; only the advertised redirect URI changes.

Validation:

  • URL must be absolute (scheme + host) once ${callbackPort} is substituted.
  • Scheme must be http or https; other schemes (javascript:, file:, ftp:, …) are rejected.
  • http is only allowed on loopback hosts (127.0.0.1, ::1, localhost); non-loopback http would expose the authorization code on the wire (RFC 8252 §7.3).

Includes JSON schema + docs update, a runnable example, and unit tests for validation and the pure buildRedirectURI substitution helper.

Assisted-By: docker-agent

Add an optional `callbackRedirectURL` field to the remote MCP OAuth config.
When set, it is advertised to the authorization server as the OAuth
`redirect_uri` instead of the default `http://127.0.0.1:{callbackPort}/callback`.
The literal placeholder `${callbackPort}` is substituted with the actual
port the local callback server is listening on.

This lets users put a public-facing proxy (HTTPS or pre-registered static
redirect) in front of the local loopback callback, working around auth
servers that refuse http://localhost redirect URIs. The local callback
server still listens on 127.0.0.1:{callbackPort}; only the advertised
redirect URI changes.

Validation:
- URL must be absolute (scheme + host) once ${callbackPort} is substituted.
- Scheme must be http or https; other schemes (javascript:, file:, ftp:, …) are rejected.
- http is only allowed on loopback hosts (127.0.0.1, ::1, localhost); non-loopback http would expose the authorization code on the wire (RFC 8252 §7.3).

Includes JSON schema + docs update, a runnable example, and unit tests for
validation and the pure buildRedirectURI substitution helper.

Assisted-By: docker-agent
@dgageot dgageot requested a review from a team as a code owner April 22, 2026 14:30
@dgageot dgageot merged commit 20c711b into docker:main Apr 22, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants