Rename the MCP connection manager to McpConnectionSet (#34708)

## What changed

- Use `McpConnectionSet` as the primary name for the collection of active MCP
  server connections throughout `codex-mcp` and its callers.
- Keep `McpConnectionManager` as a backward-compatible type alias.

GitOrigin-RevId: 9753838b4fd0a0b6429a9c4af0c077137616f388
This commit is contained in:
jif
2026-07-22 09:25:22 +00:00
committed by copyberry
parent 6e5a2d6b8d
commit 516f1e2aff
21 changed files with 86 additions and 85 deletions
@@ -6,7 +6,7 @@ use codex_connectors::connector_tool_is_synthetic;
use codex_connectors::installed_connector_runtime;
use codex_mcp::CODEX_APPS_MCP_SERVER_NAME;
use codex_mcp::MCP_TOOL_CODEX_APPS_META_KEY;
use codex_mcp::McpConnectionManager;
use codex_mcp::McpConnectionSet;
use codex_mcp::ToolInfo;
use codex_mcp::effective_mcp_servers;
use codex_mcp::host_owned_codex_apps_enabled;
@@ -78,7 +78,7 @@ impl AppsRequestProcessor {
let codex_apps_auth_manager =
host_owned_codex_apps_enabled(&mcp_config, auth.as_ref())
.then(|| Arc::clone(&self.auth_manager));
let connection_manager = McpConnectionManager::new(
let connection_manager = McpConnectionSet::new(
&mcp_servers,
config.mcp_oauth_credentials_store_mode,
config.auth_keyring_backend_kind(),
+6 -6
View File
@@ -21,7 +21,7 @@ use tokio::sync::RwLock;
use crate::McpConfig;
use crate::binding_clients::McpBindingClients;
use crate::connection_manager::McpConnectionManager;
use crate::connection_manager::McpConnectionSet;
use crate::resource_client::McpResourceClient;
use crate::rmcp_client::ManagedClient;
use crate::server::McpServerMetadata;
@@ -29,7 +29,7 @@ use crate::tools::ToolInfo;
/// The exact tool catalog and execution handles for one model sampling request.
pub struct McpBinding {
connections: Arc<McpConnectionManager>,
connections: Arc<McpConnectionSet>,
clients: Arc<McpBindingClients>,
config: Arc<McpConfig>,
plugins_available: bool,
@@ -41,7 +41,7 @@ impl McpBinding {
/// Creates an empty binding for tests and callers without a materialized runtime.
pub fn empty(config: Arc<McpConfig>) -> Self {
Self::new(
Arc::new(McpConnectionManager::empty(config.prefix_mcp_tool_names)),
Arc::new(McpConnectionSet::empty(config.prefix_mcp_tool_names)),
Arc::new(McpBindingClients::new(HashMap::new())),
config,
/*plugins_available*/ false,
@@ -51,7 +51,7 @@ impl McpBinding {
}
pub(crate) fn new(
connections: Arc<McpConnectionManager>,
connections: Arc<McpConnectionSet>,
clients: Arc<McpBindingClients>,
config: Arc<McpConfig>,
plugins_available: bool,
@@ -152,7 +152,7 @@ impl fmt::Debug for McpBinding {
/// one [`McpBinding`].
#[derive(Clone)]
pub struct PreparedMcpCall {
_connections: Arc<McpConnectionManager>,
_connections: Arc<McpConnectionSet>,
client: Arc<ManagedClient>,
catalog_revision: u64,
catalog_revision_source: Arc<RwLock<u64>>,
@@ -169,7 +169,7 @@ impl PreparedMcpCall {
reason = "the exact call authority stays together"
)]
pub(crate) fn new(
connections: Arc<McpConnectionManager>,
connections: Arc<McpConnectionSet>,
client: Arc<ManagedClient>,
catalog_revision: u64,
catalog_revision_source: Arc<RwLock<u64>>,
+6 -8
View File
@@ -21,7 +21,7 @@ use tokio::sync::Notify;
use super::McpBinding;
use super::PreparedMcpCall;
use crate::binding_clients::McpBindingClients;
use crate::connection_manager::McpConnectionManager;
use crate::connection_manager::McpConnectionSet;
use crate::rmcp_client::ManagedClient;
use crate::server::McpServerMetadata;
use crate::server::McpServerOrigin;
@@ -97,13 +97,11 @@ async fn test_step(
SERVER_NAME.to_string(),
Arc::clone(&managed_client),
)])));
let connections = Arc::new(
McpConnectionManager::new_uninitialized_with_permission_profile(
&Constrained::allow_any(AskForApproval::OnRequest),
&PermissionProfile::default(),
/*prefix_mcp_tool_names*/ true,
),
);
let connections = Arc::new(McpConnectionSet::new_uninitialized_with_permission_profile(
&Constrained::allow_any(AskForApproval::OnRequest),
&PermissionProfile::default(),
/*prefix_mcp_tool_names*/ true,
));
let tool_catalog_revision = Arc::new(tokio::sync::RwLock::new(0));
let prepared = PreparedMcpCall::new(
Arc::clone(&connections),
+4 -4
View File
@@ -1,6 +1,6 @@
//! Aggregates MCP server connections for Codex.
//!
//! [`McpConnectionManager`] owns the set of running async RMCP clients keyed by
//! [`McpConnectionSet`] owns the set of running async RMCP clients keyed by
//! MCP server name. It coordinates startup status events, keeps server origin
//! metadata, aggregates tools/resources/templates across servers, routes tool
//! calls to the right client, and exposes the public manager API used by
@@ -107,7 +107,7 @@ pub fn tool_is_model_visible(tool: &ToolInfo) -> bool {
}
/// A thin wrapper around a set of running [`RmcpClient`] instances.
pub struct McpConnectionManager {
pub struct McpConnectionSet {
clients: HashMap<String, AsyncManagedClient>,
server_metadata: HashMap<String, McpServerMetadata>,
required_servers: Vec<String>,
@@ -120,7 +120,7 @@ pub struct McpConnectionManager {
startup_cancellation_token: CancellationToken,
}
impl McpConnectionManager {
impl McpConnectionSet {
/// Creates an MCP connection manager. Threadless callers can pass no `tx_event`; startup
/// notifications are then skipped and interactive elicitations are declined.
#[allow(clippy::too_many_arguments)]
@@ -725,7 +725,7 @@ impl McpConnectionManager {
}
}
impl Drop for McpConnectionManager {
impl Drop for McpConnectionSet {
fn drop(&mut self) {
self.startup_cancellation_token.cancel();
self.clients.clear();
@@ -4,10 +4,10 @@ use codex_protocol::protocol::McpStartupFailure;
use tracing::Instrument;
use tracing::info_span;
use super::McpConnectionManager;
use super::McpConnectionSet;
use crate::rmcp_client::StartupOutcomeError;
impl McpConnectionManager {
impl McpConnectionSet {
/// Waits for every required server and reports their startup failures together.
///
/// Callers must make the manager reachable to request handlers before awaiting this method,
@@ -10,7 +10,7 @@ use tracing::instrument;
use tracing::trace;
use tracing::trace_span;
use super::McpConnectionManager;
use super::McpConnectionSet;
use crate::binding::McpBinding;
use crate::binding::PreparedMcpCall;
use crate::binding_clients::McpBindingClients;
@@ -25,7 +25,7 @@ use crate::tools::ToolInfo;
use crate::tools::filter_tools;
use crate::tools::normalize_tools_for_model_with_prefix;
impl McpConnectionManager {
impl McpConnectionSet {
/// Returns all tools with model-visible names normalized.
#[instrument(level = "trace", skip_all, fields(mcp_server_count = self.clients.len()))]
pub async fn list_all_tools(&self) -> Vec<ToolInfo> {
@@ -107,7 +107,7 @@ fn store_current_tools(cache_context: &ConnectorRuntimeContext<ToolInfo>, tools:
);
}
async fn capture_binding(manager: &Arc<McpConnectionManager>) -> McpBinding {
async fn capture_binding(manager: &Arc<McpConnectionSet>) -> McpBinding {
manager
.capture_binding_with_metadata(
Arc::new(crate::mcp::tests::test_mcp_config(std::env::temp_dir())),
@@ -229,7 +229,7 @@ async fn create_test_manager_with_ready_apps_client(
tool_name: &str,
list_started: Option<Arc<Notify>>,
release_list: Option<Arc<Notify>>,
) -> anyhow::Result<Arc<McpConnectionManager>> {
) -> anyhow::Result<Arc<McpConnectionSet>> {
let tool = create_test_tool(CODEX_APPS_MCP_SERVER_NAME, tool_name);
let client = Arc::new(
RmcpClient::new_in_process_client(Arc::new(RefreshTestTransportFactory {
@@ -263,7 +263,7 @@ async fn create_test_manager_with_ready_apps_client(
};
let approval_policy = Constrained::allow_any(AskForApproval::OnRequest);
let permission_profile = Constrained::allow_any(PermissionProfile::default());
let mut manager = McpConnectionManager::new_uninitialized(
let mut manager = McpConnectionSet::new_uninitialized(
&approval_policy,
&permission_profile,
/*prefix_mcp_tool_names*/ true,
@@ -304,7 +304,7 @@ async fn create_test_manager_with_ready_apps_client(
fn create_test_manager_with_failed_apps_startup(
cached_tools: Vec<ToolInfo>,
reconnect_factory: Arc<dyn Fn() -> ManagedClientFuture + Send + Sync>,
) -> McpConnectionManager {
) -> McpConnectionSet {
let client: ManagedClientFuture = futures::future::ready(Err(StartupOutcomeError::Failed {
error: "startup failed".to_string(),
is_authentication_required: false,
@@ -320,7 +320,7 @@ fn create_test_manager_with_failed_apps_startup(
store_current_tools(&cache_context, cached_tools);
let approval_policy = Constrained::allow_any(AskForApproval::OnRequest);
let permission_profile = Constrained::allow_any(PermissionProfile::default());
let mut manager = McpConnectionManager::new_uninitialized(
let mut manager = McpConnectionSet::new_uninitialized(
&approval_policy,
&permission_profile,
/*prefix_mcp_tool_names*/ true,
@@ -862,7 +862,7 @@ async fn list_all_tools_uses_shared_codex_apps_cache_while_client_is_pending() {
.shared();
let approval_policy = Constrained::allow_any(AskForApproval::OnRequest);
let permission_profile = Constrained::allow_any(PermissionProfile::default());
let mut manager = McpConnectionManager::new_uninitialized(
let mut manager = McpConnectionSet::new_uninitialized(
&approval_policy,
&permission_profile,
/*prefix_mcp_tool_names*/ true,
@@ -923,7 +923,7 @@ async fn capture_binding_uses_the_ready_clients_own_tools() {
ready_client.codex_apps_tools_cache_context = Some(cache_context.clone());
let approval_policy = Constrained::allow_any(AskForApproval::OnRequest);
let permission_profile = Constrained::allow_any(PermissionProfile::default());
let mut manager = McpConnectionManager::new_uninitialized(
let mut manager = McpConnectionSet::new_uninitialized(
&approval_policy,
&permission_profile,
/*prefix_mcp_tool_names*/ true,
@@ -1178,7 +1178,7 @@ async fn list_available_server_infos_uses_cache_while_client_is_pending() {
.shared();
let approval_policy = Constrained::allow_any(AskForApproval::OnRequest);
let permission_profile = Constrained::allow_any(PermissionProfile::default());
let mut manager = McpConnectionManager::new_uninitialized(
let mut manager = McpConnectionSet::new_uninitialized(
&approval_policy,
&permission_profile,
/*prefix_mcp_tool_names*/ true,
@@ -1218,7 +1218,7 @@ async fn list_all_tools_accepts_canonical_namespaced_tool_names() {
create_ready_async_managed_client(vec![create_test_tool("rmcp", "echo")]).await;
let approval_policy = Constrained::allow_any(AskForApproval::OnRequest);
let permission_profile = Constrained::allow_any(PermissionProfile::default());
let mut manager = McpConnectionManager::new_uninitialized(
let mut manager = McpConnectionSet::new_uninitialized(
&approval_policy,
&permission_profile,
/*prefix_mcp_tool_names*/ false,
@@ -1276,7 +1276,7 @@ async fn capture_binding_waits_for_fresh_startup_even_with_cached_tools() {
.shared();
let approval_policy = Constrained::allow_any(AskForApproval::OnRequest);
let permission_profile = Constrained::allow_any(PermissionProfile::default());
let mut manager = McpConnectionManager::new_uninitialized(
let mut manager = McpConnectionSet::new_uninitialized(
&approval_policy,
&permission_profile,
/*prefix_mcp_tool_names*/ true,
@@ -1336,7 +1336,7 @@ async fn list_all_tools_applies_legacy_mcp_prefix_by_default() {
create_ready_async_managed_client(vec![create_test_tool("rmcp", "echo")]).await;
let approval_policy = Constrained::allow_any(AskForApproval::OnRequest);
let permission_profile = Constrained::allow_any(PermissionProfile::default());
let mut manager = McpConnectionManager::new_uninitialized(
let mut manager = McpConnectionSet::new_uninitialized(
&approval_policy,
&permission_profile,
/*prefix_mcp_tool_names*/ true,
@@ -1368,7 +1368,7 @@ async fn list_all_tools_blocks_while_client_is_pending_without_cached_tools() {
.shared();
let approval_policy = Constrained::allow_any(AskForApproval::OnRequest);
let permission_profile = Constrained::allow_any(PermissionProfile::default());
let mut manager = McpConnectionManager::new_uninitialized(
let mut manager = McpConnectionSet::new_uninitialized(
&approval_policy,
&permission_profile,
/*prefix_mcp_tool_names*/ true,
@@ -1424,7 +1424,7 @@ async fn shutdown_cancels_pending_tool_listing() {
.shared();
let approval_policy = Constrained::allow_any(AskForApproval::OnRequest);
let permission_profile = Constrained::allow_any(PermissionProfile::default());
let mut manager = McpConnectionManager::new_uninitialized(
let mut manager = McpConnectionSet::new_uninitialized(
&approval_policy,
&permission_profile,
/*prefix_mcp_tool_names*/ true,
@@ -1472,7 +1472,7 @@ async fn shutdown_continues_after_caller_is_aborted() {
.shared();
let approval_policy = Constrained::allow_any(AskForApproval::OnRequest);
let permission_profile = Constrained::allow_any(PermissionProfile::default());
let mut manager = McpConnectionManager::new_uninitialized(
let mut manager = McpConnectionSet::new_uninitialized(
&approval_policy,
&permission_profile,
/*prefix_mcp_tool_names*/ true,
@@ -1526,7 +1526,7 @@ async fn list_all_tools_does_not_block_when_shared_codex_apps_cache_is_empty() {
.shared();
let approval_policy = Constrained::allow_any(AskForApproval::OnRequest);
let permission_profile = Constrained::allow_any(PermissionProfile::default());
let mut manager = McpConnectionManager::new_uninitialized(
let mut manager = McpConnectionSet::new_uninitialized(
&approval_policy,
&permission_profile,
/*prefix_mcp_tool_names*/ true,
@@ -1579,7 +1579,7 @@ async fn list_all_tools_uses_shared_codex_apps_cache_when_client_startup_fails()
.shared();
let approval_policy = Constrained::allow_any(AskForApproval::OnRequest);
let permission_profile = Constrained::allow_any(PermissionProfile::default());
let mut manager = McpConnectionManager::new_uninitialized(
let mut manager = McpConnectionSet::new_uninitialized(
&approval_policy,
&permission_profile,
/*prefix_mcp_tool_names*/ true,
@@ -1930,7 +1930,7 @@ async fn list_all_tools_adds_server_metadata_to_tools() {
create_ready_async_managed_client(vec![create_test_tool(server_name, "search")]).await;
let approval_policy = Constrained::allow_any(AskForApproval::OnRequest);
let permission_profile = Constrained::allow_any(PermissionProfile::default());
let mut manager = McpConnectionManager::new_uninitialized(
let mut manager = McpConnectionSet::new_uninitialized(
&approval_policy,
&permission_profile,
/*prefix_mcp_tool_names*/ true,
@@ -1989,7 +1989,7 @@ fn server_metadata_preserves_tool_approval_policy() {
fn host_owned_codex_apps_requires_server_metadata() {
let approval_policy = Constrained::allow_any(AskForApproval::OnRequest);
let permission_profile = Constrained::allow_any(PermissionProfile::default());
let manager = McpConnectionManager::new_uninitialized(
let manager = McpConnectionSet::new_uninitialized(
&approval_policy,
&permission_profile,
/*prefix_mcp_tool_names*/ true,
@@ -2002,7 +2002,7 @@ fn host_owned_codex_apps_requires_server_metadata() {
fn host_owned_codex_apps_matches_reserved_name_with_server_metadata() {
let approval_policy = Constrained::allow_any(AskForApproval::OnRequest);
let permission_profile = Constrained::allow_any(PermissionProfile::default());
let mut manager = McpConnectionManager::new_uninitialized(
let mut manager = McpConnectionSet::new_uninitialized(
&approval_policy,
&permission_profile,
/*prefix_mcp_tool_names*/ true,
@@ -2082,7 +2082,7 @@ async fn no_local_runtime_fails_local_stdio_but_keeps_local_http_server() {
]);
let cancel_token = CancellationToken::new();
let manager = McpConnectionManager::new(
let manager = McpConnectionSet::new(
&mcp_servers,
OAuthCredentialsStoreMode::default(),
AuthKeyringBackendKind::default(),
+4 -1
View File
@@ -1,6 +1,6 @@
pub use binding::McpBinding;
pub use binding::PreparedMcpCall;
pub use connection_manager::McpConnectionManager;
pub use connection_manager::McpConnectionSet;
pub use connection_manager::tool_is_model_visible;
pub use elicitation::ElicitationLifecycle;
pub use elicitation::ElicitationRequestRouter;
@@ -18,6 +18,9 @@ pub use runtime::SandboxState;
pub use tool_catalog_cache::McpToolCatalogCache;
pub use tools::ToolInfo;
/// Backward-compatible name for the MCP connection set.
pub type McpConnectionManager = McpConnectionSet;
/// Backward-compatible name for the shared Codex Apps tools runtime.
pub type CodexAppsToolsCache = codex_connectors::ConnectorRuntimeManager<ToolInfo>;
/// Backward-compatible name for the Codex Apps runtime context key.
+4 -4
View File
@@ -45,7 +45,7 @@ use serde_json::Value;
use tokio_util::sync::CancellationToken;
use crate::ResolvedMcpCatalog;
use crate::connection_manager::McpConnectionManager;
use crate::connection_manager::McpConnectionSet;
use crate::runtime::McpRuntimeContext;
use crate::server::EffectiveMcpServer;
use crate::tools::ToolInfo;
@@ -311,7 +311,7 @@ pub async fn read_mcp_resource(
let mut mcp_servers = effective_mcp_servers(config, auth);
mcp_servers.retain(|name, _| name == server);
let cancel_token = CancellationToken::new();
let manager = McpConnectionManager::new(
let manager = McpConnectionSet::new(
&mcp_servers,
config.mcp_oauth_credentials_store_mode,
config.auth_keyring_backend_kind,
@@ -388,7 +388,7 @@ pub async fn collect_mcp_server_status_snapshot_with_detail(
let server_names = mcp_servers.keys().cloned().collect();
let cancel_token = CancellationToken::new();
let mcp_connection_manager = McpConnectionManager::new(
let mcp_connection_manager = McpConnectionSet::new(
&mcp_servers,
config.mcp_oauth_credentials_store_mode,
config.auth_keyring_backend_kind,
@@ -642,7 +642,7 @@ fn convert_mcp_resource_templates(
}
async fn collect_mcp_server_status_snapshot_from_manager(
mcp_connection_manager: &McpConnectionManager,
mcp_connection_manager: &McpConnectionSet,
auth_status_entries: HashMap<String, crate::mcp::auth::McpAuthStatusEntry>,
server_names: Vec<String>,
detail: McpSnapshotDetail,
+2 -2
View File
@@ -11,7 +11,7 @@ use rmcp::model::ReadResourceRequestParams;
use crate::McpRuntime;
use crate::binding_clients::McpBindingClientIdentity;
use crate::binding_clients::McpBindingClients;
use crate::connection_manager::McpConnectionManager;
use crate::connection_manager::McpConnectionSet;
/// One page of resources returned by an MCP server.
#[derive(Clone, Debug, PartialEq)]
@@ -41,7 +41,7 @@ pub struct McpResourceClientCacheKey(McpResourceClientCacheKeyInner);
#[derive(Clone)]
enum McpResourceClientCacheKeyInner {
Latest(Weak<McpConnectionManager>),
Latest(Weak<McpConnectionSet>),
Exact(McpBindingClientIdentity),
}
+5 -5
View File
@@ -19,28 +19,28 @@ use codex_utils_path_uri::PathUri;
use serde::Deserialize;
use serde::Serialize;
use crate::McpConnectionManager;
use crate::McpConnectionSet;
/// Owns the currently published MCP connection set for one Codex thread.
///
/// Replacements are published atomically. Callers that already hold a snapshot
/// keep the previous connection set alive until their work completes.
pub struct McpRuntime {
connections: ArcSwap<McpConnectionManager>,
connections: ArcSwap<McpConnectionSet>,
}
impl McpRuntime {
pub fn new(connections: Arc<McpConnectionManager>) -> Self {
pub fn new(connections: Arc<McpConnectionSet>) -> Self {
Self {
connections: ArcSwap::from(connections),
}
}
pub fn snapshot(&self) -> Arc<McpConnectionManager> {
pub fn snapshot(&self) -> Arc<McpConnectionSet> {
self.connections.load_full()
}
pub fn replace(&self, connections: McpConnectionManager) -> Arc<McpConnectionManager> {
pub fn replace(&self, connections: McpConnectionSet) -> Arc<McpConnectionSet> {
let connections = Arc::new(connections);
self.connections.store(Arc::clone(&connections));
connections
+2 -2
View File
@@ -33,7 +33,7 @@ use codex_login::AuthManager;
use codex_login::CodexAuth;
use codex_mcp::CODEX_APPS_MCP_SERVER_NAME;
use codex_mcp::MCP_TOOL_CODEX_APPS_META_KEY;
use codex_mcp::McpConnectionManager;
use codex_mcp::McpConnectionSet;
use codex_mcp::McpRuntimeContext;
use codex_mcp::ToolInfo;
use codex_mcp::ToolPluginProvenance;
@@ -238,7 +238,7 @@ pub async fn list_accessible_connectors_from_mcp_tools_with_mcp_manager(
let codex_apps_auth_manager =
codex_mcp::host_owned_codex_apps_enabled(&mcp_config, auth.as_ref())
.then(|| Arc::clone(&auth_manager));
let mcp_connection_manager = McpConnectionManager::new(
let mcp_connection_manager = McpConnectionSet::new(
&mcp_servers,
config.mcp_oauth_credentials_store_mode,
config.auth_keyring_backend_kind(),
+8 -8
View File
@@ -34,7 +34,7 @@ use codex_features::Feature;
use codex_hooks::PermissionRequestDecision;
use codex_mcp::CODEX_APPS_MCP_SERVER_NAME;
use codex_mcp::MCP_TOOL_CODEX_APPS_META_KEY;
use codex_mcp::McpConnectionManager;
use codex_mcp::McpConnectionSet;
use codex_mcp::McpPermissionPromptAutoApproveContext;
use codex_mcp::SandboxState;
use codex_mcp::auth_elicitation_completed_result;
@@ -627,7 +627,7 @@ async fn execute_mcp_tool_call(
async fn maybe_request_codex_apps_auth_elicitation(
sess: &Session,
turn_context: &TurnContext,
manager: &McpConnectionManager,
manager: &McpConnectionSet,
call_id: &str,
server: &str,
metadata: Option<&McpToolApprovalMetadata>,
@@ -698,7 +698,7 @@ async fn maybe_request_codex_apps_auth_elicitation(
async fn refresh_codex_apps_after_connector_auth(
sess: &Session,
turn_context: &TurnContext,
manager: &McpConnectionManager,
manager: &McpConnectionSet,
) {
let mcp_tools_result = manager.hard_refresh_codex_apps_tools_cache().await;
@@ -719,7 +719,7 @@ async fn refresh_codex_apps_after_connector_auth(
async fn augment_mcp_tool_request_meta_with_sandbox_state(
step_context: &StepContext,
manager: &McpConnectionManager,
manager: &McpConnectionSet,
server: &str,
mut meta: Option<serde_json::Value>,
) -> anyhow::Result<Option<serde_json::Value>> {
@@ -787,7 +787,7 @@ fn sandbox_cwd_for_mcp_server(step_context: &StepContext, environment_id: &str)
async fn maybe_mark_thread_memory_mode_polluted(
sess: &Session,
turn_context: &TurnContext,
manager: &McpConnectionManager,
manager: &McpConnectionSet,
server: &str,
) {
if !turn_context.config.memories.disable_on_external_context {
@@ -971,7 +971,7 @@ struct McpAppUsageMetadata {
async fn maybe_track_codex_app_used(
sess: &Session,
turn_context: &TurnContext,
manager: &McpConnectionManager,
manager: &McpConnectionSet,
server: &str,
tool_name: &str,
) {
@@ -1481,7 +1481,7 @@ fn mcp_tool_approval_decision_from_guardian(decision: ReviewDecision) -> McpTool
pub(crate) async fn lookup_mcp_tool_metadata(
sess: &Session,
turn_context: &TurnContext,
manager: &McpConnectionManager,
manager: &McpConnectionSet,
server: &str,
tool_name: &str,
) -> Option<McpToolApprovalMetadata> {
@@ -1597,7 +1597,7 @@ fn get_mcp_app_resource_uri(
}
async fn lookup_mcp_app_usage_metadata(
manager: &McpConnectionManager,
manager: &McpConnectionSet,
server: &str,
tool_name: &str,
) -> Option<McpAppUsageMetadata> {
+2 -2
View File
@@ -1445,7 +1445,7 @@ fn codex_apps_auth_failure_metadata() -> McpToolApprovalMetadata {
async fn host_owned_codex_apps_manager(
session: &Session,
turn_context: &TurnContext,
) -> Arc<codex_mcp::McpConnectionManager> {
) -> Arc<codex_mcp::McpConnectionSet> {
let auth = session.services.auth_manager.auth().await;
let startup_cancellation_token = CancellationToken::new();
startup_cancellation_token.cancel();
@@ -1457,7 +1457,7 @@ async fn host_owned_codex_apps_manager(
Some(&turn_context.originator),
)),
)]);
let manager = codex_mcp::McpConnectionManager::new(
let manager = codex_mcp::McpConnectionSet::new(
&mcp_servers,
turn_context.config.mcp_oauth_credentials_store_mode,
turn_context.config.auth_keyring_backend_kind(),
+1 -1
View File
@@ -445,7 +445,7 @@ impl Session {
let codex_apps_auth_manager =
codex_mcp::host_owned_codex_apps_enabled(&mcp_config, auth.as_ref())
.then(|| Arc::clone(&self.services.auth_manager));
let refreshed_manager = McpConnectionManager::new(
let refreshed_manager = McpConnectionSet::new(
&mcp_servers,
mcp_config.mcp_oauth_credentials_store_mode,
mcp_config.auth_keyring_backend_kind,
+6 -6
View File
@@ -2,7 +2,7 @@ use std::fmt;
use std::sync::Arc;
use codex_mcp::McpConfig;
use codex_mcp::McpConnectionManager;
use codex_mcp::McpConnectionSet;
use codex_mcp::McpRuntimeContext;
use codex_protocol::capabilities::SelectedCapabilityRoot;
@@ -10,7 +10,7 @@ use codex_protocol::capabilities::SelectedCapabilityRoot;
pub struct McpRuntimeSnapshot {
config: Arc<McpConfig>,
plugins_available: bool,
manager: Arc<McpConnectionManager>,
manager: Arc<McpConnectionSet>,
runtime_context: McpRuntimeContext,
ready_selected_capability_roots: Vec<SelectedCapabilityRoot>,
}
@@ -19,7 +19,7 @@ impl McpRuntimeSnapshot {
pub(crate) fn new(
config: Arc<McpConfig>,
plugins_available: bool,
manager: Arc<McpConnectionManager>,
manager: Arc<McpConnectionSet>,
runtime_context: McpRuntimeContext,
ready_selected_capability_roots: Vec<SelectedCapabilityRoot>,
) -> Self {
@@ -40,11 +40,11 @@ impl McpRuntimeSnapshot {
self.plugins_available
}
pub fn manager(&self) -> &McpConnectionManager {
pub fn manager(&self) -> &McpConnectionSet {
self.manager.as_ref()
}
pub(crate) fn manager_arc(&self) -> Arc<McpConnectionManager> {
pub(crate) fn manager_arc(&self) -> Arc<McpConnectionSet> {
Arc::clone(&self.manager)
}
@@ -83,7 +83,7 @@ impl McpRuntimeSnapshot {
mcp_server_catalog: ResolvedMcpCatalog::default(),
connector_snapshot: codex_connectors::ConnectorSnapshot::default(),
};
let manager = McpConnectionManager::new_uninitialized_with_permission_profile(
let manager = McpConnectionSet::new_uninitialized_with_permission_profile(
&config.permissions.approval_policy,
config.permissions.permission_profile(),
config.prefix_mcp_tool_names(),
+1 -1
View File
@@ -74,7 +74,7 @@ use codex_hooks::HooksConfig;
use codex_login::AuthManager;
use codex_login::CodexAuth;
use codex_login::auth_env_telemetry::collect_auth_env_telemetry;
use codex_mcp::McpConnectionManager;
use codex_mcp::McpConnectionSet;
use codex_mcp::McpResourceClient;
use codex_mcp::McpRuntime;
use codex_mcp::McpRuntimeContext;
+2 -2
View File
@@ -1031,7 +1031,7 @@ impl Session {
)
});
let mcp_runtime = Arc::new(McpRuntime::new(Arc::new(
McpConnectionManager::new_uninitialized_with_permission_profile(
McpConnectionSet::new_uninitialized_with_permission_profile(
&config.permissions.approval_policy,
config.permissions.permission_profile(),
config.prefix_mcp_tool_names(),
@@ -1202,7 +1202,7 @@ impl Session {
let codex_apps_auth_manager =
codex_mcp::host_owned_codex_apps_enabled(&mcp_projection.config, auth)
.then(|| Arc::clone(&sess.services.auth_manager));
let mcp_connection_manager = McpConnectionManager::new(
let mcp_connection_manager = McpConnectionSet::new(
&mcp_servers,
config.mcp_oauth_credentials_store_mode,
config.auth_keyring_backend_kind(),
+3 -3
View File
@@ -31,7 +31,7 @@ use codex_extension_api::ExtensionRegistry;
use codex_hooks::Hooks;
use codex_login::AuthManager;
use codex_mcp::McpConfig;
use codex_mcp::McpConnectionManager;
use codex_mcp::McpConnectionSet;
use codex_mcp::McpRuntime;
use codex_mcp::McpRuntimeContext;
use codex_models_manager::manager::SharedModelsManager;
@@ -110,7 +110,7 @@ impl SessionServices {
plugins_available: bool,
runtime_context: McpRuntimeContext,
ready_selected_capability_roots: Vec<SelectedCapabilityRoot>,
connections: McpConnectionManager,
connections: McpConnectionSet,
) -> Result<()> {
let runtime = self.publish_mcp_runtime(
config,
@@ -128,7 +128,7 @@ impl SessionServices {
plugins_available: bool,
runtime_context: McpRuntimeContext,
ready_selected_capability_roots: Vec<SelectedCapabilityRoot>,
connections: McpConnectionManager,
connections: McpConnectionSet,
) -> Arc<McpRuntimeSnapshot> {
let connections = self.mcp_runtime.replace(connections);
let runtime = Arc::new(McpRuntimeSnapshot::new(
@@ -349,7 +349,7 @@ fn disabled_install_request(tool: &DiscoverableTool) -> ToolSuggestDisabledTool
async fn verify_request_plugin_install_completed(
session: &crate::session::session::Session,
turn: &crate::session::turn_context::TurnContext,
manager: &codex_mcp::McpConnectionManager,
manager: &codex_mcp::McpConnectionSet,
tool: &DiscoverableTool,
auth: Option<&codex_login::CodexAuth>,
) -> bool {
@@ -441,7 +441,7 @@ fn is_remote_plugin_install_suggestion(plugin_id: &str) -> bool {
async fn refresh_missing_requested_connectors(
turn: &crate::session::turn_context::TurnContext,
manager: &codex_mcp::McpConnectionManager,
manager: &codex_mcp::McpConnectionSet,
auth: Option<&codex_login::CodexAuth>,
expected_connector_ids: &[String],
tool_id: &str,
@@ -14,7 +14,7 @@ use codex_mcp::CODEX_APPS_MCP_SERVER_NAME;
use codex_mcp::CodexAppsToolsCache;
use codex_mcp::EffectiveMcpServer;
use codex_mcp::ElicitationRequestRouter;
use codex_mcp::McpConnectionManager;
use codex_mcp::McpConnectionSet;
use codex_mcp::McpRuntimeContext;
use codex_mcp::McpToolCatalogCache;
use codex_mcp::ToolPluginProvenance;
@@ -84,7 +84,7 @@ async fn hosted_plugin_runtime_ps_mcp_tool_calls_use_current_auth_manager_token(
EffectiveMcpServer::configured(hosted_plugin_runtime_config),
)]);
let approval_policy = Constrained::allow_any(AskForApproval::Never);
let manager = McpConnectionManager::new(
let manager = McpConnectionSet::new(
&mcp_servers,
OAuthCredentialsStoreMode::default(),
AuthKeyringBackendKind::default(),