Accept explicit contribution context for MCP runtime configuration (#61283)

## What changed

- Make `McpManager::runtime_config` accept `McpServerContributionContext` and honor its originator, selected environments, and disabled plugin IDs.
- Add `McpServerContributionContext::for_host` to carry thread initialization data, originator, and session source without live extension state or discovery.
- Pass explicit global contexts from threadless discovery and control paths.

## Testing

Extend the thread manager test to cover host-only contribution identity, originator headers, and server restrictions for disabled plugins and pending environments.

GitOrigin-RevId: 04ea2c8951187d9014867f0020223b6a7dd94d8d
This commit is contained in:
sayan-oai
2026-11-13 07:35:46 +00:00
committed by copyberry
parent 5045589550
commit c899e21cda
7 changed files with 111 additions and 48 deletions
@@ -66,6 +66,21 @@ impl<'a, C> McpServerContributionContext<'a, C> {
}
}
/// Creates host-only context with thread identity but no live extension state or discovery.
pub fn for_host(
config: &'a C,
thread_init: Option<&'a ExtensionDataInit>,
originator: Option<&'a str>,
session_source: Option<&'a SessionSource>,
) -> Self {
Self {
thread_init,
originator,
session_source,
..Self::global(config)
}
}
/// Creates context for one model step using only currently available environments.
pub fn for_step(
config: &'a C,