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