pub struct McpConnectionManager { /* private fields */ }Expand description
A thin wrapper around a set of running [RmcpClient] instances.
Implementations§
Source§impl McpConnectionManager
impl McpConnectionManager
Sourcepub async fn validate_required_servers(&self) -> Result<()>
pub async fn validate_required_servers(&self) -> Result<()>
Waits for every required server and reports their startup failures together.
Callers must make the manager reachable to request handlers before awaiting this method, because server initialization may require client elicitation.
Source§impl McpConnectionManager
impl McpConnectionManager
Sourcepub async fn list_all_tools(&self) -> Vec<ToolInfo>
pub async fn list_all_tools(&self) -> Vec<ToolInfo>
Returns all tools with model-visible names normalized.
Sourcepub async fn tool_info(&self, server: &str, tool: &str) -> Option<ToolInfo>
pub async fn tool_info(&self, server: &str, tool: &str) -> Option<ToolInfo>
Returns one tool from the current live connection.
Sourcepub async fn capture_binding_with_metadata(
self: &Arc<Self>,
config: Arc<McpConfig>,
plugins_available: bool,
) -> McpBinding
pub async fn capture_binding_with_metadata( self: &Arc<Self>, config: Arc<McpConfig>, plugins_available: bool, ) -> McpBinding
Captures the ready clients, their exact tools, and the supplied runtime metadata.
Sourcepub async fn hard_refresh_codex_apps_tools_cache(&self) -> Result<Vec<ToolInfo>>
pub async fn hard_refresh_codex_apps_tools_cache(&self) -> Result<Vec<ToolInfo>>
Force-refresh codex apps tools by bypassing the in-process cache.
On success, the refreshed tools replace shared cache contents when the cache is enabled and the latest filtered tools are returned directly to the caller. On failure, existing shared cache contents remain unchanged.
Source§impl McpConnectionManager
impl McpConnectionManager
Sourcepub async fn new(
mcp_servers: &HashMap<String, EffectiveMcpServer>,
store_mode: OAuthCredentialsStoreMode,
keyring_backend_kind: AuthKeyringBackendKind,
approval_policy: &Constrained<AskForApproval>,
submit_id: String,
tx_event: Option<Sender<Event>>,
startup_cancellation_token: CancellationToken,
initial_permission_profile: PermissionProfile,
runtime_context: McpRuntimeContext,
codex_home: PathBuf,
codex_apps_tools_cache: ConnectorRuntimeManager<ToolInfo>,
tool_catalog_cache: McpToolCatalogCache,
codex_apps_tools_cache_key: ConnectorRuntimeContextKey,
prefix_mcp_tool_names: bool,
client_elicitation_capability: ElicitationCapability,
supports_openai_form_elicitation: bool,
tool_plugin_provenance: ToolPluginProvenance,
auth: Option<&CodexAuth>,
codex_apps_auth_manager: Option<Arc<AuthManager>>,
elicitation_reviewer: Option<ElicitationReviewerHandle>,
elicitation_lifecycle: Option<ElicitationLifecycle>,
elicitation_router: ElicitationRequestRouter,
) -> Self
pub async fn new( mcp_servers: &HashMap<String, EffectiveMcpServer>, store_mode: OAuthCredentialsStoreMode, keyring_backend_kind: AuthKeyringBackendKind, approval_policy: &Constrained<AskForApproval>, submit_id: String, tx_event: Option<Sender<Event>>, startup_cancellation_token: CancellationToken, initial_permission_profile: PermissionProfile, runtime_context: McpRuntimeContext, codex_home: PathBuf, codex_apps_tools_cache: ConnectorRuntimeManager<ToolInfo>, tool_catalog_cache: McpToolCatalogCache, codex_apps_tools_cache_key: ConnectorRuntimeContextKey, prefix_mcp_tool_names: bool, client_elicitation_capability: ElicitationCapability, supports_openai_form_elicitation: bool, tool_plugin_provenance: ToolPluginProvenance, auth: Option<&CodexAuth>, codex_apps_auth_manager: Option<Arc<AuthManager>>, elicitation_reviewer: Option<ElicitationReviewerHandle>, elicitation_lifecycle: Option<ElicitationLifecycle>, elicitation_router: ElicitationRequestRouter, ) -> Self
Creates an MCP connection manager. Threadless callers can pass no tx_event; startup
notifications are then skipped and interactive elicitations are declined.
pub fn new_uninitialized_with_permission_profile( approval_policy: &Constrained<AskForApproval>, permission_profile: &PermissionProfile, prefix_mcp_tool_names: bool, ) -> Self
pub fn empty(prefix_mcp_tool_names: bool) -> Self
pub fn has_servers(&self) -> bool
Sourcepub async fn shutdown(&self)
pub async fn shutdown(&self)
Stop all MCP clients owned by this manager and terminate stdio server processes.
pub fn server_origin(&self, server_name: &str) -> Option<&str>
pub fn server_environment_id(&self, server_name: &str) -> Option<&str>
pub fn server_pollutes_memory(&self, server_name: &str) -> bool
pub fn plugin_id_for_mcp_server_name(&self, server_name: &str) -> Option<&str>
pub fn is_selected_plugin_mcp_server(&self, server_name: &str) -> bool
pub fn tool_approval_mode( &self, server_name: &str, tool_name: &str, ) -> AppToolApproval
pub fn is_host_owned_codex_apps_server(&self, server_name: &str) -> bool
pub fn set_approval_policy(&self, approval_policy: &Constrained<AskForApproval>)
pub fn set_permission_profile(&self, permission_profile: PermissionProfile)
pub fn elicitations_auto_deny(&self) -> bool
pub fn set_elicitations_auto_deny(&self, auto_deny: bool)
pub fn elicitation_router(&self) -> ElicitationRequestRouter
pub async fn resolve_elicitation( &self, server_name: String, id: RequestId, response: ElicitationResponse, ) -> Result<()>
pub async fn wait_for_server_ready( &self, server_name: &str, timeout: Duration, ) -> bool
Sourcepub async fn list_all_resources(
&self,
include_server: impl Fn(&str) -> bool,
) -> HashMap<String, Vec<Resource>>
pub async fn list_all_resources( &self, include_server: impl Fn(&str) -> bool, ) -> HashMap<String, Vec<Resource>>
Returns resources from servers selected by include_server. Each key
is the server name and the value is a vector of resources.
Sourcepub async fn list_all_resource_templates(
&self,
include_server: impl Fn(&str) -> bool,
) -> HashMap<String, Vec<ResourceTemplate>>
pub async fn list_all_resource_templates( &self, include_server: impl Fn(&str) -> bool, ) -> HashMap<String, Vec<ResourceTemplate>>
Returns resource templates from servers selected by include_server.
Each key is the server name and the value is a vector of templates.
Sourcepub async fn call_tool(
&self,
server: &str,
tool: &str,
arguments: Option<Value>,
meta: Option<Value>,
) -> Result<CallToolResult>
pub async fn call_tool( &self, server: &str, tool: &str, arguments: Option<Value>, meta: Option<Value>, ) -> Result<CallToolResult>
Invoke the tool indicated by the (server, tool) pair.
pub async fn server_supports_sandbox_state_meta_capability( &self, server: &str, ) -> Result<bool>
Sourcepub async fn list_resources(
&self,
server: &str,
params: Option<PaginatedRequestParams>,
) -> Result<ListResourcesResult>
pub async fn list_resources( &self, server: &str, params: Option<PaginatedRequestParams>, ) -> Result<ListResourcesResult>
List resources from the specified server.
Sourcepub async fn list_resource_templates(
&self,
server: &str,
params: Option<PaginatedRequestParams>,
) -> Result<ListResourceTemplatesResult>
pub async fn list_resource_templates( &self, server: &str, params: Option<PaginatedRequestParams>, ) -> Result<ListResourceTemplatesResult>
List resource templates from the specified server.
Sourcepub async fn read_resource(
&self,
server: &str,
params: ReadResourceRequestParams,
) -> Result<ReadResourceResult>
pub async fn read_resource( &self, server: &str, params: ReadResourceRequestParams, ) -> Result<ReadResourceResult>
Read a resource from the specified server.
Trait Implementations§
Source§impl Drop for McpConnectionManager
impl Drop for McpConnectionManager
Auto Trait Implementations§
impl !Freeze for McpConnectionManager
impl !RefUnwindSafe for McpConnectionManager
impl !UnwindSafe for McpConnectionManager
impl Send for McpConnectionManager
impl Sync for McpConnectionManager
impl Unpin for McpConnectionManager
impl UnsafeUnpin for McpConnectionManager
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<T> AsTypeStaticRegistered for T
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
impl<T> HasTyVTable for Twhere
T: ?Sized,
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 moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request