ProtectedResourceMetadata implements JsonSerializable
FinalYes
OAuth 2.0 Protected Resource Metadata (RFC 9728).
The resource identifier is the canonical URI of the MCP server. It decides
where the metadata is served — /.well-known/oauth-protected-resource
followed by the resource's path and query (RFC 9728, Section 3.1) — and which URL the
WWW-Authenticate challenge points clients to.
Tags
Table of Contents
Interfaces
- JsonSerializable
Constants
- WELL_KNOWN_PATH : mixed = '/.well-known/oauth-protected-resource'
Properties
- $authorizationServers : array<int, string>
- $metadataPath : string
- $metadataUrl : string
- $resource : string
- $resourceDocumentation : string|null
- $resourceName : string|null
- $scopesSupported : array<int, string>|null
Methods
- __construct() : mixed
- getMetadataPath() : string
- Path the metadata document is served at; a query of the resource is kept in {@see self::getMetadataUrl()}.
- getMetadataUrl() : string
- Absolute URL of the metadata document, as advertised in `WWW-Authenticate`.
- getResource() : string
- getScopesSupported() : array<int, string>|null
- jsonSerialize() : array<string, mixed>
Constants
WELL_KNOWN_PATH
private
mixed
WELL_KNOWN_PATH
= '/.well-known/oauth-protected-resource'
Properties
$authorizationServers read-only
private
array<int, string>
$authorizationServers
$metadataPath read-only
private
string
$metadataPath
$metadataUrl read-only
private
string
$metadataUrl
$resource read-only
private
string
$resource
$resourceDocumentation read-only
private
string|null
$resourceDocumentation
= null
$resourceName read-only
private
string|null
$resourceName
= null
$scopesSupported read-only
private
array<int, string>|null
$scopesSupported
Methods
__construct()
public
__construct(string $resource, array<int, string> $authorizationServers[, array<int, string>|null $scopesSupported = null ][, string|null $resourceName = null ][, string|null $resourceDocumentation = null ]) : mixed
Parameters
- $resource : string
-
canonical URI of the MCP server, e.g.
https://mcp.example.com/mcp - $authorizationServers : array<int, string>
-
issuer identifiers of the authorization servers that issue tokens for it
- $scopesSupported : array<int, string>|null = null
-
minimal scopes for basic functionality
- $resourceName : string|null = null
- $resourceDocumentation : string|null = null
getMetadataPath()
Path the metadata document is served at; a query of the resource is kept in {@see self::getMetadataUrl()}.
public
getMetadataPath() : string
Return values
stringgetMetadataUrl()
Absolute URL of the metadata document, as advertised in `WWW-Authenticate`.
public
getMetadataUrl() : string
Return values
stringgetResource()
public
getResource() : string
Return values
stringgetScopesSupported()
public
getScopesSupported() : array<int, string>|null
Return values
array<int, string>|nulljsonSerialize()
public
jsonSerialize() : array<string, mixed>