ExMCP.Authorization.ClientIdMetadata (ex_mcp v0.10.0)
View SourceOAuth Client ID Metadata Document support for MCP authorization.
Implements the OAuth Client ID Metadata Document mechanism where the
client's client_id is a URL that resolves to a JSON document
containing the client's OAuth metadata.
This enables dynamic client registration-like behavior without requiring a registration endpoint.
Available in protocol version 2025-11-25.
Summary
Functions
Builds a client metadata document for this application.
Fetches and parses client metadata from a client_id URL.
Validates client metadata structure.
Types
Functions
@spec build_metadata(keyword()) :: client_metadata()
Builds a client metadata document for this application.
Useful for MCP clients that want to publish their own metadata.
@spec fetch( String.t(), keyword() ) :: {:ok, client_metadata()} | {:error, term()}
Fetches and parses client metadata from a client_id URL.
Parameters
client_id_url- The client_id URL to fetch metadata fromopts- Options including:http_clientfor custom HTTP client
Returns
{:ok, metadata}- Successfully fetched client metadata{:error, reason}- Failed to fetch or parse metadata
@spec validate(client_metadata(), String.t()) :: :ok | {:error, term()}
Validates client metadata structure.
Required Fields
client_id- Must match the URL it was fetched fromclient_name- Human-readable name for the clientredirect_uris- List of allowed redirect URIs
Optional Fields
client_uri- URL of the client's home pagelogo_uri- URL of the client's logoscope- Space-separated list of requested scopescontacts- List of contact emailstos_uri- Terms of service URLpolicy_uri- Privacy policy URL