Skip to content

Feat: Http SSE transport as per '2024-11-05' MCP spec#34

Merged
sixlive merged 5 commits intoprism-php:mainfrom
vinitkadam03:feat/http-sse-transport
Mar 1, 2026
Merged

Feat: Http SSE transport as per '2024-11-05' MCP spec#34
sixlive merged 5 commits intoprism-php:mainfrom
vinitkadam03:feat/http-sse-transport

Conversation

@vinitkadam03
Copy link
Contributor

Description

This PR adds support for the HTTP with Server-Sent Events (SSE) transport protocol, as defined in the MCP specification (2024-11-05). This enables the Relay package to connect to MCP servers that expose HTTP+SSE endpoints, complementing the existing Http and Stdio transports.

The implementation follows the MCP HTTP+SSE transport flow:

  1. Opens a persistent SSE connection to the server's SSE endpoint
  2. Reads the initial endpoint event to obtain the message posting URL with session ID
  3. Sends initialize request with required params (protocolVersion, capabilities, clientInfo)
  4. Sends initialized notification after successful initialization
  5. Sends JSON-RPC requests via HTTP POST and receives responses via SSE message events

Configuration Example

// config/relay.php
'servers' => [
    'http-sse-mcp' => [
        'transport' => Transport::HttpSse,
        'url' => env('MCP_URL', 'https://mcp.modulcontextprotocol.io/sse'),
        'timeout' => 60,
        'api_key' => env('RELAY_ANALYTICS_SERVER_API_KEY'),
        'headers' => [],
    ],
],

Files Changed

  • src/Enums/Transport.php - Added HttpSse enum case
  • src/Transport/HttpSseTransport.php - New transport implementation
  • src/Transport/TransportFactory.php - Added factory support for HttpSse
  • tests/Unit/Transport/HttpSseTransportTest.php - Test suite (19 test cases)
  • tests/TestDoubles/HttpSseTransportFake.php - Test double for mocking
  • tests/Unit/Transport/TransportFactoryTest.php - Added test case for HttpSse factory creation

Testing

All existing tests pass (78 tests, 170 assertions). The new transport includes 19 dedicated test cases.

Breaking Changes

None. This is a purely additive feature that introduces a new transport option without modifying existing transports or APIs.

@vinitkadam03 vinitkadam03 changed the title Feat/http sse transport Feat: Http SSE transport as per '2024-11-05' MCP spec Feb 23, 2026
@sixlive sixlive merged commit c93ec04 into prism-php:main Mar 1, 2026
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants