Module server

Module server 

Source
Expand description

Server runtime for MCP servers.

This module provides the runtime that executes an MCP server over a transport, handling message routing, request correlation, and the connection lifecycle.

§Overview

The server runtime:

  1. Accepts a transport for communication
  2. Handles the initialize/initialized handshake
  3. Routes incoming requests to the appropriate handlers
  4. Manages the connection lifecycle

§Example

use mcpkit_server::{ServerBuilder, ServerHandler, ServerState};
use mcpkit_core::capability::{ServerInfo, ServerCapabilities};

struct MyHandler;
impl ServerHandler for MyHandler {
    fn server_info(&self) -> ServerInfo {
        ServerInfo::new("my-server", "1.0.0")
    }
}

// Build a server and create server state
let server = ServerBuilder::new(MyHandler).build();
let state = ServerState::new(server.capabilities().clone());

assert!(!state.is_initialized());

Structs§

RuntimeConfig
Server runtime configuration.
ServerRuntime
Server runtime that handles the message loop.
ServerState
State for a running server.
TransportPeer
A peer implementation that sends notifications over a transport.

Traits§

RequestRouter
Trait for routing requests to handlers.