mcpStatelessStreamableHttp
Configures the Ktor Application to handle Model Context Protocol (MCP) over stateless Streamable HTTP Transport
Sets up an HTTP POST endpoint at path. GET and DELETE requests return 405 Method Not Allowed. Simple request/response pairs are returned as JSON (not SSE streams).
Automatically installs ContentNegotiation with McpJson and SSE.
Parameters
The URL path where the server listens for incoming JSON-RPC requests. Defaults to "/mcp".
Determines whether DNS rebinding protection is enabled. Defaults to true.
A list of allowed hostnames. 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. If null, origin validation is disabled.
An optional EventStore implementation to provide resumability and event replay support.
factory block with access to the RoutingContext (for reading request headers) that creates and returns the Server to handle the connection.