View Source SSE.ConnectionPlug (MCP SSE v0.1.0)

A Plug for handling Server-Sent Events (SSE) connections with MCP protocol support.

Query params:

  • sessionId - The session ID for the connection

This plug provides two endpoints:

  • /sse - Establishes the SSE connection
  • /message - Handles JSON-RPC messages for the MCP protocol

Usage in Phoenix Router

pipeline :sse do
  plug :accepts, ["sse"]
end

scope "/" do
  pipe_through :sse
  get "/sse", SSE.ConnectionPlug, :call

  pipe_through :api
  post "/message", SSE.ConnectionPlug, :call
end

Usage in Plug Router

forward "/sse", to: SSE.ConnectionPlug
forward "/message", to: SSE.ConnectionPlug