FastestMCP.Auth.ProtectedResource (fastest_mcp v0.2.0)

Copy Markdown View Source

RFC 9728 Protected Resource Metadata for an HTTP MCP endpoint.

FastestMCP remains a resource server: authorization-server discovery and token validation are application-owned. This value validates the metadata needed by standards-aware MCP clients and constructs the path-derived well-known URI and WWW-Authenticate challenge.

Summary

Functions

Returns whether a request path is this resource's well-known metadata path.

Returns whether an absolute URI is exactly this protected resource.

Returns the RFC 9728 JSON document with string keys.

Returns the RFC 9728 path-derived well-known path.

Returns the absolute URL of the Protected Resource Metadata document.

Builds validated Protected Resource Metadata.

Builds metadata, raising ArgumentError on invalid configuration.

Builds an RFC 9728/RFC 6750 Bearer challenge.

Types

t()

@type t() :: %FastestMCP.Auth.ProtectedResource{
  authorization_details_types_supported: [String.t()] | nil,
  authorization_servers: [String.t()],
  bearer_methods_supported: [String.t()],
  extensions: map(),
  jwks_uri: String.t() | nil,
  required_scopes: [String.t()],
  resource: String.t(),
  resource_documentation: String.t() | nil,
  resource_name: String.t() | nil,
  resource_policy_uri: String.t() | nil,
  resource_signing_alg_values_supported: [String.t()] | nil,
  resource_tos_uri: String.t() | nil,
  scopes_supported: [String.t()] | nil,
  signed_metadata: String.t() | nil,
  tls_client_certificate_bound_access_tokens: boolean() | nil
}

Functions

matches_path?(protected_resource, request_path)

Returns whether a request path is this resource's well-known metadata path.

matches_resource?(protected_resource, candidate)

Returns whether an absolute URI is exactly this protected resource.

metadata(protected_resource)

Returns the RFC 9728 JSON document with string keys.

metadata_path(protected_resource)

Returns the RFC 9728 path-derived well-known path.

metadata_url(protected_resource)

Returns the absolute URL of the Protected Resource Metadata document.

new(opts)

Builds validated Protected Resource Metadata.

new!(opts)

Builds metadata, raising ArgumentError on invalid configuration.

www_authenticate(protected_resource, opts \\ [])

Builds an RFC 9728/RFC 6750 Bearer challenge.