The per-connection / per-session ConnectionState this request is bound to. A transport that scopes state per peer returns the state it resolved for THIS request: the SessionManager-owned state looked up by Mcp-Session-Id (stateful HTTP), or a fresh per-request state built from the request's effective version + _meta (stateless HTTP). Returns null when the context carries no such state, in which case the server core falls back to its single bound activeConnection (stdio / bare-handle).
A stable, non-empty identifier for this request's connection / session.
An optional capability a RequestContext may implement to report the connection / session it arrived on. The server core scopes its per-connection state (the in-flight cancellation registry) by this token so that two concurrent clients sharing one McpServer over Streamable HTTP cannot collide on a bare JSON-RPC id. A transport that multiplexes many sessions over one server SHOULD have its RequestContext implement this and return a per-session token (e.g. derived from Mcp-Session-Id, or a per-connection UUID), so a notifications/cancelled arriving on connection B only matches in-flight requests registered by connection B. A context that does not implement this interface is treated as the single shared connection (empty token), the behaviour for stdio, in-process, and any transport that does not distinguish connections.
The McpServer's other per-client state — the negotiated protocol version, the client capabilities, the logging level, and resource subscriptions — lives in shared instance fields, so the supported deployment for stateful HTTP is one McpServer per connection. This ConnectionScoped hook isolates the cancellation registry.