pub struct McpServiceRegistry { /* private fields */ }Expand description
Manages MCP services offered to successor proxies and agents.
Use the Self::add_rmcp_server method to register MCP servers implemented using the rmcp crate.
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 registery (or a clone of it) to the JsonRpcConnection so that it can intercept MCP requests.
Typically you do this by providing it as an argument to the [`]
Implementations§
Source§impl McpServiceRegistry
impl McpServiceRegistry
pub fn new() -> Self
Sourcepub fn with_rmcp_server<S>(
self,
name: impl ToString,
make_service: impl Fn() -> S + 'static + Send + Sync,
) -> Result<Self, Error>where
S: Service<RoleServer>,
pub fn with_rmcp_server<S>(
self,
name: impl ToString,
make_service: impl Fn() -> S + 'static + Send + Sync,
) -> Result<Self, Error>where
S: Service<RoleServer>,
Add the MCP server to the registry and return self. Useful for chaining.
Equivalent to Self::add_rmcp_server.
§Parameters
name: The name of the server.make_service: A function that creates the service (e.g.,YourService::new).
Sourcepub fn add_rmcp_server<S>(
&self,
name: impl ToString,
make_service: impl Fn() -> S + 'static + Send + Sync,
) -> Result<(), Error>where
S: Service<RoleServer>,
pub fn add_rmcp_server<S>(
&self,
name: impl ToString,
make_service: impl Fn() -> S + 'static + Send + Sync,
) -> Result<(), Error>where
S: Service<RoleServer>,
Add an MCP server implemented using the rmcp crate.
§Parameters
name: The name of the server.make_service: A function that creates the service (e.g.,YourService::new).
Trait Implementations§
Source§impl AsRef<McpServiceRegistry> for McpServiceRegistry
impl AsRef<McpServiceRegistry> for McpServiceRegistry
Source§fn as_ref(&self) -> &McpServiceRegistry
fn as_ref(&self) -> &McpServiceRegistry
Converts this type into a shared reference of the (usually inferred) input type.
Source§impl Clone for McpServiceRegistry
impl Clone for McpServiceRegistry
Source§fn clone(&self) -> McpServiceRegistry
fn clone(&self) -> McpServiceRegistry
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for McpServiceRegistry
impl Debug for McpServiceRegistry
Source§impl Default for McpServiceRegistry
impl Default for McpServiceRegistry
Source§fn default() -> McpServiceRegistry
fn default() -> McpServiceRegistry
Returns the “default value” for a type. Read more
Source§impl JsonRpcHandler for McpServiceRegistry
impl JsonRpcHandler for McpServiceRegistry
fn describe_chain(&self) -> impl Debug
Source§async fn handle_message(
&mut self,
message: MessageAndCx,
) -> Result<Handled<MessageAndCx>, Error>
async fn handle_message( &mut self, message: MessageAndCx, ) -> Result<Handled<MessageAndCx>, Error>
Attempt to claim an incoming message (request or notification). Read more
Auto Trait Implementations§
impl Freeze for McpServiceRegistry
impl RefUnwindSafe for McpServiceRegistry
impl Send for McpServiceRegistry
impl Sync for McpServiceRegistry
impl Unpin for McpServiceRegistry
impl UnwindSafe for McpServiceRegistry
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