Skip to content

Forward session and turn headers to MCP HTTP requests#15011

Open
nicholasclark-openai wants to merge 6 commits intomainfrom
nicholasclark/tool-call-task-headers
Open

Forward session and turn headers to MCP HTTP requests#15011
nicholasclark-openai wants to merge 6 commits intomainfrom
nicholasclark/tool-call-task-headers

Conversation

@nicholasclark-openai
Copy link

Summary

  • forward request-scoped task headers through MCP tool metadata lookups and tool calls
  • apply those headers to streamable HTTP initialize, tools/list, and tools/call requests
  • update affected rmcp/core tests for the new request_headers plumbing

Testing

  • cargo test -p codex-rmcp-client
  • cargo test -p codex-core (fails on pre-existing unrelated error in core/src/auth_env_telemetry.rs: missing websocket_connect_timeout_ms in ModelProviderInfo initializer)
  • just fix -p codex-rmcp-client
  • just fix -p codex-core (hits the same unrelated auth_env_telemetry.rs error)
  • just fmt

Co-authored-by: Codex <noreply@openai.com>
@github-actions
Copy link
Contributor

github-actions bot commented Mar 18, 2026

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

Co-authored-by: Codex <noreply@openai.com>
@nicholasclark-openai
Copy link
Author

I have read the CLA Document and I hereby sign the CLA

@nicholasclark-openai nicholasclark-openai changed the title Forward tool call task headers to MCP HTTP requests Forward session and task headers to MCP HTTP requests Mar 18, 2026
@nicholasclark-openai nicholasclark-openai changed the title Forward session and task headers to MCP HTTP requests Forward session and turn headers to MCP HTTP requests Mar 18, 2026

impl ManagedClient {
fn listed_tools(&self) -> Vec<ToolInfo> {
fn listed_tools(&self, _request_headers: Option<reqwest::header::HeaderMap>) -> Vec<ToolInfo> {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why unused parameter?

tool_plugin_provenance: Arc<ToolPluginProvenance>,
}

struct StartupRequestHeadersGuard {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what is this for?

#[derive(Clone)]
struct StreamableHttpResponseClient {
inner: reqwest::Client,
request_headers_state: Arc<StdMutex<Option<HeaderMap>>>,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are we reusing the same client while mutating headers from various calls? Is there a data race?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I.e. if two threads call client in parallel, who's headers win?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants