pub struct McpServer { /* private fields */ }Expand description
The core MCP server — holds configuration and the routing table.
Create one with McpServer::builder() then call .serve_stdio() or
another transport extension method to start accepting connections.
Implementations§
Source§impl McpServer
impl McpServer
pub fn builder() -> McpServerBuilder
Sourcepub async fn handle_message(
&self,
msg: JsonRpcMessage,
session: &mut Session,
) -> Option<JsonRpcMessage>
pub async fn handle_message( &self, msg: JsonRpcMessage, session: &mut Session, ) -> Option<JsonRpcMessage>
Handle a single incoming JSON-RPC message, returning the response (if any).
pub fn info(&self) -> &ServerInfo
Trait Implementations§
Source§impl ServeSseExt for McpServer
impl ServeSseExt for McpServer
Source§impl ServeStdioExt for McpServer
impl ServeStdioExt for McpServer
Source§impl ServeStreamableExt for McpServer
impl ServeStreamableExt for McpServer
Source§fn serve_streamable(
self,
addr: impl Into<SocketAddr>,
) -> impl Future<Output = McpResult<()>> + Send
fn serve_streamable( self, addr: impl Into<SocketAddr>, ) -> impl Future<Output = McpResult<()>> + Send
Serve using the Streamable HTTP transport.
Source§impl ServeWebSocketExt for McpServer
impl ServeWebSocketExt for McpServer
Source§async fn serve_websocket(
self,
addr: impl Into<SocketAddr> + Send,
) -> Result<(), McpError>
async fn serve_websocket( self, addr: impl Into<SocketAddr> + Send, ) -> Result<(), McpError>
Start serving MCP over WebSocket on the given address.
Source§async fn serve_websocket_with_buffer(
self,
addr: impl Into<SocketAddr> + Send,
buffer_size: usize,
) -> Result<(), McpError>
async fn serve_websocket_with_buffer( self, addr: impl Into<SocketAddr> + Send, buffer_size: usize, ) -> Result<(), McpError>
Start serving MCP over WebSocket with a custom notification channel buffer size.
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<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