Give hosted Codex Apps an independent MCP protocol opt-in (#44318)

## Why

Hosted Codex Apps shared the `mcp_2026_07_28` protocol setting with other MCP servers, preventing independent protocol selection.

## What changed

- Add `features.codex_apps_mcp_2026_07_28`, disabled by default, for the host-owned HTTP `codex_apps` server. Enabling it attempts 2026-07-28 discovery with Legacy fallback.
- Keep other servers, including third-party registrations with Apps-like names or URLs and local stdio servers, governed by `mcp_2026_07_28`.
- Support the new flag through `experimentalFeature/enablement/set` and refresh protocol settings in existing sessions. Track protocol mode per server when deciding whether to reuse connections.

## Testing

Add coverage for independent feature and protocol selection, hosted event-stream protocol selection, standalone Legacy defaults and discovery fallback, and runtime enablement refreshing an existing app-server thread.

GitOrigin-RevId: 640e8e251f0c45e5f4829cc2b73c3082cf42f715
This commit is contained in:
thomas
2026-09-09 22:22:08 +00:00
committed by copyberry
parent e1b23086ac
commit eb680c0558
18 changed files with 431 additions and 19 deletions
+8
View File
@@ -209,6 +209,8 @@ pub enum Feature {
EnableMcpApps,
/// Enable MCP protocol version 2026-07-28 support.
Mcp20260728,
/// Enable MCP protocol version 2026-07-28 for the host-owned Codex Apps server.
CodexAppsMcp20260728,
/// Let RMCP coordinate OAuth refresh through the configured credential store.
McpOAuthRefreshCoordination,
/// Removed compatibility flag for the legacy Apps MCP path override.
@@ -1303,6 +1305,12 @@ pub const FEATURES: &[FeatureSpec] = &[
stage: Stage::UnderDevelopment,
default_enabled: false,
},
FeatureSpec {
id: Feature::CodexAppsMcp20260728,
key: "codex_apps_mcp_2026_07_28",
stage: Stage::UnderDevelopment,
default_enabled: false,
},
FeatureSpec {
id: Feature::McpOAuthRefreshCoordination,
key: "mcp_oauth_refresh_coordination",
+24
View File
@@ -93,6 +93,30 @@ fn cwd_relative_turn_diffs_is_an_opt_in_map_feature() {
assert!(!features.enabled(Feature::CwdRelativeTurnDiffs));
}
#[test]
fn codex_apps_mcp_protocol_can_be_enabled_independently_of_generic_mcp() {
let features_toml = FeaturesToml::from(BTreeMap::from([
(Feature::CodexAppsMcp20260728.key().to_string(), true),
(Feature::Mcp20260728.key().to_string(), false),
]));
let features = Features::from_sources(
FeatureConfigSource {
features: Some(&features_toml),
..Default::default()
},
FeatureConfigSource::default(),
FeatureOverrides::default(),
);
assert_eq!(
(
features.enabled(Feature::CodexAppsMcp20260728),
features.enabled(Feature::Mcp20260728),
),
(true, false),
);
}
#[test]
fn default_enabled_features_are_stable() {
for spec in crate::FEATURES {