MCP.OAuth2.Discovery (fnord v0.9.40)
View SourceOAuth2 server discovery and automatic configuration. Implements RFC 8414 Authorization Server Metadata discovery.
Summary
Functions
Discover OAuth2 configuration and set up authentication automatically.
Functions
Discover OAuth2 configuration and set up authentication automatically.
Parameters
- base_url: The MCP server's base URL
- opts: Configuration options
- :client_id - Use an existing client_id and skip dynamic registration
- :client_secret - Client secret (optional)
- :scope - List of scopes to request; if omitted, fnord prefers
mcp:accesswhen the server advertises it and otherwise falls back to the server's supported scopes - :redirect_port - Port to use for the loopback redirect URI; if present, the discovered config carries it forward and dynamic registration uses it for exact callback matching
Returns
{:ok, oauth_config}- Ready-to-use OAuth configuration map{:error, reason}- Discovery or setup failed
OAuth Config Structure
%{
"discovery_url" => String.t(),
"client_id" => String.t(),
"client_secret" => String.t() | nil,
"scopes" => [String.t()]}