Add Agent Plugins MCP config parsing (#36796)

## What changed

- Add `parse_agent_plugin_mcp_config` to translate Agent Plugins v1 `mcp.json` files into Codex MCP server configuration.
- Normalize `stdio` and streamable HTTP transports, including `PLUGIN_ROOT` and `PLUGIN_DATA` expansion, contained plugin paths, secure endpoint validation, and filtering of client-owned HTTP headers.
- Keep valid sibling servers when another server is invalid, while returning per-server parse errors.
- Preserve UTF-8 HTTP header values when forwarding streamable HTTP protocol headers.

## Testing

- Cover transport mapping, placeholder expansion, path containment, schema and field validation, per-server errors, platform-specific environment handling, and UTF-8 headers.

GitOrigin-RevId: ed4ab0fcf495afbb381ce48beb93989629444c56
This commit is contained in:
jacobzhou-oai authored and copyberry committed 2026-08-03 20:36:59 +00:00
1 parent 3149fa4b99
commit bd12b3a9ec
6 files changed
+1052 -1

No files matched your search

@@ -1,8 +1,29 @@
use std::io::ErrorKind;
use http::HeaderMap;
use http::HeaderValue;
use pretty_assertions::assert_eq;
use super::HttpHeader;
use super::SseEventSizeLimit;
use super::protocol_headers;
#[test]
fn protocol_headers_preserve_utf8_values() {
let mut headers = HeaderMap::new();
headers.insert(
"x-plugin-name",
HeaderValue::from_str("café").expect("valid HTTP field value"),
);
assert_eq!(
protocol_headers(&headers),
vec![HttpHeader {
name: "x-plugin-name".to_string(),
value: "café".to_string(),
}]
);
}
#[test]
fn lf_terminators_reset_the_event_limit() {