Skip to content

[MCP] Allow specifying custom headers with streamable http servers#5241

Merged
gpeal merged 3 commits intomainfrom
gpeal/mcp-http-headers
Oct 17, 2025
Merged

[MCP] Allow specifying custom headers with streamable http servers#5241
gpeal merged 3 commits intomainfrom
gpeal/mcp-http-headers

Conversation

@gpeal
Copy link
Copy Markdown
Collaborator

@gpeal gpeal commented Oct 16, 2025

This adds two new config fields to streamable http mcp servers:
http_headers: a map of key to value
env_http_headers a map of key to env var which will be resolved at request time

All headers will be passed to all MCP requests to that server just like authorization headers.

There is a test ensuring that headers are not passed to other servers.

Fixes #5180

@gpeal gpeal requested review from bolinfest and jif-oai October 16, 2025 04:51

let config_path = codex_home.path().join(CONFIG_TOML_FILE);
let serialized = std::fs::read_to_string(&config_path)?;
assert_eq!(
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

👍

@jdsalasca
Copy link
Copy Markdown
Contributor

Please add this on 0.47 version c: I'm tired of using proxies to connect because not custom headers are allowed

@gpeal gpeal merged commit a5d48a7 into main Oct 17, 2025
20 checks passed
@gpeal gpeal deleted the gpeal/mcp-http-headers branch October 17, 2025 03:15
@github-actions github-actions Bot locked and limited conversation to collaborators Oct 17, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add support for custom headers for streamable HTTP MCP servers

3 participants