pub struct ConfigLoader { /* private fields */ }Expand description
Loader for finding and loading MCP configurations.
This handles platform-specific default locations and searching multiple potential config file paths.
Implementations§
Source§impl ConfigLoader
impl ConfigLoader
Sourcepub fn new() -> ConfigLoader
pub fn new() -> ConfigLoader
Creates a new loader with default search paths.
Sourcepub fn from_path(path: impl Into<PathBuf>) -> ConfigLoader
pub fn from_path(path: impl Into<PathBuf>) -> ConfigLoader
Creates a loader with a single specific path.
Sourcepub fn with_path(self, path: impl Into<PathBuf>) -> ConfigLoader
pub fn with_path(self, path: impl Into<PathBuf>) -> ConfigLoader
Adds a search path.
Sourcepub fn with_priority_path(self, path: impl Into<PathBuf>) -> ConfigLoader
pub fn with_priority_path(self, path: impl Into<PathBuf>) -> ConfigLoader
Prepends a search path (searched first).
Sourcepub fn load(&self) -> Result<McpConfig, ConfigError>
pub fn load(&self) -> Result<McpConfig, ConfigError>
Loads configuration from the first existing file.
§Errors
Returns an error if no configuration file is found or parsing fails.
Sourcepub fn load_all(&self) -> McpConfig
pub fn load_all(&self) -> McpConfig
Loads and merges all existing configuration files.
Later files override earlier ones.
Sourcepub fn search_paths(&self) -> &[PathBuf]
pub fn search_paths(&self) -> &[PathBuf]
Returns all search paths.
Sourcepub fn existing_paths(&self) -> Vec<&PathBuf>
pub fn existing_paths(&self) -> Vec<&PathBuf>
Returns paths that exist.
Trait Implementations§
Source§impl Clone for ConfigLoader
impl Clone for ConfigLoader
Source§fn clone(&self) -> ConfigLoader
fn clone(&self) -> ConfigLoader
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ConfigLoader
impl Debug for ConfigLoader
Source§impl Default for ConfigLoader
impl Default for ConfigLoader
Source§fn default() -> ConfigLoader
fn default() -> ConfigLoader
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for ConfigLoader
impl RefUnwindSafe for ConfigLoader
impl Send for ConfigLoader
impl Sync for ConfigLoader
impl Unpin for ConfigLoader
impl UnwindSafe for ConfigLoader
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, _span: NoopSpan) -> Self
fn instrument(self, _span: NoopSpan) -> Self
Instruments this future with a span (no-op when disabled).
Source§fn in_current_span(self) -> Self
fn in_current_span(self) -> Self
Instruments this future with the current span (no-op when disabled).