Route Codex Apps MCP through plugin service (#34389)

## What changed

- Point the default Codex Apps MCP server at `ps/mcp` instead of the legacy Apps endpoint for both `backend-api` and `api/codex` base URLs.
- Use the same server configuration for Codex Apps and the hosted plugin runtime.
- Update MCP integration tests and test-server routing to expect the plugin-service path.

GitOrigin-RevId: 939f20dcff67ba6f79c11b328bfc624b25e3aac2
This commit is contained in:
Alex Daley authored and copyberry committed 2026-07-20 17:55:58 +00:00
1 parent 5a4f5ee64c
commit 6bf4845b60
6 files changed
+24 -37

No files matched your search

@@ -26,7 +26,7 @@ const DISCOVERABLE_CALENDAR_ID: &str = "connector_2128aebfecb84f64a069897515042a
const DISCOVERABLE_GMAIL_ID: &str = "connector_68df038e0ba48191908c8434991bbac2";
const CONNECTOR_DESCRIPTION: &str = "Plan events and manage your calendar.";
const CODEX_APPS_META_KEY: &str = "_codex_apps";
const CODEX_APPS_MCP_PATH_REGEX: &str = "^/api/codex/apps/?$";
const CODEX_APPS_MCP_PATH_REGEX: &str = "^/api/codex/ps/mcp/?$";
const HOSTED_PLUGIN_RUNTIME_MCP_PATH_REGEX: &str = "^/api/codex/ps/mcp/?$";
const PROTOCOL_VERSION: &str = "2025-11-25";
const SERVER_NAME: &str = "codex-apps-test";
@@ -288,7 +288,7 @@ pub async fn recorded_apps_tool_calls(server: &MockServer) -> Vec<Value> {
.into_iter()
.filter_map(|request| {
let body: Value = serde_json::from_slice(&request.body).ok()?;
(request.url.path() == "/api/codex/apps"
(request.url.path() == "/api/codex/ps/mcp"
&& body.get("method").and_then(Value::as_str) == Some("tools/call"))
.then_some(body)
})
@@ -77,7 +77,7 @@ async fn codex_apps_auth_failure_requests_elicitation_by_default() -> Result<()>
let server = start_mock_server().await;
let apps_server = AppsTestServer::mount_searchable(&server).await?;
Mock::given(method("POST"))
.and(path_regex("^/api/codex/apps/?$"))
.and(path_regex("^/api/codex/ps/mcp/?$"))
.and(body_partial_json(json!({
"method": "tools/call",
"params": {
+4 -4
View File
@@ -2453,7 +2453,7 @@ async fn streamable_http_chatgpt_auth_is_not_sent_to_configured_origin() -> anyh
let server = responses::start_mock_server().await;
let untrusted_server = MockServer::start().await;
let untrusted_apps = AppsTestServer::mount(&untrusted_server).await?;
let untrusted_mcp_url = format!("{}/api/codex/apps", untrusted_apps.chatgpt_base_url);
let untrusted_mcp_url = format!("{}/api/codex/ps/mcp", untrusted_apps.chatgpt_base_url);
let untrusted_chatgpt_base_url = untrusted_apps.chatgpt_base_url;
let fixture = test_codex()
@@ -2484,7 +2484,7 @@ async fn streamable_http_chatgpt_auth_is_not_sent_to_configured_origin() -> anyh
.await
.expect("mock server should capture MCP startup requests")
.into_iter()
.filter(|request| request.url.path() == "/api/codex/apps")
.filter(|request| request.url.path() == "/api/codex/ps/mcp")
.filter_map(|request| {
let body: Value = serde_json::from_slice(&request.body).ok()?;
let method = body.get("method")?.as_str()?.to_string();
@@ -2516,7 +2516,7 @@ async fn configured_chatgpt_base_url_does_not_grant_mcp_chatgpt_auth() -> anyhow
let server = responses::start_mock_server().await;
let untrusted_server = MockServer::start().await;
let untrusted_apps = AppsTestServer::mount(&untrusted_server).await?;
let untrusted_mcp_url = format!("{}/api/codex/apps", untrusted_apps.chatgpt_base_url);
let untrusted_mcp_url = format!("{}/api/codex/ps/mcp", untrusted_apps.chatgpt_base_url);
let untrusted_chatgpt_base_url = untrusted_apps.chatgpt_base_url;
let fixture = test_codex()
@@ -2545,7 +2545,7 @@ auth = "chatgpt"
.await
.expect("mock server should capture MCP startup requests")
.into_iter()
.filter(|request| request.url.path() == "/api/codex/apps")
.filter(|request| request.url.path() == "/api/codex/ps/mcp")
.filter_map(|request| {
let body: Value = serde_json::from_slice(&request.body).ok()?;
let method = body.get("method")?.as_str()?.to_string();