ProtectedResourceMetadata
in package
What {@see Mcp::protectedResourceMetadata()} returns: the RFC 9728 §2 document, the path it is served at, and the URL that path resolves to (CONTRACT.md §28.1).
self::$metadataUrl exists so the guard's resourceMetadataUrl option
(CONTRACT.md §28.5) is fed from the value this class derived rather than retyped —
retyping is how the two come to disagree, and a challenge pointing at a document that
is not this resource server's is worse than no challenge at all.
Table of Contents
Properties
- $document : array<string|int, mixed>
- $metadataPath : string
- $metadataUrl : string
Methods
- __construct() : mixed
Properties
$document read-only
public
array<string|int, mixed>
$document
$metadataPath read-only
public
string
$metadataPath
$metadataUrl read-only
public
string
$metadataUrl
Methods
__construct()
public
__construct(array<string, mixed> $document, string $metadataPath, string $metadataUrl) : mixed
Parameters
- $document : array<string, mixed>
-
The RFC 9728 §2 document, carrying at most the five members CONTRACT.md §28.2 permits, in that fixed order, and no others. Ready to
json_encode()as-is — member order is PHP array insertion order, andjson_encode()preserves it. - $metadataPath : string
-
The absolute path the document is served at, derived from
resourceper CONTRACT.md §28.3 — never chosen. - $metadataUrl : string
-
self::$metadataPath resolved against the resource's scheme and authority. Feed this to the guard's
resourceMetadataUrloption.