pub struct McpServer<Counterpart: Role, Run = NullRun> { /* private fields */ }Expand description
An MCP server that can be attached to ACP connections.
McpServer wraps an McpServerConnect implementation and can be used either:
- As a message handler via
Builder::with_handler, automatically attaching to new sessions - Manually for more control
§Creating an MCP Server
The agent-client-protocol-rmcp crate provides builder APIs for MCP tools
backed by the rmcp crate.
Or implement McpServerConnect for custom server behavior:
ⓘ
let server = McpServer::new(MyCustomServerConnect);Implementations§
Source§impl<Counterpart: Role, Run> McpServer<Counterpart, Run>where
Run: RunWithConnectionTo<Counterpart>,
impl<Counterpart: Role, Run> McpServer<Counterpart, Run>where
Run: RunWithConnectionTo<Counterpart>,
Sourcepub fn new(c: impl McpServerConnect<Counterpart>, responder: Run) -> Self
pub fn new(c: impl McpServerConnect<Counterpart>, responder: Run) -> Self
Create an MCP server from something that implements the McpServerConnect trait.
§See also
See agent-client-protocol-rmcp to construct MCP servers from Rust code
with rmcp.
Trait Implementations§
Auto Trait Implementations§
impl<Counterpart, Run> Freeze for McpServer<Counterpart, Run>where
Run: Freeze,
impl<Counterpart, Run = NullRun> !RefUnwindSafe for McpServer<Counterpart, Run>
impl<Counterpart, Run> Send for McpServer<Counterpart, Run>where
Run: Send,
impl<Counterpart, Run> Sync for McpServer<Counterpart, Run>where
Run: Sync,
impl<Counterpart, Run> Unpin for McpServer<Counterpart, Run>
impl<Counterpart, Run> UnsafeUnpin for McpServer<Counterpart, Run>where
Run: UnsafeUnpin,
impl<Counterpart, Run = NullRun> !UnwindSafe for McpServer<Counterpart, Run>
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