Implement Streamable HTTP Transport with SSE (POST request) #12
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.
This PR implements the MCP Streamable HTTP Transport. It enables client-initiated requests (POST request) with JSON-RPC and Server-Sent Events (SSE) responses on a unified endpoint.
Streamable HTTP Transport
streamable_httpconfiguration inconfig/loop.php, replacing the previoussseconfiguration. This includes toggling the feature and setting the endpoint path.README.mdto describe the new Streamable HTTP transport and added a newdocs/http-streaming.mdfile with detailed configuration and usage instructions.Routing, Middleware and Controller Enhancements
routes/api.phpto conditionally register the MCP endpoint based on the newstreamable_http.enabledconfiguration. Middleware and endpoint paths are dynamically applied.SseEnabledMiddlewaretoStreamableHttpEnabledMiddlewareand updated it to check the newstreamable_http.enabledconfiguration.McpControllerto handle both JSON and SSE responses. Added methods for JSON-RPC validation, SSE response handling, and client response preference.New Service for SSE
SseServiceclass to handle SSE-specific logic like creating streamed responses and formatting SSE events. Registered in the service provider. [1] [2]Other Fixes
LaravelModelToolkitwhereToolCollection::mergewas not updating the original collection.FindModelToolto use dependency injection forPrismToolinstead of static method calls.Notes
Next Steps The transport spec defines several optional features not included on this PR, but are good candidates for next steps:
Previous HTTP+SSE The streamable HTTP transport replaced the previous HTTP+SSE transport which removes the
/sseendpoint. Since this package doesn't implement HTTP+SSE, we're not supporting outdated clients.