pub struct McpManager { /* private fields */ }Expand description
Manages connections to multiple MCP servers and their tools
Implementations§
Source§impl McpManager
impl McpManager
pub fn new( event_sender: Sender<McpClientEvent>, oauth_handler: Option<Arc<dyn OAuthHandler>>, ) -> Self
pub async fn add_mcps(&mut self, configs: Vec<McpServerConfig>) -> Result<()>
pub async fn add_mcp_with_auth( &mut self, name: String, base_url: &str, auth_header: String, ) -> Result<()>
pub async fn add_mcp(&mut self, config: McpServerConfig) -> Result<()>
Sourcepub fn get_client_for_tool(
&self,
namespaced_tool_name: &str,
arguments_json: &str,
) -> Result<(Arc<RunningService<RoleClient, McpClient>>, CallToolRequestParams)>
pub fn get_client_for_tool( &self, namespaced_tool_name: &str, arguments_json: &str, ) -> Result<(Arc<RunningService<RoleClient, McpClient>>, CallToolRequestParams)>
Resolve and route a tool call.
Returns the target MCP client and normalized call params. For proxy
call_tool, this parses the wrapper arguments and forwards to the
selected nested server/tool.
pub fn tool_definitions(&self) -> Vec<ToolDefinition>
Sourcepub fn server_instructions(&self) -> Vec<ServerInstructions>
pub fn server_instructions(&self) -> Vec<ServerInstructions>
Returns instructions from all connected MCP servers that provide them, plus synthesized instructions for tool-proxy groups.
pub fn server_statuses(&self) -> &[McpServerStatusEntry]
Sourcepub async fn authenticate_server(&mut self, name: &str) -> Result<()>
pub async fn authenticate_server(&mut self, name: &str) -> Result<()>
Authenticate a server that previously failed with NeedsOAuth.
Looks up the pending config, runs the OAuth flow, and updates the status entry on success.
Sourcepub async fn list_prompts(&self) -> Result<Vec<Prompt>>
pub async fn list_prompts(&self) -> Result<Vec<Prompt>>
List all prompts from all connected MCP servers with namespacing
Sourcepub async fn get_prompt(
&self,
namespaced_prompt_name: &str,
arguments: Option<Map<String, Value>>,
) -> Result<GetPromptResult>
pub async fn get_prompt( &self, namespaced_prompt_name: &str, arguments: Option<Map<String, Value>>, ) -> Result<GetPromptResult>
Get a specific prompt by namespaced name
Sourcepub async fn shutdown_server(&mut self, server_name: &str) -> Result<()>
pub async fn shutdown_server(&mut self, server_name: &str) -> Result<()>
Shutdown a specific server by name
Trait Implementations§
Auto Trait Implementations§
impl Freeze for McpManager
impl !RefUnwindSafe for McpManager
impl Send for McpManager
impl Sync for McpManager
impl Unpin for McpManager
impl UnsafeUnpin for McpManager
impl !UnwindSafe for McpManager
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