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. Every request/response pair is returned as JSON, so this endpoint opens no SSE stream and offers no resumability. Use mcpStreamableHttp when either is required.
Automatically installs ContentNegotiation with McpJson.
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.
factory block with access to the RoutingContext (for reading request headers) that creates and returns the Server to handle the connection.
Deprecated (with error)
Use mcpStatelessStreamableHttp without eventStore.
Replace with
mcpStatelessStreamableHttp(path, enableDnsRebindingProtection, allowedHosts, allowedOrigins, block)Retained only so that existing call sites get a migration hint instead of an unresolved parameter name.
Parameters
never consulted by a stateless endpoint. Resumption is driven by a GET carrying Last-Event-ID, and this endpoint answers GET with 405 Method Not Allowed, so no stream exists to store events on or replay them to. Use mcpStreamableHttp when you need resumability.