ExMCP.Authorization.ProtectedResourceMetadata (ex_mcp v0.9.2)
View SourceOAuth 2.0 Protected Resource Metadata Discovery (RFC 9728 - Draft).
This module implements the discovery mechanism for protected resources to advertise their authorization server relationships. This allows MCP servers to indicate which authorization servers protect their resources.
Example
# Discover authorization servers for a protected resource
{:ok, metadata} = ProtectedResourceMetadata.discover("https://api.example.com/mcp")
# Use discovered authorization server
[auth_server | _] = metadata.authorization_servers
{:ok, auth_metadata} = Authorization.discover_server_metadata(auth_server.issuer)
Summary
Functions
Discovers protected resource metadata from the resource URL.
Parses WWW-Authenticate header for authorization information.
Types
Functions
Discovers protected resource metadata from the resource URL.
Makes a request to /.well-known/oauth-protected-resource to discover which authorization servers protect this resource.
@spec parse_www_authenticate(String.t()) :: {:ok, www_authenticate_info()} | {:error, term()}
Parses WWW-Authenticate header for authorization information.
Extracts Bearer authentication parameters including realm, as_uri, resource_uri, and error information.