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 authored and copyberry committed 2026-08-21 17:21:30 +00:00
1 parent 696b4502df
commit 8edb95f274
6 files changed
+249 -28

No files matched your search

+1 -1
View File
@@ -335,7 +335,7 @@ fn referenced_environment_variables(config: &McpServerConfig) -> Vec<(String, Op
..
} => bearer_token_env_var
.iter()
.filter(|_| config.is_local_environment())
.filter(|name| config.is_local_environment() || std::env::var_os(name).is_some())
.chain(env_http_headers.iter().flat_map(|headers| headers.values()))
.cloned()
.collect(),