mirror of
https://github.com/openai/codex.git
synced 2026-11-13 14:46:14 +00:00
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:
1 parent
5a4f5ee64c
commit
6bf4845b60
6 files changed
+24
-37
No files matched your search
@@ -475,14 +475,12 @@ fn normalize_codex_apps_base_url(base_url: &str) -> String {
|
||||
|
||||
fn codex_apps_mcp_url_for_base_url(base_url: &str) -> String {
|
||||
let base_url = normalize_codex_apps_base_url(base_url);
|
||||
let (base_url, default_path) = if base_url.contains("/backend-api") {
|
||||
(base_url, "wham/apps")
|
||||
} else if base_url.contains("/api/codex") {
|
||||
(base_url, "apps")
|
||||
let base_url = if base_url.contains("/backend-api") || base_url.contains("/api/codex") {
|
||||
base_url
|
||||
} else {
|
||||
(format!("{base_url}/api/codex"), "apps")
|
||||
format!("{base_url}/api/codex")
|
||||
};
|
||||
format!("{base_url}/{default_path}")
|
||||
format!("{base_url}/ps/mcp")
|
||||
}
|
||||
|
||||
pub fn codex_apps_mcp_server_config(
|
||||
@@ -504,18 +502,7 @@ pub fn hosted_plugin_runtime_mcp_server_config(
|
||||
apps_mcp_product_sku: Option<&str>,
|
||||
originator: Option<&str>,
|
||||
) -> McpServerConfig {
|
||||
let base_url = normalize_codex_apps_base_url(chatgpt_base_url);
|
||||
let base_url = if base_url.contains("/backend-api") || base_url.contains("/api/codex") {
|
||||
base_url
|
||||
} else {
|
||||
format!("{base_url}/api/codex")
|
||||
};
|
||||
mcp_server_config_for_url(
|
||||
format!("{base_url}/ps/mcp"),
|
||||
apps_mcp_product_sku,
|
||||
originator,
|
||||
McpServerAuth::ChatGpt,
|
||||
)
|
||||
codex_apps_mcp_server_config(chatgpt_base_url, apps_mcp_product_sku, originator)
|
||||
}
|
||||
|
||||
fn mcp_server_config_for_url(
|
||||
|
||||
@@ -239,27 +239,27 @@ fn selected_mcp_attribution_does_not_join_an_unrelated_local_summary() {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn codex_apps_mcp_url_for_base_url_keeps_existing_paths() {
|
||||
fn codex_apps_mcp_url_for_base_url_uses_plugin_service_paths() {
|
||||
assert_eq!(
|
||||
codex_apps_mcp_url_for_base_url("https://chatgpt.com/backend-api"),
|
||||
"https://chatgpt.com/backend-api/wham/apps"
|
||||
"https://chatgpt.com/backend-api/ps/mcp"
|
||||
);
|
||||
assert_eq!(
|
||||
codex_apps_mcp_url_for_base_url("https://chat.openai.com"),
|
||||
"https://chat.openai.com/backend-api/wham/apps"
|
||||
"https://chat.openai.com/backend-api/ps/mcp"
|
||||
);
|
||||
assert_eq!(
|
||||
codex_apps_mcp_url_for_base_url("http://localhost:8080/api/codex"),
|
||||
"http://localhost:8080/api/codex/apps"
|
||||
"http://localhost:8080/api/codex/ps/mcp"
|
||||
);
|
||||
assert_eq!(
|
||||
codex_apps_mcp_url_for_base_url("http://localhost:8080"),
|
||||
"http://localhost:8080/api/codex/apps"
|
||||
"http://localhost:8080/api/codex/ps/mcp"
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn codex_apps_server_config_uses_legacy_codex_apps_path() {
|
||||
fn codex_apps_server_config_uses_plugin_service_path() {
|
||||
let config = codex_apps_mcp_server_config(
|
||||
"https://chatgpt.com",
|
||||
/*apps_mcp_product_sku*/ None,
|
||||
@@ -270,7 +270,7 @@ fn codex_apps_server_config_uses_legacy_codex_apps_path() {
|
||||
_ => panic!("expected streamable http transport for codex apps"),
|
||||
};
|
||||
|
||||
assert_eq!(url, "https://chatgpt.com/backend-api/wham/apps");
|
||||
assert_eq!(url, "https://chatgpt.com/backend-api/ps/mcp");
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -460,7 +460,7 @@ async fn effective_mcp_servers_preserve_runtime_servers() {
|
||||
}
|
||||
match &codex_apps.transport {
|
||||
McpServerTransportConfig::StreamableHttp { url, .. } => {
|
||||
assert_eq!(url, "https://chatgpt.com/backend-api/wham/apps");
|
||||
assert_eq!(url, "https://chatgpt.com/backend-api/ps/mcp");
|
||||
}
|
||||
other => panic!("expected streamable http transport, got {other:?}"),
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user