pub struct McpServer { /* private fields */ }Expand description
MCP server
Implementations§
Source§impl McpServer
impl McpServer
Sourcepub fn with_public_mode(self, enabled: bool) -> Self
pub fn with_public_mode(self, enabled: bool) -> Self
Enable public mode: only read-only tools are available.
Sourcepub fn connection_pool(&self) -> &ConnectionPool
pub fn connection_pool(&self) -> &ConnectionPool
Get the connection pool
Sourcepub async fn state(&self) -> ServerState
pub async fn state(&self) -> ServerState
Get current server state
Sourcepub async fn handle_initialize(
&self,
params: InitializeParams,
) -> McpResult<InitializeResult>
pub async fn handle_initialize( &self, params: InitializeParams, ) -> McpResult<InitializeResult>
Handle MCP initialize request
This is the first method that must be called by the client. It negotiates protocol version and capabilities.
Sourcepub async fn handle_tools_list(&self) -> McpResult<ToolsListResult>
pub async fn handle_tools_list(&self) -> McpResult<ToolsListResult>
Handle tools/list request
Returns the list of available tools with their schemas.
Sourcepub async fn handle_tools_call(
&self,
params: ToolCallParams,
) -> McpResult<ToolCallResult>
pub async fn handle_tools_call( &self, params: ToolCallParams, ) -> McpResult<ToolCallResult>
Handle tools/call request
Dispatches tool calls to the appropriate handler.
Sourcepub async fn handle_resources_list(&self) -> McpResult<ResourcesListResult>
pub async fn handle_resources_list(&self) -> McpResult<ResourcesListResult>
Handle resources/list request
Returns the list of available resources.
Sourcepub async fn handle_resources_read(
&self,
params: ResourceReadParams,
) -> McpResult<ResourceReadResult>
pub async fn handle_resources_read( &self, params: ResourceReadParams, ) -> McpResult<ResourceReadResult>
Handle resources/read request
Reads the content of a specific resource by URI.
Sourcepub async fn handle_prompts_list(&self) -> McpResult<PromptsListResult>
pub async fn handle_prompts_list(&self) -> McpResult<PromptsListResult>
Handle prompts/list request
Returns the list of available prompts.
Sourcepub async fn handle_prompts_get(
&self,
params: PromptsGetParams,
) -> McpResult<PromptsGetResult>
pub async fn handle_prompts_get( &self, params: PromptsGetParams, ) -> McpResult<PromptsGetResult>
Handle prompts/get request
Returns a specific prompt with its messages.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for McpServer
impl !RefUnwindSafe for McpServer
impl Send for McpServer
impl Sync for McpServer
impl Unpin for McpServer
impl UnsafeUnpin for McpServer
impl !UnwindSafe for McpServer
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