pub struct TokioStdioTransport { /* private fields */ }Available on crate feature
client only.Expand description
True async stdio transport using tokio::process.
This implementation:
- Uses
tokio::process::Commandfor async process spawning - Separate tasks for reading stdout and writing to stdin
- No mutex held during I/O, enabling true concurrent requests
- Pending request map for matching responses to requests
Implementations§
Source§impl TokioStdioTransport
impl TokioStdioTransport
Sourcepub async fn spawn(
command: &str,
args: &[String],
) -> Result<Self, McpTransportError>
pub async fn spawn( command: &str, args: &[String], ) -> Result<Self, McpTransportError>
Spawn a new MCP server process with true async I/O.
Sourcepub async fn spawn_with_env(
command: &str,
args: &[String],
env: HashMap<String, String>,
) -> Result<Self, McpTransportError>
pub async fn spawn_with_env( command: &str, args: &[String], env: HashMap<String, String>, ) -> Result<Self, McpTransportError>
Spawn with environment variables.
Sourcepub async fn send_request(
&self,
method: &str,
params: Option<Value>,
timeout_duration: Duration,
) -> Result<Value, McpTransportError>
pub async fn send_request( &self, method: &str, params: Option<Value>, timeout_duration: Duration, ) -> Result<Value, McpTransportError>
Send a request and wait for response with timeout.
Sourcepub async fn stop(&self) -> Result<(), McpTransportError>
pub async fn stop(&self) -> Result<(), McpTransportError>
Stop the transport and kill the process.
Auto Trait Implementations§
impl !Freeze for TokioStdioTransport
impl !RefUnwindSafe for TokioStdioTransport
impl Send for TokioStdioTransport
impl Sync for TokioStdioTransport
impl Unpin for TokioStdioTransport
impl !UnwindSafe for TokioStdioTransport
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