mcpWebSocket

fun Routing.mcpWebSocket(block: () -> Server)(source)
fun Routing.mcpWebSocket(path: String, block: () -> Server)(source)

Configures the Ktor Application to handle Model Context Protocol (MCP) over WebSocket.


fun Application.mcpWebSocket(path: String, block: () -> Server)(source)

Configures the Ktor Application to handle Model Context Protocol (MCP) over WebSocket at the specified path.


fun Route.mcpWebSocket(options: ServerOptions? = null, handler: suspend Server.() -> Unit = {})(source)

Deprecated

Use mcpWebSocket with a lambda that returns a Server instance instead

Replace with

Routing.mcpWebSocket

Registers a WebSocket route that establishes an MCP (Model Context Protocol) server session.

Parameters

options

Optional server configuration settings for the MCP server.

handler

A suspend function that defines the server's behavior.


fun Route.mcpWebSocket(block: () -> Server)(source)

Deprecated

Use mcpWebSocket with a lambda that returns a Server instance instead

Replace with

Routing.mcpWebSocket

fun Route.mcpWebSocket(path: String, options: ServerOptions? = null, handler: suspend Server.() -> Unit = {})(source)

Deprecated

Use mcpWebSocket with a path and a lambda that returns a Server instance instead

Replace with

Routing.mcpWebSocket

Registers a WebSocket route at the specified path that establishes an MCP server session.

Parameters

path

The URL path at which to register the WebSocket route.

options

Optional server configuration settings for the MCP server.

handler

A suspend function that defines the server's behavior.