pub struct StdioTransport { /* private fields */ }Expand description
MCP transport over stdio — spawns a subprocess and pipes JSON-RPC messages.
Implementations§
Source§impl StdioTransport
impl StdioTransport
Sourcepub async fn spawn(command: &str) -> Result<Self, TransportError>
pub async fn spawn(command: &str) -> Result<Self, TransportError>
Spawn a child process from a shell command string.
The command is split using shell word-splitting rules (handles quotes). stdin and stdout are piped for JSON-RPC communication; stderr is inherited so the user can see server logs.
Sourcepub async fn spawn_quiet(command: &str) -> Result<Self, TransportError>
pub async fn spawn_quiet(command: &str) -> Result<Self, TransportError>
Spawn a child process with stderr suppressed.
Used for disposable sessions where server startup messages would clutter the terminal output.
Sourcepub fn set_read_timeout(&mut self, timeout: Duration)
pub fn set_read_timeout(&mut self, timeout: Duration)
Set the read timeout for this transport.
Trait Implementations§
Source§impl Transport for StdioTransport
impl Transport for StdioTransport
Source§fn write_raw<'life0, 'life1, 'async_trait>(
&'life0 mut self,
message: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<(), TransportError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn write_raw<'life0, 'life1, 'async_trait>(
&'life0 mut self,
message: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<(), TransportError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Write a raw message string without reading a response.
Used for notifications and other one-way messages.
Source§fn request_raw<'life0, 'life1, 'async_trait>(
&'life0 mut self,
message: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<String>, TransportError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn request_raw<'life0, 'life1, 'async_trait>(
&'life0 mut self,
message: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<String>, TransportError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Write a raw message string and read back one response line.
Returns
None if the response line is empty.Source§fn shutdown<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<(), TransportError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn shutdown<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<(), TransportError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Shut down the transport gracefully.
Source§fn capabilities(&self) -> TransportCapabilities
fn capabilities(&self) -> TransportCapabilities
Capability metadata for this transport implementation.
Source§fn send_request<'life0, 'life1, 'async_trait>(
&'life0 mut self,
req: &'life1 JsonRpcRequest,
) -> Pin<Box<dyn Future<Output = Result<JsonRpcResponse, TransportError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn send_request<'life0, 'life1, 'async_trait>(
&'life0 mut self,
req: &'life1 JsonRpcRequest,
) -> Pin<Box<dyn Future<Output = Result<JsonRpcResponse, TransportError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Send a typed JSON-RPC request and get the parsed response.
Source§fn send_notification<'life0, 'life1, 'async_trait>(
&'life0 mut self,
notif: &'life1 JsonRpcNotification,
) -> Pin<Box<dyn Future<Output = Result<(), TransportError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn send_notification<'life0, 'life1, 'async_trait>(
&'life0 mut self,
notif: &'life1 JsonRpcNotification,
) -> Pin<Box<dyn Future<Output = Result<(), TransportError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Send a JSON-RPC notification (write-only, no response expected).
Source§fn send_raw<'life0, 'life1, 'async_trait>(
&'life0 mut self,
message: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<String>, TransportError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn send_raw<'life0, 'life1, 'async_trait>(
&'life0 mut self,
message: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<String>, TransportError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Send a raw string and read one response. Convenience alias for the fuzzer.
Auto Trait Implementations§
impl Freeze for StdioTransport
impl !RefUnwindSafe for StdioTransport
impl Send for StdioTransport
impl Sync for StdioTransport
impl Unpin for StdioTransport
impl UnsafeUnpin 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