pub struct McpServer { /* private fields */ }Expand description
A running MCP server connection.
A background reader task owns stdout and demultiplexes responses by id
into per-request oneshot channels. send_request writes to stdin and then
awaits its channel — never read_line directly. So a request timeout (or any
cancellation of the caller’s future) only drops a receiver; the reader keeps
consuming the stream and discards the now-orphaned response. This makes the
transport cancel-safe by construction: there is no read to interrupt
mid-line, hence no desync and no poison/recovery dance.
Implementations§
Source§impl McpServer
impl McpServer
Sourcepub async fn start(config: McpServerConfig) -> Result<Self, String>
pub async fn start(config: McpServerConfig) -> Result<Self, String>
Start an MCP server and initialize the connection.
Sourcepub async fn list_tools(&mut self) -> Result<Vec<McpToolInfo>, String>
pub async fn list_tools(&mut self) -> Result<Vec<McpToolInfo>, String>
Discover tools from this MCP server.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for McpServer
impl !UnwindSafe for McpServer
impl Freeze for McpServer
impl Send for McpServer
impl Sync for McpServer
impl Unpin for McpServer
impl UnsafeUnpin for McpServer
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
impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more