mcpStreamableHttp
Configures the Ktor Application to handle Model Context Protocol (MCP) over Streamable HTTP Transport
Sets up SSE, HTTP POST, and DELETE endpoints at the specified path. Simple request/response pairs are returned as JSON (not SSE streams).
Automatically installs ContentNegotiation with McpJson and SSE.
Parameters
The base path for the MCP Streamable HTTP endpoint. Defaults to "/mcp".
Enables DNS rebinding attack protection for the endpoint. Defaults to true.
A list of hostnames allowed to access the endpoint. If null and DNS rebinding protection is enabled, defaults to localhost, 127.0.0.1, [::1].
A list of allowed Origin header values, compared by hostname only (scheme and port are ignored). Requests without an Origin header are allowed. When null while the localhost host defaults are in effect (no custom allowedHosts), the Origin header is validated against localhost, 127.0.0.1, [::1]. With custom allowedHosts, null skips origin validation.
An optional EventStore instance to enable resumable event stream functionality. Allows storing and replaying events.
factory block with access to the RoutingContext (for reading request headers) that creates and returns the Server to handle the connection.