pub struct StdioTransport { /* private fields */ }Expand description
stdio transport for MCP communication.
Uses length-prefixed framing compatible with the TypeScript SDK.
§Examples
use pmcp::shared::StdioTransport;
let transport = StdioTransport::new();
// Use with Client or ServerImplementations§
Source§impl StdioTransport
impl StdioTransport
Sourcepub fn serialize_message(message: &TransportMessage) -> Result<Vec<u8>>
pub fn serialize_message(message: &TransportMessage) -> Result<Vec<u8>>
Serialize transport message to JSON bytes.
Sourcepub fn parse_message(buffer: &[u8]) -> Result<TransportMessage>
pub fn parse_message(buffer: &[u8]) -> Result<TransportMessage>
Parse JSON message and determine its type.
Trait Implementations§
Source§impl Debug for StdioTransport
impl Debug for StdioTransport
Source§impl Default for StdioTransport
impl Default for StdioTransport
Source§impl Transport for StdioTransport
impl Transport for StdioTransport
Source§fn send<'life0, 'async_trait>(
&'life0 mut self,
message: TransportMessage,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn send<'life0, 'async_trait>(
&'life0 mut self,
message: TransportMessage,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Send a message over the transport. Read more
Source§fn receive<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<TransportMessage>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn receive<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<TransportMessage>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Receive a message from the transport. Read more
Source§fn close<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn close<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Close the transport. Read more
Source§fn is_connected(&self) -> bool
fn is_connected(&self) -> bool
Check if the transport is still connected. Read more
Source§fn transport_type(&self) -> &'static str
fn transport_type(&self) -> &'static str
Get the transport type name for debugging.
Auto Trait Implementations§
impl !Freeze for StdioTransport
impl !RefUnwindSafe for StdioTransport
impl Send for StdioTransport
impl Sync for StdioTransport
impl Unpin for StdioTransport
impl !UnwindSafe for StdioTransport
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