MCP PHP SDK

RequestStateBinderInterface

Binds the `requestState` of a multi round-trip request to the request it was minted for.

The SDK calls self::bind() once per request: the value it returns is covered by the MAC of every state minted while answering the request, and recomputed to verify the state the client echoes on the retry. A state presented on a request that binds to another value fails verification like a forged one. The value never goes on the wire. A binder that throws fails the request with an internal error.

Bind only what stays the same across the rounds of one call: the request object carries neither requestState nor inputResponses, but _meta (progress token, trace context, client capabilities) may change between rounds and does not belong in the binding.

Tags
see
https://modelcontextprotocol.io/specification/2026-07-28/basic/patterns/mrtr#server-requirements-basic-workflow
OriginatingRequestBinder

for the binding the specification recommends

author

Björn Meyer b.meyer@shopware.com

Table of Contents

Methods

bind()  : string

Methods

bind()

public bind(Request $request, AccessToken|null $accessToken) : string
Parameters
$request : Request

the request as the client sent it, before any RequestEvent listener ran

$accessToken : AccessToken|null

the token the request was authorized with, null on an unauthorized transport

Return values
string
On this page

Search results