pub(crate) struct McpHosts {
servers: HashMap<String, McpServer>,
external: HashMap<String, McpServerConfig>,
}Expand description
Registry of MCP servers (both in-process SDK and external stdio /
SSE / HTTP). Keyed by the name under which the caller registered
them via OptionsBuilder::mcp_server / external_mcp_server.
Fields§
§servers: HashMap<String, McpServer>§external: HashMap<String, McpServerConfig>Implementations§
Source§impl McpHosts
impl McpHosts
Sourcepub(crate) fn new(
sdk_entries: Vec<(String, McpServer)>,
external: HashMap<String, McpServerConfig>,
) -> Self
pub(crate) fn new( sdk_entries: Vec<(String, McpServer)>, external: HashMap<String, McpServerConfig>, ) -> Self
Build from the Options.mcp_servers vector of in-process servers
plus a HashMap of external configs. Either side may be empty.
Sourcepub(crate) fn config_argv(&self) -> String
pub(crate) fn config_argv(&self) -> String
Build the --mcp-config inline JSON argument. SDK servers emit
{"type":"sdk","name":<n>}; external servers serialise via
McpServerConfig’s own serde impl. Returns "{"mcpServers":{}}"
when empty - caller should skip adding the flag in that case.
Sourcepub(crate) async fn dispatch(
&self,
server_name: &str,
req: &JsonRpcRequest,
) -> Dispatched
pub(crate) async fn dispatch( &self, server_name: &str, req: &JsonRpcRequest, ) -> Dispatched
Route an incoming mcp_message to the named server.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for McpHosts
impl !UnwindSafe for McpHosts
impl Freeze for McpHosts
impl Send for McpHosts
impl Sync for McpHosts
impl Unpin for McpHosts
impl UnsafeUnpin for McpHosts
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