mirror of
https://github.com/openai/codex.git
synced 2026-11-11 21:10:39 +00:00
Reuse apps MCP path override for rollout
This commit is contained in:
@@ -109,8 +109,6 @@ pub struct McpConfig {
|
||||
pub chatgpt_base_url: String,
|
||||
/// Optional path override for the host-owned apps MCP server.
|
||||
pub apps_mcp_path_override: Option<String>,
|
||||
/// Whether the host-owned apps MCP server should use the new plugin-service route.
|
||||
pub new_apps_mcp_enabled: bool,
|
||||
/// Codex home directory used for MCP OAuth state and app-tool cache files.
|
||||
pub codex_home: PathBuf,
|
||||
/// Preferred credential store for MCP OAuth tokens.
|
||||
@@ -366,12 +364,10 @@ pub async fn collect_mcp_server_status_snapshot_with_detail(
|
||||
}
|
||||
|
||||
pub(crate) fn codex_apps_mcp_url(config: &McpConfig) -> String {
|
||||
let apps_mcp_path_override = config
|
||||
.apps_mcp_path_override
|
||||
.as_deref()
|
||||
.or(config.new_apps_mcp_enabled.then_some("/ps/mcp"));
|
||||
|
||||
codex_apps_mcp_url_for_base_url(&config.chatgpt_base_url, apps_mcp_path_override)
|
||||
codex_apps_mcp_url_for_base_url(
|
||||
&config.chatgpt_base_url,
|
||||
config.apps_mcp_path_override.as_deref(),
|
||||
)
|
||||
}
|
||||
|
||||
/// The Responses API requires tool names to match `^[a-zA-Z0-9_-]+$`.
|
||||
|
||||
@@ -18,7 +18,6 @@ fn test_mcp_config(codex_home: PathBuf) -> McpConfig {
|
||||
McpConfig {
|
||||
chatgpt_base_url: "https://chatgpt.com".to_string(),
|
||||
apps_mcp_path_override: None,
|
||||
new_apps_mcp_enabled: false,
|
||||
codex_home,
|
||||
mcp_oauth_credentials_store_mode: OAuthCredentialsStoreMode::default(),
|
||||
mcp_oauth_callback_port: None,
|
||||
@@ -205,29 +204,6 @@ fn codex_apps_mcp_url_uses_legacy_codex_apps_path() {
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn codex_apps_mcp_url_uses_plugin_service_path_when_new_apps_mcp_is_enabled() {
|
||||
let mut config = test_mcp_config(PathBuf::from("/tmp"));
|
||||
config.new_apps_mcp_enabled = true;
|
||||
|
||||
assert_eq!(
|
||||
codex_apps_mcp_url(&config),
|
||||
"https://chatgpt.com/backend-api/ps/mcp"
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn codex_apps_mcp_url_prefers_path_override_over_new_apps_mcp() {
|
||||
let mut config = test_mcp_config(PathBuf::from("/tmp"));
|
||||
config.apps_mcp_path_override = Some("/custom/mcp".to_string());
|
||||
config.new_apps_mcp_enabled = true;
|
||||
|
||||
assert_eq!(
|
||||
codex_apps_mcp_url(&config),
|
||||
"https://chatgpt.com/backend-api/custom/mcp"
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn codex_apps_server_config_uses_legacy_codex_apps_path() {
|
||||
let mut config = test_mcp_config(PathBuf::from("/tmp"));
|
||||
|
||||
Reference in New Issue
Block a user