Attribute OpenAI docs MCP requests to Codex (#33424)

## What changed

- Add `source=codex` to requests sent to the OpenAI developer docs MCP endpoint.
- Preserve OAuth discovery URLs and leave clients for other MCP servers unchanged.

## Testing

- Add unit coverage for regular and streaming HTTP requests, OAuth discovery, and non-docs MCP clients.

GitOrigin-RevId: d04e19fe6fc2db0b5cd7bfb429f0cb821c49b28a
This commit is contained in:
Konstantine Kahadze authored and copyberry committed 2026-07-15 20:54:54 +00:00
1 parent 9ab3dd8b9f
commit 2b486b4676
4 files changed
+151

No files matched your search

+2
View File
@@ -25,6 +25,7 @@ use crate::codex_apps::prepare_openai_file_params_for_model;
use crate::elicitation::ElicitationRequestManager;
use crate::mcp::CODEX_APPS_MCP_SERVER_NAME;
use crate::mcp::ToolPluginProvenance;
use crate::openai_docs_source_attribution::maybe_with_openai_docs_source_attribution;
use crate::runtime::McpRuntimeContext;
use crate::runtime::emit_duration;
use crate::server::EffectiveMcpServer;
@@ -1077,6 +1078,7 @@ async fn make_rmcp_client(
|| Arc::new(ReqwestHttpClient) as Arc<dyn HttpClient>,
|environment| environment.get_http_client(),
);
let http_client = maybe_with_openai_docs_source_attribution(&url, http_client);
let resolved_bearer_token =
match resolve_bearer_token(server_name, bearer_token_env_var.as_deref()) {
Ok(token) => token,