Discover HTTP MCP servers from selected executors (#39941)

## What changed

- Read `mcp_servers` configuration and requirements from each selected remote
  executor and add eligible HTTP servers to the thread's MCP runtime.
- Bind discovered servers to the thread's concrete executor snapshot and apply
  environment MCP policy and requirements. Discovery is best effort, and
  executor-local servers are not treated as required at startup.
- Ignore unsupported stdio servers and HTTP configurations that depend on
  environment-provided headers or header helpers.

## Testing

- Added an app-server integration test covering discovery, authenticated HTTP
  tool invocation, requirements enforcement, and exclusion of stdio servers.

GitOrigin-RevId: 6e1cdcebdbb1cc21a5a2285fbc5617d8d5997182
This commit is contained in:
jif authored and copyberry committed 2026-08-21 14:23:33 +00:00
1 parent 275ef855fa
commit 00a7b888b2
6 files changed
+445 -15

No files matched your search

+22 -1
View File
@@ -120,7 +120,7 @@ impl Session {
windows_sandbox_level,
)
.await;
let mcp_config = self
let mcp_projection = self
.services
.mcp_manager
.runtime_config_for_step(
@@ -135,6 +135,9 @@ impl Session {
&ready_selected_capability_roots,
executor_capability_discovery.as_deref(),
)
.await;
let mcp_config = self
.project_selected_environment_mcp_servers(config, &environments, mcp_projection)
.await
.config;
let local_process_cwd = environments
@@ -144,6 +147,17 @@ impl Session {
let runtime_context = McpRuntimeContext::new(
self.services.turn_environments.environment_manager(),
local_process_cwd,
)
.with_selected_environments(
environments
.turn_environments()
.map(|environment| {
(
environment.selection.environment_id.clone(),
Arc::clone(&environment.environment),
)
})
.collect(),
);
(mcp_config, runtime_context)
}
@@ -265,6 +279,13 @@ impl Session {
executor_capability_discovery.as_deref(),
)
.await;
let mcp_projection = self
.project_selected_environment_mcp_servers(
&desired.config,
&desired.environments,
mcp_projection,
)
.await;
let selected_plugins = mcp_projection.selected_plugins.clone();
let input = self.build_mcp_runtime_input(
&desired,