Function create_client

Source
pub fn create_client(
    client_details: InitializeRequestParams,
    transport: impl Transport<ServerMessage, MessageFromClient>,
    handler: impl ClientHandler,
) -> Arc<ClientRuntime>
Expand description

Creates a new MCP client runtime with the specified configuration.

This function initializes a client for (MCP) by accepting , client details, a transport , and a handler for client-side logic.

The resulting ClientRuntime is wrapped in an Arc for shared ownership across threads.

§Arguments

  • client_details - Client name , version and capabilities.
  • transport - An implementation of the Transport trait facilitating communication with the MCP server.
  • handler - An implementation of the ClientHandler trait that defines the client’s core behavior and response logic.

§Returns

An Arc<ClientRuntime> representing the initialized client, enabling shared access and asynchronous operation.

§Examples

You can find a detailed example of how to use this function in the repository:

Repository Example