Package-level declarations

Types

Link copied to clipboard
data class RegisteredPrompt(val prompt: Prompt, val messageProvider: suspend (GetPromptRequest) -> GetPromptResult)

A wrapper class representing a registered prompt on the server.

Link copied to clipboard
data class RegisteredResource(val resource: Resource, val readHandler: suspend (ReadResourceRequest) -> ReadResourceResult)

A wrapper class representing a registered resource on the server.

Link copied to clipboard
data class RegisteredTool(val tool: Tool, val handler: suspend (CallToolRequest) -> CallToolResult)

A wrapper class representing a registered tool on the server.

Link copied to clipboard
open class Server(serverInfo: Implementation, options: ServerOptions) : Protocol

An MCP server on top of a pluggable transport.

Link copied to clipboard
class ServerOptions(val capabilities: ServerCapabilities, enforceStrictCapabilities: Boolean = true) : ProtocolOptions

Configuration options for the MCP server.

Link copied to clipboard
Link copied to clipboard

Server transport for SSE: this will send messages over an SSE connection and receive messages from HTTP POST requests.

Link copied to clipboard
class StdioServerTransport(inputStream: Source, outputStream: Sink) : AbstractTransport

A server transport that communicates with a client via standard I/O.

Link copied to clipboard

Server-side implementation of the MCP (Model Context Protocol) transport over WebSocket.

Functions

Link copied to clipboard
Link copied to clipboard
fun Routing.mcp(path: String, block: ServerSSESession.() -> Server)

Configures the Ktor Application to handle Model Context Protocol (MCP) over Server-Sent Events (SSE).

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

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

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

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

Link copied to clipboard

Registers a WebSocket route that creates an MCP server transport layer.

fun Route.mcpWebSocketTransport(path: String, handler: suspend WebSocketMcpServerTransport.() -> Unit = {})

Registers a WebSocket route at the specified path that creates an MCP server transport layer.