pub struct StreamableHttpClient { /* private fields */ }Expand description
Streamable HTTP client - MCP-compliant request/response implementation
Implementations§
Source§impl StreamableHttpClient
impl StreamableHttpClient
pub fn new( config: StreamableHttpClientConfig, ) -> Result<StreamableHttpClient, TransportError>
Sourcepub async fn authenticate(&mut self) -> Result<(), TransportError>
pub async fn authenticate(&mut self) -> Result<(), TransportError>
Authenticate using OAuth 2.1 if configured
Sourcepub async fn connect(&mut self) -> Result<String, TransportError>
pub async fn connect(&mut self) -> Result<String, TransportError>
Connect to the Streamable HTTP server
Sourcepub async fn send_notification_internal(
&mut self,
message: JsonRpcMessage,
) -> Result<(), TransportError>
pub async fn send_notification_internal( &mut self, message: JsonRpcMessage, ) -> Result<(), TransportError>
Send a JSON-RPC notification (fire-and-forget, do not wait for response)
Sourcepub async fn get_health(&mut self) -> TransportHealth
pub async fn get_health(&mut self) -> TransportHealth
Get current connection health
Sourcepub async fn is_healthy(&self) -> bool
pub async fn is_healthy(&self) -> bool
Check if the connection is healthy
Sourcepub async fn reconnect(&mut self) -> Result<(), TransportError>
pub async fn reconnect(&mut self) -> Result<(), TransportError>
Reconnect to the server
Sourcepub async fn reset(&mut self) -> Result<(), TransportError>
pub async fn reset(&mut self) -> Result<(), TransportError>
Reset the client state
Sourcepub async fn start_sse_stream(&mut self) -> Result<Response, TransportError>
pub async fn start_sse_stream(&mut self) -> Result<Response, TransportError>
Start an SSE stream for server-to-client communication
Sourcepub async fn resume_sse_stream(
&mut self,
last_event_id: &str,
) -> Result<Response, TransportError>
pub async fn resume_sse_stream( &mut self, last_event_id: &str, ) -> Result<Response, TransportError>
Resume an SSE stream from a specific event ID
Trait Implementations§
Source§impl Transport for StreamableHttpClient
impl Transport for StreamableHttpClient
Source§fn send_message<'life0, 'async_trait>(
&'life0 mut self,
message: JsonRpcMessage,
) -> Pin<Box<dyn Future<Output = Result<(), TransportError>> + Send + 'async_trait>>where
'life0: 'async_trait,
StreamableHttpClient: 'async_trait,
fn send_message<'life0, 'async_trait>(
&'life0 mut self,
message: JsonRpcMessage,
) -> Pin<Box<dyn Future<Output = Result<(), TransportError>> + Send + 'async_trait>>where
'life0: 'async_trait,
StreamableHttpClient: 'async_trait,
Send a message through the transport
Source§fn receive_message<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<JsonRpcMessage, TransportError>> + Send + 'async_trait>>where
'life0: 'async_trait,
StreamableHttpClient: 'async_trait,
fn receive_message<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<JsonRpcMessage, TransportError>> + Send + 'async_trait>>where
'life0: 'async_trait,
StreamableHttpClient: 'async_trait,
Receive a message from the transport
Source§fn close<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<(), TransportError>> + Send + 'async_trait>>where
'life0: 'async_trait,
StreamableHttpClient: 'async_trait,
fn close<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<(), TransportError>> + Send + 'async_trait>>where
'life0: 'async_trait,
StreamableHttpClient: 'async_trait,
Close the transport connection gracefully
Source§fn get_state(&self) -> ConnectionState
fn get_state(&self) -> ConnectionState
Get current connection state
Source§fn get_health(&self) -> TransportHealth
fn get_health(&self) -> TransportHealth
Get transport health information
Source§fn reconnect<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<(), TransportError>> + Send + 'async_trait>>where
'life0: 'async_trait,
StreamableHttpClient: 'async_trait,
fn reconnect<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<(), TransportError>> + Send + 'async_trait>>where
'life0: 'async_trait,
StreamableHttpClient: 'async_trait,
Attempt to reconnect the transport
Source§fn reset<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<(), TransportError>> + Send + 'async_trait>>where
'life0: 'async_trait,
StreamableHttpClient: 'async_trait,
fn reset<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<(), TransportError>> + Send + 'async_trait>>where
'life0: 'async_trait,
StreamableHttpClient: 'async_trait,
Reset transport state and clear any cached data
Source§fn shutdown<'life0, 'async_trait>(
&'life0 mut self,
config: ShutdownConfig,
) -> Pin<Box<dyn Future<Output = Result<(), TransportError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
fn shutdown<'life0, 'async_trait>(
&'life0 mut self,
config: ShutdownConfig,
) -> Pin<Box<dyn Future<Output = Result<(), TransportError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
Initiate graceful shutdown
Source§fn force_shutdown<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<(), TransportError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
fn force_shutdown<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<(), TransportError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
Force immediate shutdown
Auto Trait Implementations§
impl Freeze for StreamableHttpClient
impl !RefUnwindSafe for StreamableHttpClient
impl Send for StreamableHttpClient
impl Sync for StreamableHttpClient
impl Unpin for StreamableHttpClient
impl !UnwindSafe for StreamableHttpClient
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