Enforce environment MCP policies (#39335)

## What changed

- Add environment-provided MCP restrictions for configured and plugin-provided servers.
- Disable attachment-scoped servers while their environment configuration is pending, failed, or unselected, while preserving selected-plugin access and the controller-owned Apps server.
- Apply the resolved policy to runtime startup, model tool exposure, telemetry, OAuth flows, and skill dependency installation.

## Testing

- Cover policy filtering for configured and plugin servers, environment state transitions, Apps ownership, and managed OAuth rejection.

GitOrigin-RevId: 7ca5d4dda14068e758497f88835d5cba685e159e
This commit is contained in:
sayan-oai authored and copyberry committed 2026-08-19 01:26:16 +00:00
1 parent d35e5495f9
commit fde2156057
36 files changed
+650 -88

No files matched your search

+8 -11
View File
@@ -27,7 +27,6 @@ use std::sync::OnceLock;
use std::sync::atomic::Ordering;
use std::time::Duration;
use crate::McpServerSource;
use crate::binding::call_tool_result_from_rmcp;
use crate::elicitation::ElicitationRequestManager;
use crate::elicitation::ElicitationRequestRouter;
@@ -276,16 +275,14 @@ impl McpConnectionSet {
.into_iter()
.filter(|(_, server)| server.enabled())
{
let is_host_owned_codex_apps = server_name == CODEX_APPS_MCP_SERVER_NAME
&& config.mcp_server_catalog.server(&server_name).is_some_and(
|server| match server.source() {
McpServerSource::Compatibility { .. } => true,
McpServerSource::Extension { id } => id == "hosted_plugin_runtime",
McpServerSource::Plugin(_)
| McpServerSource::SelectedPlugin(_)
| McpServerSource::Config => false,
},
);
let is_host_owned_codex_apps = config
.mcp_server_catalog
.server(&server_name)
.is_some_and(|server| {
server
.source()
.is_host_owned_apps(&server_name, server.config())
});
let catalog_item_limit = if is_host_owned_codex_apps {
MAX_CODEX_APPS_TOOL_CATALOG_ITEMS
} else {