Accept explicit contribution context for MCP runtime configuration (#61283)

## What changed

- Make `McpManager::runtime_config` accept `McpServerContributionContext` and honor its originator, selected environments, and disabled plugin IDs.
- Add `McpServerContributionContext::for_host` to carry thread initialization data, originator, and session source without live extension state or discovery.
- Pass explicit global contexts from threadless discovery and control paths.

## Testing

Extend the thread manager test to cover host-only contribution identity, originator headers, and server restrictions for disabled plugins and pending environments.

GitOrigin-RevId: 04ea2c8951187d9014867f0020223b6a7dd94d8d
This commit is contained in:
sayan-oai
2026-11-13 07:35:46 +00:00
committed by copyberry
parent 5045589550
commit c899e21cda
7 changed files with 111 additions and 48 deletions
+4 -1
View File
@@ -23,6 +23,7 @@ use codex_core::plugins_manager_for_config;
use codex_exec_server::EnvironmentManager;
use codex_exec_server::HttpClient;
use codex_exec_server::RouteAwareHttpClient;
use codex_extension_api::McpServerContributionContext;
use codex_login::AuthManager;
use codex_mcp::McpOAuthLoginSupport;
use codex_mcp::McpRuntimeContext;
@@ -692,7 +693,9 @@ async fn run_list(config: &Config, list_args: ListArgs) -> Result<()> {
AuthManager::shared_from_config(config, /*enable_codex_api_key_env*/ true).await?;
let auth = auth_manager.auth().await;
let mcp_servers = mcp_manager.configured_servers(config).await;
let runtime_config = mcp_manager.runtime_config(config).await;
let runtime_config = mcp_manager
.runtime_config(McpServerContributionContext::global(config))
.await;
let effective_mcp_servers = codex_mcp::effective_mcp_servers(&runtime_config, auth.as_ref());
let mut entries: Vec<_> = mcp_servers.iter().collect();