Negotiate MCP extensions per app-server session (#36910)

## Why

App-server clients need to advertise structured MCP extension settings, including supported MCP App UI MIME types, rather than only opting into OpenAI form elicitation with a boolean.

## What changed

- Add an `extensions` map to initialize capabilities and preserve `mcpServerOpenaiFormElicitation` as a legacy alias for `openai/form`.
- Capture the declared extension profile when a thread is started, resumed, or forked, propagate it to subagents, and advertise it to downstream MCP servers during initialization.
- Keep the profile stable for the lifetime of the loaded session instead of changing it on later turns or direct tool calls.

## Testing

- Cover extension conversion, downstream MCP initialization, session isolation, legacy form support, and subagent inheritance.

GitOrigin-RevId: fbcedbb74ce788e574b0f884a4c45c4cedb9de54
This commit is contained in:
Martin Au-Yeung authored and copyberry committed 2026-08-04 15:23:43 +00:00
1 parent bab7c2dcc1
commit ee46c5ba0e
61 files changed
+729 -284

No files matched your search

+3 -2
View File
@@ -32,6 +32,7 @@ use codex_connectors::ConnectorSnapshot;
use codex_connectors::connector_runtime_context_key;
use codex_login::CodexAuth;
use codex_model_provider::CHATGPT_CODEX_BASE_URL;
use codex_protocol::mcp::ClientMcpExtensions;
use codex_protocol::mcp::McpServerInfo;
use codex_protocol::mcp::Resource;
use codex_protocol::mcp::ResourceTemplate;
@@ -342,7 +343,7 @@ pub async fn read_mcp_resource(
codex_apps_tools_cache,
tool_catalog_cache,
codex_apps_tools_cache_key: connector_runtime_context_key(auth),
supports_openai_form_elicitation: false,
client_mcp_extensions: ClientMcpExtensions::default(),
auth: auth.cloned(),
codex_apps_auth_manager: None,
elicitation_reviewer: None,
@@ -419,7 +420,7 @@ pub async fn collect_mcp_server_status_snapshot_with_detail(
codex_apps_tools_cache,
tool_catalog_cache,
codex_apps_tools_cache_key: connector_runtime_context_key(auth),
supports_openai_form_elicitation: false,
client_mcp_extensions: ClientMcpExtensions::default(),
auth: auth.cloned(),
codex_apps_auth_manager: None,
elicitation_reviewer: None,