Add support for forwarding headers from MCP clients to GraphQL APIs #428
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #198
Adds opt-in support for dynamic header forwarding, which enables metadata for A/B testing, feature flagging, geo information from CDNs, or internal instrumentation to be sent from MCP clients to downstream GraphQL APIs. It automatically blocks hop-by-hop headers according to the guidelines in RFC 7230, section 6.1, and it only works with the Streamable HTTP transport.
You can configure using the
forward_headers
setting:Please note that this feature is not intended for passing through credentials as documented in the best practices page.
E2E Test
Configure the MCP server to target the Platform API and enable CORS as below, then verify end‑to‑end with MCP Inspector:
With the 3 required headers set in MCP Inspector, tool execution succeeds:
If you configure MCP Inspector with Connection Type = Direct, you can also inspect the MCP call in the browser:
If any required header is missing, the server returns an error: