pub struct StreamableHttpTransport { /* private fields */ }Expand description
Unstable (feature: mcp-transport) — may change or be removed
Streamable HTTP transport.Implementations§
Source§impl StreamableHttpTransport
impl StreamableHttpTransport
Sourcepub fn new(
server_name: &str,
endpoint: &str,
credential_provider: Option<Arc<dyn McpCredentialProvider>>,
timeout_ms: u64,
) -> Result<StreamableHttpTransport, Error>
pub fn new( server_name: &str, endpoint: &str, credential_provider: Option<Arc<dyn McpCredentialProvider>>, timeout_ms: u64, ) -> Result<StreamableHttpTransport, Error>
Build a new transport.
credential_provider is queried for Authorization headers on
every request; pass None to disable authentication.
timeout_ms == 0 disables the client-side per-request timeout.
Trait Implementations§
Source§impl Debug for StreamableHttpTransport
impl Debug for StreamableHttpTransport
Source§impl McpTransport for StreamableHttpTransport
impl McpTransport for StreamableHttpTransport
Source§fn request<'life0, 'life1, 'async_trait>(
&'life0 mut self,
id: u64,
json: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<RawJsonRpcMessage, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
StreamableHttpTransport: 'async_trait,
fn request<'life0, 'life1, 'async_trait>(
&'life0 mut self,
id: u64,
json: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<RawJsonRpcMessage, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
StreamableHttpTransport: 'async_trait,
Send a JSON-RPC request and await the matching response. Read more
Source§fn notify<'life0, 'life1, 'async_trait>(
&'life0 mut self,
json: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
StreamableHttpTransport: 'async_trait,
fn notify<'life0, 'life1, 'async_trait>(
&'life0 mut self,
json: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
StreamableHttpTransport: 'async_trait,
Send a JSON-RPC notification (no response expected).
Source§fn set_inbound_handler(
&mut self,
handler: Box<dyn FnMut(RawJsonRpcMessage) -> Option<Value> + Send + Sync>,
)
fn set_inbound_handler( &mut self, handler: Box<dyn FnMut(RawJsonRpcMessage) -> Option<Value> + Send + Sync>, )
Install (or replace) the inbound handler. Called by the client before
the first
request so that any peer-sent message arriving during the
handshake is dispatched.Source§fn close<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
StreamableHttpTransport: 'async_trait,
fn close<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
StreamableHttpTransport: 'async_trait,
Close the transport gracefully. Default is a no-op for transports
that close on drop.
Source§fn is_connected(&self) -> bool
fn is_connected(&self) -> bool
Whether the transport is currently connected.
Auto Trait Implementations§
impl !Freeze for StreamableHttpTransport
impl !RefUnwindSafe for StreamableHttpTransport
impl !UnwindSafe for StreamableHttpTransport
impl Send for StreamableHttpTransport
impl Sync for StreamableHttpTransport
impl Unpin for StreamableHttpTransport
impl UnsafeUnpin for StreamableHttpTransport
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more