rust_mcp_sdk/hyper_servers/
hyper_server.rs

1use std::sync::Arc;
2
3use rust_mcp_schema::InitializeResult;
4
5use crate::mcp_server::{server_runtime::ServerRuntimeInternalHandler, ServerHandler};
6
7use super::{HyperServer, HyperServerOptions};
8
9/// Creates a new HyperServer instance with the provided handler and options
10/// The handler must implement ServerHandler.
11///
12/// # Arguments
13/// * `server_details` - Initialization result from the MCP schema
14/// * `handler` - Implementation of the ServerHandlerCore trait
15/// * `server_options` - Configuration options for the HyperServer
16///
17/// # Returns
18/// * `HyperServer` - A configured HyperServer instance ready to start
19pub fn create_server(
20    server_details: InitializeResult,
21    handler: impl ServerHandler,
22    server_options: HyperServerOptions,
23) -> HyperServer {
24    HyperServer::new(
25        server_details,
26        Arc::new(ServerRuntimeInternalHandler::new(Box::new(handler))),
27        server_options,
28    )
29}