pub struct StreamableHttpTransportConfig {
pub url: String,
pub bearer_token: Option<String>,
pub headers: Vec<(HeaderName, HeaderValue)>,
pub http_client: Option<Arc<dyn McpHttpClient>>,
}Expand description
Configuration for an MCP server that communicates over the MCP Streamable HTTP transport.
Fields§
§url: StringThe MCP endpoint URL to connect to.
bearer_token: Option<String>Static bearer token sent as an HTTP Authorization: Bearer ... header.
Ignored when Self::http_client is set, since the custom client owns
authorization for every request.
headers: Vec<(HeaderName, HeaderValue)>Static custom HTTP headers sent with every Streamable HTTP request.
Ignored when Self::http_client is set.
http_client: Option<Arc<dyn McpHttpClient>>Optional caller-supplied HTTP client.
When Some, agentkit-mcp routes every Streamable HTTP request through
the provided implementation instead of rmcp’s default reqwest client.
This is the seam to inject dynamic bearers, request signing, retry
middleware, custom TLS, and so on. See McpHttpClient.
Implementations§
Source§impl StreamableHttpTransportConfig
impl StreamableHttpTransportConfig
Sourcepub fn new(url: impl Into<String>) -> Self
pub fn new(url: impl Into<String>) -> Self
Creates a new Streamable HTTP transport configuration for the given MCP endpoint.
Sourcepub fn with_bearer_token(self, token: impl Into<String>) -> Self
pub fn with_bearer_token(self, token: impl Into<String>) -> Self
Sets a static bearer token for Streamable HTTP authorization.
Ignored when a custom McpHttpClient is installed via
Self::with_http_client.
Sourcepub fn with_http_client(self, client: Arc<dyn McpHttpClient>) -> Self
pub fn with_http_client(self, client: Arc<dyn McpHttpClient>) -> Self
Installs a caller-supplied HTTP client for every Streamable HTTP request issued by this transport.
This is the only seam capable of producing per-request dynamic state
(rotating bearers, request signing, distributed-tracing headers).
rmcp’s default reqwest path is bypassed entirely when this is set, so
implementations are responsible for forwarding auth_header /
custom_headers if they want the static config to keep applying.
Sourcepub fn with_header<N, V>(self, name: N, value: V) -> Result<Self, McpError>
pub fn with_header<N, V>(self, name: N, value: V) -> Result<Self, McpError>
Adds a static HTTP header for every Streamable HTTP request.
Reserved MCP session and protocol headers are still managed by RMCP.
Ignored when a custom McpHttpClient is installed.
Trait Implementations§
Source§impl Clone for StreamableHttpTransportConfig
impl Clone for StreamableHttpTransportConfig
Source§fn clone(&self) -> StreamableHttpTransportConfig
fn clone(&self) -> StreamableHttpTransportConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more