Backplane. McpProtocol. Server. Transport. StreamableHTTP. Plug
(backplane_mcp_protocol v0.5.0)
Copy Markdown
A Plug implementation for the Streamable HTTP transport.
This plug serves both MCP lifecycle eras on one endpoint:
- Modern
2026-07-28requests are session-free and POST-only. Responses use JSON or a request-scoped SSE stream and never create or return a session ID. - Legacy requests retain their session-oriented behavior: POST dispatches through a session, GET opens the session SSE stream, and DELETE closes it.
POST requests are decoded once and routed by their protocol markers before either the stateless modern executor or the legacy session path is selected.
Usage in Phoenix Router
pipeline :mcp do
plug :accepts, ["json"]
end
scope "/mcp" do
pipe_through :mcp
forward "/", to: Backplane.McpProtocol.Server.Transport.StreamableHTTP.Plug, server: :your_server_name
endConfiguration Options
:server- The server process name (required):session_header- Custom header name for session ID (default: "mcp-session-id"):request_timeout- Request timeout in milliseconds (default: 30000):allowed_origins- Origins accepted when theOriginheader is present (default: [])