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:
- Accepts a transport for communication
- Handles the initialize/initialized handshake
- Routes incoming requests to the appropriate handlers
- 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§
- Runtime
Config - Server runtime configuration.
- Server
Runtime - Server runtime that handles the message loop.
- Server
State - State for a running server.
- Transport
Peer - A peer implementation that sends notifications over a transport.
Traits§
- Request
Router - Trait for routing requests to handlers.