client
MCP Client
Section titled “MCP Client”MCP client implementation for connecting to MCP servers over either Streamable HTTP or the older direct SSE feature path.
Structs
Section titled “Structs”McpClient
Section titled “McpClient”MCP Client - Connect to MCP servers
Methods
fn new() -> SelfCreate new MCP client
with_auth_handler
Section titled “with_auth_handler”fn with_auth_handler<H>(self, handler: H) -> SelfConfigure authentication
with_streamable_http_server
Section titled “with_streamable_http_server”fn with_streamable_http_server(self, endpoint: &str) -> SelfConnect to MCP server via Streamable HTTP.
with_streamable_http_server_auth
Section titled “with_streamable_http_server_auth”fn with_streamable_http_server_auth(self, endpoint: &str, auth_token: &str) -> SelfConnect to MCP server via Streamable HTTP with bearer authentication.
with_streamable_http_headers
Section titled “with_streamable_http_headers”fn with_streamable_http_headers(self, headers: HashMap<String, String>) -> SelfAdd extra HTTP headers to the Streamable HTTP transport.
with_streamable_http_client_info
Section titled “with_streamable_http_client_info”fn with_streamable_http_client_info(self, client_info: ClientInfo) -> SelfOverride the Streamable HTTP client identity used during initialize.
list_tools_async
Section titled “list_tools_async”async fn list_tools_async(&self) -> Result<Vec<Tool>, ProtocolError>List tools from server.
call_tool_async
Section titled “call_tool_async”async fn call_tool_async(&self, name: &str, arguments: Option<serde_json::Value>) -> Result<CallToolResult, ProtocolError>Call tool on server.
call_tool_with_meta_async
Section titled “call_tool_with_meta_async”async fn call_tool_with_meta_async(&self, name: &str, arguments: Option<serde_json::Value>, meta: Option<serde_json::Value>) -> Result<CallToolResult, ProtocolError>initialize_async
Section titled “initialize_async”async fn initialize_async(&self) -> Result<(), ProtocolError>Initialize the current Streamable HTTP transport explicitly.
health_check
Section titled “health_check”async fn health_check(&self) -> Result<(), ProtocolError>Check server health.
McpClientBuilder
Section titled “McpClientBuilder”MCP Client Builder - Convenient client configuration
Methods
fn new() -> SelfCreate new client builder
with_auth_handler
Section titled “with_auth_handler”fn with_auth_handler<H>(self, handler: H) -> SelfSet authentication handler
with_streamable_http_server
Section titled “with_streamable_http_server”fn with_streamable_http_server(self, endpoint: &str) -> SelfConfigure Streamable HTTP transport.
with_streamable_http_auth_token
Section titled “with_streamable_http_auth_token”fn with_streamable_http_auth_token(self, token: &str) -> SelfSet bearer token for Streamable HTTP transport.
fn build(self) -> McpClientBuild the MCP client