MCP PHP SDK

CrossAppAccess

FinalYes

Reaches an MCP server through the identity a user already has at their company.

The client trades the identity token for an authorization grant for one MCP server (RFC 8693) and presents that grant to the authorization server (RFC 7523). The application gets the identity token from its own sign-in; pass a closure to hand over a fresh one each time the client needs a new grant.

Tags
author

Christopher Hertel mail@christopher-hertel.de

Table of Contents

Constants

AUTHORIZATION_GRANT_TOKEN_TYPE  : mixed = 'urn:ietf:params:oauth:token-type:id-jag'
ID_TOKEN_TYPE  : mixed = 'urn:ietf:params:oauth:token-type:id_token'

Properties

$clientId  : string|null
$clientSecret  : string|null
$identityTokenType  : string
$tokenEndpoint  : string
$identityToken  : string|Closure

Methods

__construct()  : mixed
getIdentityToken()  : string

Constants

AUTHORIZATION_GRANT_TOKEN_TYPE

public mixed AUTHORIZATION_GRANT_TOKEN_TYPE = 'urn:ietf:params:oauth:token-type:id-jag'

ID_TOKEN_TYPE

public mixed ID_TOKEN_TYPE = 'urn:ietf:params:oauth:token-type:id_token'

Properties

$identityTokenType read-only

public string $identityTokenType = self::ID_TOKEN_TYPE

Methods

__construct()

public __construct(string $tokenEndpoint, string|callable(): string $identityToken[, string $identityTokenType = self::ID_TOKEN_TYPE ][, string|null $clientId = null ][, string|null $clientSecret = null ]) : mixed
Parameters
$tokenEndpoint : string

the token endpoint of the identity provider

$identityToken : string|callable(): string

the token identifying the user, usually an OIDC ID token

$identityTokenType : string = self::ID_TOKEN_TYPE

the RFC 8693 type of that token

$clientId : string|null = null

the client id at the identity provider, when it differs from the client id at the authorization server

$clientSecret : string|null = null

the client secret at the identity provider, when it requires one

Tags
throws
InvalidArgumentException

when the token endpoint is neither https nor loopback

On this page

Search results