Add MCP client Streamable HTTP transport - #227
Merged
Merged
Conversation
# Conflicts: # src/Client.php # src/Client/Contracts/Method.php # src/Client/Methods/Initialize.php # src/Client/Methods/Ping.php # src/Client/Transport/StdioTransport.php # tests/Unit/Client/ClientTest.php
pushpak1300
marked this pull request as ready for review
May 25, 2026 12:04
pushpak1300
marked this pull request as draft
May 25, 2026 12:04
Member
Author
|
Ready for review. Putting in draft until #226 is merged. |
WendellAdriel
requested changes
May 25, 2026
pushpak1300
force-pushed
the
add-client-http-transport
branch
from
May 25, 2026 15:54
9aaa38c to
dac43d1
Compare
An error occurred while trying to automatically change base from
add-client-tools-list-call
to
main
May 27, 2026 23:31
…port # Conflicts: # src/Client.php # src/Client/Protocol.php
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Currently the MCP client can only talk to servers over stdio (
Client::local()), so there's no way to connect to a remote or hosted MCP server over HTTP.This adds a Streamable HTTP transport (MCP 2025-11-25):
It POSTs each JSON-RPC frame via the
Httpfacade (so it'sHttp::fake()testable), handles bothapplication/jsonandtext/event-streamresponses, captures and echoesMCP-Session-Id, sendsMCP-Protocol-Version, re-initializes on a 404, and sends a best-effort DELETE on disconnect.withToken()lives on a newWebClientsubclass since stdio clients have no auth concept. No OAuth yet, that's a later stage.Known limitation: SSE responses are read in full before parsing rather than incrementally, so a server that sends a blocking server->client request mid-stream (say a ping it waits on) would hang until the timeout. Narrow for this client since it advertises no sampling/roots/elicitation capabilities, but I'd like to follow up with incremental streaming. Open to feedback on whether that should block this PR.
Stacked on #226.