SSE.ConnectionPlug (MCP SSE v0.1.6)
View SourceA Plug for handling Server-Sent Events (SSE) connections with Model Context Protocol (MCP) 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 Model Context Protocol
Usage in Phoenix Router
pipeline :sse do
plug :accepts, ["sse"]
end
scope "/" do
pipe_through :sse
get "/sse", SSE.ConnectionPlug, :call
post "/message", SSE.ConnectionPlug, :call
end
Usage in Plug Router
forward "/sse", to: SSE.ConnectionPlug
forward "/message", to: SSE.ConnectionPlug
The paths can be configured in your application config:
config :mcp_sse,
sse_path: "/mcp/sse",
message_path: "/mcp/msg"