oa::network::mcp::McpServer

Stateful MCP protocol session. Registration is frozen by the first handled message. Self::handle_message is transport-independent; Self::run_stdio adds the standard newline-delimited subprocess binding. Calls are externally synchronized. Self::close never waits for or drains external I/O. Donor: oa::McpServer.

StRust public API

Declaration

pub struct McpServer { /* private fields */ }
Public Rust declaration.

Public Methods

pub fn add_tool(&mut self, tool: McpTool) -> Result<()>
pub fn add_text_resource(&mut self, resource: McpTextResource) -> Result<()>
pub fn has_tool(&self, name: &str) -> bool
pub fn has_text_resource(&self, uri: &str) -> bool
pub fn handle_message(&mut self, message: &str) -> Result<String>
pub fn run_stdio(&mut self) -> Result<()>
pub fn close(&mut self)
pub fn is_started(&self) -> bool
pub fn is_closed(&self) -> bool
pub fn configuration_error(&self) -> Option<&Error>

Associated Functions

pub fn new(config: McpServerConfig) -> Self
fn default() -> Self

Public Method Documentation

pub fn add_tool(&mut self, tool: McpTool) -> Result<()>
No public source comment is attached to this declaration.
pub fn add_text_resource(&mut self, resource: McpTextResource) -> Result<()>
No public source comment is attached to this declaration.
pub fn has_tool( &self, name: &str ) -> bool
No public source comment is attached to this declaration.
pub fn has_text_resource( &self, uri: &str ) -> bool
No public source comment is attached to this declaration.
pub fn handle_message( &mut self, message: &str ) -> Result<String>
No public source comment is attached to this declaration.
pub fn run_stdio(&mut self) -> Result<()>
No public source comment is attached to this declaration.
pub fn close( &mut self )
No public source comment is attached to this declaration.
pub fn is_started( &self ) -> bool
No public source comment is attached to this declaration.
pub fn is_closed( &self ) -> bool
No public source comment is attached to this declaration.
pub fn configuration_error( &self ) -> Option<&Error>
No public source comment is attached to this declaration.
pub fn new( config: McpServerConfig ) -> Self
No public source comment is attached to this declaration.
fn default() -> Self
No public source comment is attached to this declaration.