pub struct McpServiceRegistry { /* private fields */ }Expand description
Manages MCP services offered to successor proxies and agents.
Use the Self::add_mcp_server method to register MCP servers. For rmcp-based servers,
use the sacp-rmcp crate which provides convenient extension methods.
This struct is a handle to the underlying registry. Cloning the struct produces a second handle to the same registry.
§Handling requests
You must add the registry (or a clone of it) to the JrHandlerChain so that it can intercept MCP requests.
Typically you do this by providing it as an argument to the handler chain methods.
Implementations§
Source§impl McpServiceRegistry
impl McpServiceRegistry
Sourcepub fn add_mcp_server<C: Component>(
&self,
name: impl ToString,
new_fn: impl Fn() -> C + Send + Sync + 'static,
) -> Result<(), Error>
pub fn add_mcp_server<C: Component>( &self, name: impl ToString, new_fn: impl Fn() -> C + Send + Sync + 'static, ) -> Result<(), Error>
Add an MCP server to the registry using a custom spawner.
This is the base method for adding MCP servers. Use this if you have a custom way to create Component instances for your MCP server.
For rmcp-based servers, use the sacp-rmcp crate which provides convenient
extension methods.
§Parameters
name: The name of the server.spawner: A trait object that can create Component instances.
Trait Implementations§
Source§impl AsRef<McpServiceRegistry> for McpServiceRegistry
impl AsRef<McpServiceRegistry> for McpServiceRegistry
Source§fn as_ref(&self) -> &McpServiceRegistry
fn as_ref(&self) -> &McpServiceRegistry
Source§impl Clone for McpServiceRegistry
impl Clone for McpServiceRegistry
Source§fn clone(&self) -> McpServiceRegistry
fn clone(&self) -> McpServiceRegistry
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more