Skip to main content

create_http_transport

Function create_http_transport 

Source
pub fn create_http_transport(
    _endpoint: &str,
    _bearer_token: Option<&str>,
    _headers: &HeaderMap,
) -> Result<WorkerTransport<StreamableHttpClientWorker<Client>>, Error>
Expand description

Create an HTTP-based transport from endpoint URL (Phase 3.2)

§Arguments

  • endpoint - HTTP endpoint URL (e.g., https://api.example.com/mcp)
  • bearer_token - Optional bearer token for authentication
  • headers - Custom HTTP headers to include in requests

§Returns

A StreamableHttpClientTransport ready to use with RMCP client

§Note

This is a convenience wrapper for HTTP transport creation. The actual transport construction delegates to rmcp’s StreamableHttpClientTransport following the pattern used in RmcpClient::new_streamable_http_client().

§Example

ⓘ
let transport = create_http_transport(
    "https://api.example.com/mcp",
    Some("auth_token"),
    &HeaderMap::new()
)?;