[Client] Expose session ID from HttpTransport (#497)

* Expose session ID from HttpTransport

* [Client] State what getSessionId() returns on 2026-07-28

That revision removed protocol-level sessions (SEP-2567), so the getter is always null there. Adds the changelog entry.

---------

Co-authored-by: Christopher Hertel <mail@christopher-hertel.de>
This commit is contained in:
Rob Loach 2026-09-04 17:55:20 -04:00 • committed by GitHub
commit 418034f2b0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -121,6 +121,22 @@ class HttpTransport extends BaseTransport implements HeaderAwareTransportInterfa
$this->headerCallback = $callback;
}
/**
* The session ID minted by the server for this connection, if any.
*
* Captured from the Mcp-Session-Id response header of a handshake-era
* server; always null on 2026-07-28, which removed protocol-level sessions
* (SEP-2567). A caller that cannot keep the transport alive between
* interactions can persist it and pass it back through the constructor's
* $headers on a later transport, where it wins over the tracked value.
*
* @return string|null null until the server mints a session, and again after close()
*/
public function getSessionId(): ?string
{
return $this->sessionId;
}
public function send(string $data): void
{
$request = $this->requestFactory->createRequest('POST', $this->endpoint)