pub struct McpServer { /* private fields */ }Expand description
Cloneable MCP protocol core and Actix Streamable HTTP handler.
Implementations§
Source§impl McpServer
impl McpServer
pub fn new(config: McpServerConfig) -> Result<Self, McpConfigError>
pub fn add_tool<F, Fut>(&self, tool: Tool, handler: F)
pub fn add_resource<F, Fut>(&self, resource: Resource, handler: F)
pub fn add_prompt<F, Fut>(&self, prompt: Prompt, handler: F)
Sourcepub fn configure(&self, service: &mut ServiceConfig)
pub fn configure(&self, service: &mut ServiceConfig)
Mounts the configured MCP endpoint on an Actix application.
Sourcepub fn run(&self) -> Result<Server>
pub fn run(&self) -> Result<Server>
Binds the configured address and starts a standalone MCP HTTP server.
Sourcepub fn run_on(&self, listener: TcpListener) -> Result<Server>
pub fn run_on(&self, listener: TcpListener) -> Result<Server>
Starts a standalone MCP HTTP server on an existing listener.
Sourcepub async fn serve_until<F>(&self, shutdown: F) -> Result<()>
pub async fn serve_until<F>(&self, shutdown: F) -> Result<()>
Serves until the supplied signal resolves and then gracefully drains requests.
Sourcepub async fn serve_on_until<F>(
&self,
listener: TcpListener,
shutdown: F,
) -> Result<()>
pub async fn serve_on_until<F>( &self, listener: TcpListener, shutdown: F, ) -> Result<()>
Listener-based variant of McpServer::serve_until.
Trait Implementations§
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