MCP PHP SDK

ClientRegistrationMiddleware implements MiddlewareInterface

FinalYes

OAuth 2.0 Dynamic Client Registration (RFC 7591) middleware.

Handles POST /register requests by delegating to a ClientRegistrarInterface and enriches /.well-known/oauth-authorization-server responses with the registration_endpoint.

Table of Contents

Interfaces

MiddlewareInterface

Constants

REGISTRATION_PATH  = '/register'

Properties

$localBaseUrl  : string
$registrar  : ClientRegistrarInterface
$responseFactory  : ResponseFactoryInterface
$streamFactory  : StreamFactoryInterface

Methods

__construct()  : mixed
process()  : ResponseInterface
enrichAuthServerMetadata()  : ResponseInterface
handleRegistration()  : ResponseInterface
jsonResponse()  : ResponseInterface

Constants

Properties

Methods

__construct()

public __construct(ClientRegistrarInterface $registrar, string $localBaseUrl[, ResponseFactoryInterface|null $responseFactory = null ][, StreamFactoryInterface|null $streamFactory = null ]) : mixed
Parameters
$registrar : ClientRegistrarInterface
$localBaseUrl : string
$responseFactory : ResponseFactoryInterface|null = null
$streamFactory : StreamFactoryInterface|null = null

process()

public process(ServerRequestInterface $request, RequestHandlerInterface $handler) : ResponseInterface
Parameters
$request : ServerRequestInterface
$handler : RequestHandlerInterface
Return values
ResponseInterface

enrichAuthServerMetadata()

private enrichAuthServerMetadata(ResponseInterface $response) : ResponseInterface
Parameters
$response : ResponseInterface
Return values
ResponseInterface

handleRegistration()

private handleRegistration(ServerRequestInterface $request) : ResponseInterface
Parameters
$request : ServerRequestInterface
Return values
ResponseInterface

jsonResponse()

private jsonResponse(int $status, array<string, mixed> $data[, array<string, string> $extraHeaders = [] ]) : ResponseInterface
Parameters
$status : int
$data : array<string, mixed>
$extraHeaders : array<string, string> = []
Return values
ResponseInterface

        
On this page

Search results