pub struct HttpTransport { /* private fields */ }Expand description
Communicates with an MCP server via HTTP POST (JSON-RPC over HTTP).
Implementations§
Source§impl HttpTransport
impl HttpTransport
Sourcepub fn new(url: &str) -> Result<Self, McpError>
pub fn new(url: &str) -> Result<Self, McpError>
Create a new HTTP transport with the default request timeout.
Sourcepub fn new_with_timeout(
url: &str,
request_timeout: Duration,
) -> Result<Self, McpError>
pub fn new_with_timeout( url: &str, request_timeout: Duration, ) -> Result<Self, McpError>
Create a new HTTP transport with a custom request timeout.
The timeout is enforced by the outer tokio::time::timeout in send(),
which hard-cancels the inner future (connect + read + JSON parse) on expiry.
We deliberately do not set reqwest::Client::builder().timeout(d) to avoid
a race between reqwest’s internal timer and the outer tokio timer — having
both fire at the same duration produces a non-deterministic error
classification.
Trait Implementations§
Source§impl McpTransport for HttpTransport
impl McpTransport for HttpTransport
Auto Trait Implementations§
impl Freeze for HttpTransport
impl !RefUnwindSafe for HttpTransport
impl Send for HttpTransport
impl Sync for HttpTransport
impl Unpin for HttpTransport
impl UnsafeUnpin for HttpTransport
impl !UnwindSafe for HttpTransport
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