pub struct HttpTransport { /* private fields */ }Expand description
A bound loopback endpoint, ready to serve.
Implementations§
Source§impl HttpTransport
impl HttpTransport
Sourcepub async fn bind(token: Option<Token>) -> Result<Self>
pub async fn bind(token: Option<Token>) -> Result<Self>
Bind 127.0.0.1:0. The OS picks the port, so two instances never collide.
pub fn addr(&self) -> SocketAddr
Sourcepub fn activity(&self) -> Activity
pub fn activity(&self) -> Activity
Activity of this endpoint, for a host that shows an “AI connected” indicator (G18). Cloneable and safe to read from another task.
pub fn url(&self) -> String
pub fn token(&self) -> Option<&Token>
Sourcepub async fn serve(
self,
server: Arc<McpServer>,
stop: CancellationToken,
) -> Result<()>
pub async fn serve( self, server: Arc<McpServer>, stop: CancellationToken, ) -> Result<()>
Serve until stop is cancelled.
The server is shared by Arc rather than cloned per connection: an MCP
session spans several HTTP requests, so the lifecycle state must survive
between them. (Stdio clones per session because there the connection is the
session.)
Trait Implementations§
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