Skip to main content

ConfigManager

Trait ConfigManager 

Source
pub trait ConfigManager: Send + Sync {
Show 18 methods // Required methods fn load<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = McpResult<()>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn reload<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = McpResult<()>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn get_servers(&self) -> HashMap<String, McpServerConfig>; fn get_server(&self, name: &str) -> Option<McpServerConfig>; fn add_server<'life0, 'life1, 'async_trait>( &'life0 self, name: &'life1 str, config: McpServerConfig, ) -> Pin<Box<dyn Future<Output = McpResult<()>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn update_server<'life0, 'life1, 'async_trait>( &'life0 self, name: &'life1 str, config: McpServerConfig, ) -> Pin<Box<dyn Future<Output = McpResult<()>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn remove_server<'life0, 'life1, 'async_trait>( &'life0 self, name: &'life1 str, ) -> Pin<Box<dyn Future<Output = McpResult<bool>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn enable_server<'life0, 'life1, 'async_trait>( &'life0 self, name: &'life1 str, ) -> Pin<Box<dyn Future<Output = McpResult<()>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn disable_server<'life0, 'life1, 'async_trait>( &'life0 self, name: &'life1 str, ) -> Pin<Box<dyn Future<Output = McpResult<()>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn get_enabled_servers(&self) -> HashMap<String, McpServerConfig>; fn validate(&self, config: &McpServerConfig) -> ValidationResult; fn validate_all(&self) -> Vec<ServerValidationResult>; fn save<'life0, 'async_trait>( &'life0 self, scope: ConfigScope, ) -> Pin<Box<dyn Future<Output = McpResult<()>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn backup<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = McpResult<PathBuf>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn restore<'life0, 'life1, 'async_trait>( &'life0 self, backup_path: &'life1 Path, ) -> Pin<Box<dyn Future<Output = McpResult<()>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn export(&self, mask_secrets: bool) -> String; fn import<'life0, 'life1, 'async_trait>( &'life0 self, config_json: &'life1 str, scope: ConfigScope, ) -> Pin<Box<dyn Future<Output = McpResult<()>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn on_change( &self, callback: ConfigChangeCallback, ) -> Box<dyn FnOnce() + Send>;
}
Expand description

Configuration manager trait

Defines the interface for managing MCP server configurations.

Required Methods§

Source

fn load<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = McpResult<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Load configurations from files

Source

fn reload<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = McpResult<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Reload configurations

Source

fn get_servers(&self) -> HashMap<String, McpServerConfig>

Get all server configurations (merged)

Source

fn get_server(&self, name: &str) -> Option<McpServerConfig>

Get a single server configuration

Source

fn add_server<'life0, 'life1, 'async_trait>( &'life0 self, name: &'life1 str, config: McpServerConfig, ) -> Pin<Box<dyn Future<Output = McpResult<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Add a new server configuration

Source

fn update_server<'life0, 'life1, 'async_trait>( &'life0 self, name: &'life1 str, config: McpServerConfig, ) -> Pin<Box<dyn Future<Output = McpResult<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Update an existing server configuration

Source

fn remove_server<'life0, 'life1, 'async_trait>( &'life0 self, name: &'life1 str, ) -> Pin<Box<dyn Future<Output = McpResult<bool>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Remove a server configuration

Source

fn enable_server<'life0, 'life1, 'async_trait>( &'life0 self, name: &'life1 str, ) -> Pin<Box<dyn Future<Output = McpResult<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Enable a server

Source

fn disable_server<'life0, 'life1, 'async_trait>( &'life0 self, name: &'life1 str, ) -> Pin<Box<dyn Future<Output = McpResult<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Disable a server

Source

fn get_enabled_servers(&self) -> HashMap<String, McpServerConfig>

Get enabled servers only

Source

fn validate(&self, config: &McpServerConfig) -> ValidationResult

Validate a server configuration

Source

fn validate_all(&self) -> Vec<ServerValidationResult>

Validate all server configurations

Source

fn save<'life0, 'async_trait>( &'life0 self, scope: ConfigScope, ) -> Pin<Box<dyn Future<Output = McpResult<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Save configurations to file

Source

fn backup<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = McpResult<PathBuf>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Backup current configuration

Source

fn restore<'life0, 'life1, 'async_trait>( &'life0 self, backup_path: &'life1 Path, ) -> Pin<Box<dyn Future<Output = McpResult<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Restore configuration from backup

Source

fn export(&self, mask_secrets: bool) -> String

Export configuration as JSON string

Source

fn import<'life0, 'life1, 'async_trait>( &'life0 self, config_json: &'life1 str, scope: ConfigScope, ) -> Pin<Box<dyn Future<Output = McpResult<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Import configuration from JSON string

Source

fn on_change(&self, callback: ConfigChangeCallback) -> Box<dyn FnOnce() + Send>

Register a callback for configuration changes

Implementors§