MCP PHP SDK

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
see
https://datatracker.ietf.org/doc/html/rfc9728
author

Volodymyr Panivko sveneld300@gmail.com

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

Properties

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
string

getMetadataUrl()

Absolute URL of the metadata document, as advertised in `WWW-Authenticate`.

public getMetadataUrl() : string
Return values
string

getScopesSupported()

public getScopesSupported() : array<int, string>|null
Return values
array<int, string>|null
On this page

Search results