ExMCP.Transport.HTTPServerWithVersion (ex_mcp v0.10.0)
View SourceExample HTTP server configuration that includes protocol version validation.
This module demonstrates how to integrate the protocol version plug with the existing HTTP server transport.
Usage Example
# In your Phoenix router
scope "/mcp" do
forward "/", ExMCP.Transport.HTTPServerWithVersion,
handler: MyMCPHandler,
security: %{
validate_origin: true,
allowed_origins: ["https://app.example.com"]
}
end
# Or with Plug.Router
defmodule MyRouter do
use Plug.Router
plug ExMCP.Plugs.ProtocolVersion
plug :match
plug :dispatch
forward "/mcp", to: ExMCP.Transport.HTTPServer,
init_opts: [handler: MyMCPHandler]
end
Summary
Functions
Call implementation that forwards to HTTPServer after protocol validation.
Initialize with HTTPServer options.