pub struct McpServerManager { /* private fields */ }Expand description
Manages MCP server connections and tool execution.
Implementations§
Source§impl McpServerManager
impl McpServerManager
Sourcepub async fn reconcile_from_config(&self, config: &McpConfig)
pub async fn reconcile_from_config(&self, config: &McpConfig)
Reconcile running MCP servers with the desired configuration.
This is best-effort and will:
- Stop servers that are running but removed/disabled in config.
- Start enabled servers that are not running.
- Restart servers whose effective runtime config changed.
Secrets are compared by their hydrated plaintext (env/header values), not by the encrypted-at-rest blobs (which can change on every save due to random nonces).
Sourcepub async fn initialize_from_config(&self, config: &McpConfig)
pub async fn initialize_from_config(&self, config: &McpConfig)
Initialize from configuration.
Source§impl McpServerManager
impl McpServerManager
Sourcepub async fn start_server(&self, config: McpServerConfig) -> Result<()>
pub async fn start_server(&self, config: McpServerConfig) -> Result<()>
Start a new MCP server connection.
Sourcepub async fn stop_server(&self, server_id: &str) -> Result<()>
pub async fn stop_server(&self, server_id: &str) -> Result<()>
Stop an MCP server connection.
Sourcepub async fn call_tool(
&self,
server_id: &str,
tool_name: &str,
args: Value,
) -> Result<McpCallResult>
pub async fn call_tool( &self, server_id: &str, tool_name: &str, args: Value, ) -> Result<McpCallResult>
Call a tool on a specific server.
Sourcepub fn get_tool_info(&self, server_id: &str, tool_name: &str) -> Option<McpTool>
pub fn get_tool_info(&self, server_id: &str, tool_name: &str) -> Option<McpTool>
Get tool info for a specific tool.
Sourcepub async fn refresh_tools(&self, server_id: &str) -> Result<()>
pub async fn refresh_tools(&self, server_id: &str) -> Result<()>
Refresh tools from a server.
Source§impl McpServerManager
impl McpServerManager
pub fn new() -> Self
Sourcepub fn new_with_config(config: Arc<RwLock<Config>>) -> Self
pub fn new_with_config(config: Arc<RwLock<Config>>) -> Self
Create a manager that can respect global proxy settings when connecting SSE transports.
pub fn with_event_channel(self, tx: Sender<McpEvent>) -> Self
pub fn tool_index(&self) -> Arc<ToolIndex>
Sourcepub fn list_servers(&self) -> Vec<String>
pub fn list_servers(&self) -> Vec<String>
Get all server IDs.
Sourcepub fn get_server_info(&self, server_id: &str) -> Option<RuntimeInfo>
pub fn get_server_info(&self, server_id: &str) -> Option<RuntimeInfo>
Get runtime info for a server.
Sourcepub fn is_server_running(&self, server_id: &str) -> bool
pub fn is_server_running(&self, server_id: &str) -> bool
Check if a server is running.
Sourcepub async fn shutdown_all(&self)
pub async fn shutdown_all(&self)
Shutdown all servers.
Trait Implementations§
Source§impl Clone for McpServerManager
impl Clone for McpServerManager
Auto Trait Implementations§
impl Freeze for McpServerManager
impl !RefUnwindSafe for McpServerManager
impl Send for McpServerManager
impl Sync for McpServerManager
impl Unpin for McpServerManager
impl UnsafeUnpin for McpServerManager
impl !UnwindSafe for McpServerManager
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