pub struct McpServer { /* private fields */ }Expand description
MCP server that accepts JSON-RPC requests and dispatches to registered tools.
Implementations§
Source§impl McpServer
impl McpServer
Sourcepub fn builder(
name: impl Into<String>,
version: impl Into<String>,
) -> McpServerBuilder
pub fn builder( name: impl Into<String>, version: impl Into<String>, ) -> McpServerBuilder
Create a builder for an MCP server.
Sourcepub async fn handle_request(&self, request: Value) -> Value
pub async fn handle_request(&self, request: Value) -> Value
Handle a single JSON-RPC request and return a JSON-RPC response.
Sourcepub async fn serve_stdio(&self) -> Result<()>
pub async fn serve_stdio(&self) -> Result<()>
Serve MCP over stdio. Reads newline-delimited JSON-RPC from stdin, dispatches each request, writes responses to stdout.
Auto Trait Implementations§
impl Freeze for McpServer
impl !RefUnwindSafe for McpServer
impl Send for McpServer
impl Sync for McpServer
impl Unpin for McpServer
impl UnsafeUnpin for McpServer
impl !UnwindSafe for McpServer
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
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> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request