pub struct McpRegistry { /* private fields */ }Expand description
Registry of connected MCP servers.
Implementations§
Source§impl McpRegistry
impl McpRegistry
Sourcepub fn with_telemetry(self, tel: Arc<Telemetry>) -> Self
pub fn with_telemetry(self, tel: Arc<Telemetry>) -> Self
Set the telemetry handle for emitting McpConnect events.
Sourcepub fn with_event_channel() -> (Self, UnboundedReceiver<McpConnectEvent>)
pub fn with_event_channel() -> (Self, UnboundedReceiver<McpConnectEvent>)
Create a registry with a channel for connection events.
Sourcepub fn event_sender(&self) -> Option<UnboundedSender<McpConnectEvent>>
pub fn event_sender(&self) -> Option<UnboundedSender<McpConnectEvent>>
Get a clone of the event sender, if configured.
Sourcepub fn from_config_background(project_dir: &Path) -> Self
pub fn from_config_background(project_dir: &Path) -> Self
Load MCP configuration and start connecting to servers in the background. Returns immediately with an empty registry; servers are added as they connect. Connection status events are sent through the internal channel if configured.
Sourcepub fn from_config_background_with_events(
project_dir: &Path,
event_tx: Option<UnboundedSender<McpConnectEvent>>,
) -> Self
pub fn from_config_background_with_events( project_dir: &Path, event_tx: Option<UnboundedSender<McpConnectEvent>>, ) -> Self
Load MCP configuration and start connecting to servers in the background, with an external event channel for TUI status display.
Sourcepub async fn from_config(project_dir: &Path) -> Self
pub async fn from_config(project_dir: &Path) -> Self
Load MCP configuration and connect to all servers (blocking).
Prefer from_config_background for non-blocking startup.
Sourcepub async fn add_server(&self, config: McpServerConfig) -> Result<()>
pub async fn add_server(&self, config: McpServerConfig) -> Result<()>
Add a server to the registry.
Sourcepub async fn list_tools_timeout(&self, server_name: &str) -> Duration
pub async fn list_tools_timeout(&self, server_name: &str) -> Duration
Timeout budget for a slow tools/list operation on a connected server.
The transport already has its own request timeout. This outer budget adds a small grace period so TUI background tasks do not cancel a request right before the transport timeout/error can surface.
Sourcepub async fn list_all_tools(&self) -> Vec<McpToolInfo>
pub async fn list_all_tools(&self) -> Vec<McpToolInfo>
Get all available tools from all connected servers.
Sourcepub async fn list_tools_for_server(&self, server_name: &str) -> Vec<McpToolInfo>
pub async fn list_tools_for_server(&self, server_name: &str) -> Vec<McpToolInfo>
Get tools from a single connected server.
Sourcepub async fn call_tool(
&self,
server_name: &str,
tool_name: &str,
arguments: Value,
) -> Result<String>
pub async fn call_tool( &self, server_name: &str, tool_name: &str, arguments: Value, ) -> Result<String>
Call a tool on a specific server.
Sourcepub async fn server_statuses(&self) -> Vec<(String, ServerStatus)>
pub async fn server_statuses(&self) -> Vec<(String, ServerStatus)>
Get the status of all servers.
Sourcepub async fn wait_for_initial_connections(&self, timeout: Duration)
pub async fn wait_for_initial_connections(&self, timeout: Duration)
Wait for initial background connections to complete (or timeout). Returns immediately if no background connections are pending.
Get an Arc clone for sharing across threads.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for McpRegistry
impl !RefUnwindSafe for McpRegistry
impl Send for McpRegistry
impl Sync for McpRegistry
impl Unpin for McpRegistry
impl UnsafeUnpin for McpRegistry
impl !UnwindSafe for McpRegistry
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
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>
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>
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