mirror of
https://github.com/docker/mcp-gateway-oauth-helpers
synced 2026-07-22 11:13:45 +00:00
No description
- Go 97.1%
- Dockerfile 2.1%
- Makefile 0.8%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
|
|
||
| .github | ||
| .golangci.yml | ||
| dcr.go | ||
| dcr_test.go | ||
| discovery.go | ||
| discovery_test.go | ||
| Dockerfile | ||
| go.mod | ||
| LICENSE | ||
| log.go | ||
| Makefile | ||
| README.md | ||
| testutil.go | ||
| types.go | ||
| www_authenticate.go | ||
| www_authenticate_test.go | ||
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,
})