No description
  • Go 97.1%
  • Dockerfile 2.1%
  • Makefile 0.8%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Djordje Lukic 7869d997af
Make the list of allowed URIs configurable (#7)
Signed-off-by: Djordje Lukic <djordje.lukic@docker.com>
2026-06-08 14:15:46 -07:00
.github bugfix: OAuth Discovery Robustness, Logging, and Test Coverage (#1) 2025-10-15 10:38:32 -07:00
.golangci.yml init 2025-09-24 19:46:24 -07:00
dcr.go Make the list of allowed URIs configurable (#7) 2026-06-08 14:15:46 -07:00
dcr_test.go Make the list of allowed URIs configurable (#7) 2026-06-08 14:15:46 -07:00
discovery.go Fix well-known URL construction when issuer contains a path according to spec: (RFC 8414) (#5) 2026-01-12 15:51:03 -08:00
discovery_test.go Fix well-known URL construction when issuer contains a path according to spec: (RFC 8414) (#5) 2026-01-12 15:51:03 -08:00
Dockerfile init 2025-09-24 19:46:24 -07:00
go.mod init 2025-09-24 19:46:24 -07:00
LICENSE Initial commit 2025-09-24 19:41:50 -07:00
log.go bugfix: OAuth Discovery Robustness, Logging, and Test Coverage (#1) 2025-10-15 10:38:32 -07:00
Makefile init 2025-09-24 19:46:24 -07:00
README.md Make the list of allowed URIs configurable (#7) 2026-06-08 14:15:46 -07:00
testutil.go bugfix: OAuth Discovery Robustness, Logging, and Test Coverage (#1) 2025-10-15 10:38:32 -07:00
types.go init 2025-09-24 19:46:24 -07:00
www_authenticate.go bugfix: OAuth Discovery Robustness, Logging, and Test Coverage (#1) 2025-10-15 10:38:32 -07:00
www_authenticate_test.go bugfix: OAuth Discovery Robustness, Logging, and Test Coverage (#1) 2025-10-15 10:38:32 -07:00

MCP Gateway OAuth Helpers

Library containing OAuth Dynamic Client Registration (DCR) functionality for MCP servers.

Note: This code was extracted from MCP Gateway PR: https://github.com/docker/mcp-gateway/pull/148

Purpose

This library provides the core OAuth/DCR functions for MCP Gateway:

  • OAuth Discovery: Discover OAuth requirements from MCP servers (RFC 9728 + 8414)
  • Dynamic Client Registration: Register OAuth clients automatically (RFC 7591)
  • WWW-Authenticate Parsing: Parse OAuth challenge headers

Configuring redirect URI validation

By default DCR only accepts redirect URI hosts for localhost, mcp.docker.com, and mcp-stage.docker.com. Use PerformDCRWithConfig to provide a custom allowlist:

allowedHosts := append(oauth.DefaultAllowedRedirectURIHosts(), "oauth.example.com")
creds, err := oauth.PerformDCRWithConfig(ctx, discovery, "my-server", oauth.DCRConfig{
    RedirectURI:             "https://oauth.example.com/callback",
    AllowedRedirectURIHosts: allowedHosts,
})