mirror of
https://github.com/openai/codex.git
synced 2026-11-17 14:58:36 +00:00
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:
1 parent
bab7c2dcc1
commit
ee46c5ba0e
61 files changed
+729
-284
No files matched your search
@@ -14,6 +14,7 @@ use codex_config::types::OAuthCredentialsStoreMode;
|
||||
use codex_connectors::ConnectorRuntimeContextKey;
|
||||
use codex_exec_server::Environment;
|
||||
use codex_login::CodexAuth;
|
||||
use codex_protocol::mcp::ClientMcpExtensions;
|
||||
use codex_rmcp_client::StoredOAuthTokens;
|
||||
use codex_rmcp_client::stored_oauth_credentials;
|
||||
use rmcp::model::ElicitationCapability;
|
||||
@@ -90,7 +91,7 @@ pub(crate) struct McpServerConnectionIdentity {
|
||||
runtime_auth_token: Option<String>,
|
||||
codex_apps_cache_identity: Option<(PathBuf, ConnectorRuntimeContextKey)>,
|
||||
client_elicitation_capability: ElicitationCapability,
|
||||
supports_openai_form_elicitation: bool,
|
||||
client_mcp_extensions: ClientMcpExtensions,
|
||||
}
|
||||
|
||||
impl McpServerConnectionIdentity {
|
||||
@@ -106,7 +107,7 @@ impl McpServerConnectionIdentity {
|
||||
auth: Option<&CodexAuth>,
|
||||
codex_apps_cache_identity: Option<(PathBuf, ConnectorRuntimeContextKey)>,
|
||||
client_elicitation_capability: ElicitationCapability,
|
||||
supports_openai_form_elicitation: bool,
|
||||
client_mcp_extensions: ClientMcpExtensions,
|
||||
) -> Self {
|
||||
let config = server.config();
|
||||
let stored_oauth_url = if runtime_auth_provider.is_none()
|
||||
@@ -163,7 +164,7 @@ impl McpServerConnectionIdentity {
|
||||
runtime_auth_token,
|
||||
codex_apps_cache_identity,
|
||||
client_elicitation_capability,
|
||||
supports_openai_form_elicitation,
|
||||
client_mcp_extensions,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -191,7 +192,7 @@ impl McpServerConnectionIdentity {
|
||||
&& self.runtime_auth_token == other.runtime_auth_token
|
||||
&& self.codex_apps_cache_identity == other.codex_apps_cache_identity
|
||||
&& self.client_elicitation_capability == other.client_elicitation_capability
|
||||
&& self.supports_openai_form_elicitation == other.supports_openai_form_elicitation
|
||||
&& self.client_mcp_extensions == other.client_mcp_extensions
|
||||
}
|
||||
|
||||
pub(crate) fn oauth_credentials(&self) -> Result<&Option<StoredOAuthTokens>, &String> {
|
||||
|
||||
Reference in new issue
Block a user