McpHttpServer

HTTP transport for the MCP protocol.

Handles CORS, auth validation, content negotiation, and delegates JSON-RPC dispatch to McpRequestRouter. Both client and server MCP endpoints instantiate this with their own config.

Constructors

Link copied to clipboard

Types

Link copied to clipboard
object Companion

Constants and factory methods for HTTP transport configuration.

Link copied to clipboard
data class McpHttpServerConfig(val port: Int, val tools: List<McpTool>, val serverName: String, val authValidator: (HttpExchange) -> Boolean, val toolCallListener: (String, Boolean, String?) -> Unit? = null)

Configuration for an McpHttpServer instance.

Functions

Link copied to clipboard

Returns true if the server is currently running.

Link copied to clipboard
fun start()

Starts the HTTP server. No-op if already running.

Link copied to clipboard
fun stop()

Stops the HTTP server. No-op if not running.