pub fn create_server(
server_details: InitializeResult,
transport: impl Transport<ClientMessage, MessageFromServer>,
handler: impl ServerHandler,
) -> ServerRuntime
Expand description
Creates a new MCP server runtime with the specified configuration.
This function initializes a server for (MCP) by accepting server details, transport ,
and a handler for server-side logic.
The resulting ServerRuntime
manages the server’s operation and communication with MCP clients.
§Arguments
server_details
- Server name , version and capabilities.transport
- An implementation of theTransport
trait facilitating communication with the MCP clients.handler
- An implementation of theServerHandler
trait that defines the server’s core behavior and response logic.
§Returns
A ServerRuntime
instance representing the initialized server, ready for asynchronous operation.
§Examples
You can find a detailed example of how to use this function in the repository: