MCP PHP SDK

Auth

Table of Contents

Interfaces

AuthenticatorInterface
Attaches credentials to outgoing HTTP requests and reacts to authentication challenges.
AuthorizationHandlerInterface
Takes the user to the authorization endpoint and returns the answer of the authorization server.
CredentialStorageInterface
Keeps OAuth credentials per issuer, so an authorization server never receives those of another.
PendingAuthorizationStorageInterface
Storage must be scoped to the user session that initiated authorization.

Classes

AccessToken
An OAuth 2.1 token response: the access token plus everything needed to keep using it.
AuthenticatingHttpClient
A PSR-18 client that authenticates every request and retries the ones the resource server challenges.
BearerToken
Sends a fixed bearer token, obtained outside the SDK.
ClientRegistration
The client's identity at one authorization server.
ConsoleAuthorizationHandler
Prints the authorization URL and reads the redirected URL back, for a shell without a browser.
CrossAppAccess
Reaches an MCP server through the identity a user already has at their company.
FileCredentialStorage
Persists credentials unencrypted in a JSON file with the mode 0600, in a directory with the mode 0700.
HeadlessAuthorizationHandler
Requests the authorization endpoint itself and reads the code from the redirect, for servers that grant without a prompt.
InMemoryCredentialStorage
Keeps credentials for the lifetime of the process.
LoopbackAuthorizationHandler
Opens the user's browser and catches the redirect on a loopback listener.
OAuth
Fluent builder for the OAuth authenticator of an {@see \Mcp\Client\Transport\HttpTransport}.
OAuthAuthenticator
Drives the MCP authorization flow when a server answers with a challenge; build one with {@see OAuth}.
PendingAuthorization
RedirectAuthorizationHandler

Enums

TokenEndpointAuthMethod
How the client proves who it is at the token endpoint (RFC 7591 "token_endpoint_auth_method").
On this page

Search results