Preserve MCP compatibility with older executors (#39979)

## Why

Older executors do not support resolving HTTP header values from their own
environment. Sending environment-backed bearer tokens to them can prevent MCP
servers from starting.

## What changed

- Advertise executor support for environment-backed HTTP headers with the
  `httpHeaderEnvVars` capability.
- Delegate bearer-token resolution only when the selected executor advertises
  that capability; otherwise, resolve tokens available in the host environment.
- Exclude executor-owned MCP servers that require environment-backed bearer
  tokens when the executor cannot resolve them, while retaining compatible
  host-owned and executor-owned servers.

## Testing

Added protocol and environment-variable coverage plus an end-to-end test that
simulates an older executor and verifies compatible MCP servers remain usable.

GitOrigin-RevId: 43545926f6f7e0f3b1091eb29d34647f6372bc4a
This commit is contained in:
jif
2026-08-21 17:11:58 +00:00
committed by copyberry
parent 696b4502df
commit 8edb95f274
6 changed files with 249 additions and 28 deletions

View File

@@ -118,6 +118,9 @@ pub struct EnvironmentCapabilities {
/// Whether this executor supports the `environmentConfig/read` request.
#[serde(default)]
pub environment_config_read: bool,
/// Whether HTTP headers can resolve values from the executor environment.
#[serde(default)]
pub http_header_env_vars: bool,
/// Whether filesystem streams can use the requested platform sandbox.
#[serde(default)]
pub sandboxed_file_streaming: bool,
@@ -185,6 +188,7 @@ impl EnvironmentInfo {
network_proxy_launch: true,
capability_discovery_sandbox: true,
environment_config_read: true,
http_header_env_vars: true,
sandboxed_file_streaming: true,
shell_snapshot_v2: false,
},
@@ -963,6 +967,7 @@ mod tests {
network_proxy_launch: true,
capability_discovery_sandbox: true,
environment_config_read: false,
http_header_env_vars: false,
sandboxed_file_streaming: false,
shell_snapshot_v2: false,
}
@@ -979,6 +984,7 @@ mod tests {
"networkProxyLaunch": false,
"capabilityDiscoverySandbox": false,
"environmentConfigRead": false,
"httpHeaderEnvVars": false,
"sandboxedFileStreaming": false,
"shellSnapshotV2": false,
},