pub struct StdioTransport { /* private fields */ }Expand description
Communicates with an MCP server via stdin/stdout of a child process. One JSON-RPC message per line (newline-delimited JSON, i.e. NDJSON protocol).
Implementations§
Source§impl StdioTransport
impl StdioTransport
Sourcepub async fn new(
command: &str,
args: &[&str],
env: Option<HashMap<String, String>>,
) -> Result<Self, McpError>
pub async fn new( command: &str, args: &[&str], env: Option<HashMap<String, String>>, ) -> Result<Self, McpError>
Spawn a child process and create a stdio transport.
Sourcepub fn with_timeout(self, request_timeout: Duration) -> Self
pub fn with_timeout(self, request_timeout: Duration) -> Self
Override the per-request timeout. Default is DEFAULT_REQUEST_TIMEOUT (30 s).
Applies to each send() call independently — write + read + parse share the
same budget. On timeout, send() returns McpError::Timeout and the next
caller gets a fresh budget.
Trait Implementations§
Source§impl McpTransport for StdioTransport
impl McpTransport for StdioTransport
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