pub struct McpClient {
pub providers: HashMap<String, Arc<McpProvider>>,
/* private fields */
}
Expand description
High-level MCP client that manages multiple providers
Fields§
§providers: HashMap<String, Arc<McpProvider>>
Implementations§
Source§impl McpClient
impl McpClient
Sourcepub fn new(config: McpClientConfig) -> Self
pub fn new(config: McpClientConfig) -> Self
Create a new MCP client with the given configuration
Sourcepub fn provider_for_tool(&self, tool_name: &str) -> Option<String>
pub fn provider_for_tool(&self, tool_name: &str) -> Option<String>
Retrieve provider reference for a known tool name
Sourcepub fn update_allowlist(&self, allowlist: McpAllowListConfig)
pub fn update_allowlist(&self, allowlist: McpAllowListConfig)
Replace the in-memory MCP allow list with the provided configuration
Sourcepub fn current_allowlist(&self) -> McpAllowListConfig
pub fn current_allowlist(&self) -> McpAllowListConfig
Get a clone of the current allow list
Sourcepub async fn initialize(&mut self) -> Result<()>
pub async fn initialize(&mut self) -> Result<()>
Initialize the MCP client and connect to configured providers
Sourcepub async fn cleanup_dead_providers(&self) -> Result<()>
pub async fn cleanup_dead_providers(&self) -> Result<()>
Clean up providers with terminated processes
Sourcepub async fn list_tools(&self) -> Result<Vec<McpToolInfo>>
pub async fn list_tools(&self) -> Result<Vec<McpToolInfo>>
List all available MCP tools across all providers
Source§impl McpClient
impl McpClient
Sourcepub fn get_status(&self) -> McpClientStatus
pub fn get_status(&self) -> McpClientStatus
Get MCP client status information
Trait Implementations§
Source§impl McpToolExecutor for McpClient
impl McpToolExecutor for McpClient
Source§fn execute_mcp_tool<'life0, 'life1, 'async_trait>(
&'life0 self,
tool_name: &'life1 str,
args: Value,
) -> Pin<Box<dyn Future<Output = Result<Value>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn execute_mcp_tool<'life0, 'life1, 'async_trait>(
&'life0 self,
tool_name: &'life1 str,
args: Value,
) -> Pin<Box<dyn Future<Output = Result<Value>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Execute an MCP tool
Source§fn list_mcp_tools<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<McpToolInfo>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn list_mcp_tools<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<McpToolInfo>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
List available MCP tools
Source§fn has_mcp_tool<'life0, 'life1, 'async_trait>(
&'life0 self,
tool_name: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn has_mcp_tool<'life0, 'life1, 'async_trait>(
&'life0 self,
tool_name: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Check if an MCP tool exists
Source§fn get_status(&self) -> McpClientStatus
fn get_status(&self) -> McpClientStatus
Get MCP client status information
Auto Trait Implementations§
impl Freeze for McpClient
impl !RefUnwindSafe for McpClient
impl Send for McpClient
impl Sync for McpClient
impl Unpin for McpClient
impl !UnwindSafe for McpClient
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> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more