Skip to content

[AUTH FEATURE]: HTTP Header Passthrough (forward headers to MCP server)Β #208

@bechols-dmb

Description

@bechols-dmb

The company I work for is looking at using this as a gateway for our MCP servers. One issue is that we do authentication through a auth gateway that then provides authorization headers into this system. Those headers currently need to be passed along with all MCP tool invocations to whatever kind of backing system mcp/rest/gateway.

We would like to build the solution for this:

Allow for gateways or rest endpoints to be configured with 'allowed passthrough headers' that would be passed from an invoke tool request to the backing system for the invocation. This allows for passing in context about the invoker to the backing gateways / rest servers.

I am open to other suggestions for how to handle this.

🧭 Type of Feature

Please select the most appropriate category:

  • Enhancement to existing functionality
  • New feature or capability
  • New MCP-compliant server
  • New component or integration
  • Developer tooling or test improvement
  • Packaging, automation and deployment (ex: pypi, docker, quay.io, kubernetes, terraform)
  • Other (please describe below)

🧭 Epic

Title: Passthrough headers
Goal: Allow specific headers to be passed through requests to gateways or rest.
Why now: Allow for systems that need context to be passed to their their own authentication gateways already to pass authorization headers into the backing MCP servers.


πŸ™‹β€β™‚οΈ User Story 1

As a: mcp-context-forge hoster
I want: to pass context from the invoke_tool request to the backing systems
So that: the invoker's authorization of the tool can be confirmed.

βœ… Acceptance Criteria

Scenario: Successfully passing headers
  **State:** Gateway is configured with new "passthrough-headers" option
  **Action:** invoke_tool request is made with headers
  **Result:** The headers specified in the passthrough-headers for that gateway or rest endpoint are copied into the request being made to the backing system.

Scenario: No configured headers
  **State:** Gateway is configured with no headers allowed to be passed through
  **Action:** invoke_tool request is made with headers
  **Result:** no headers are copied from the request.

πŸ”— MCP Standards Check

  • Change adheres to current MCP specifications
  • No breaking changes to existing MCP-compliant integrations
  • If deviations exist, please describe them below:

πŸ”„ Alternatives Considered

Passthrough Auth - not really viable unless the whole auth system is changed to allow multiple headers. The more generic 'passthough headers' allows you to pass any kind of context which could be useful.
Virtual Server per user - would require the ability to set auth headers for every tool / gateway / rest endpoint. This would then require us to create a custom gateway for every user of every tool. This seems awkward and also would not scale well (because you would end up with tens of thousands of combinations of users and tools).
I see there is a roadmap item for 'per virtual server api keys' which could possibly kind-of solve this we would then just need another service/library to decode the key back into our various headers before the tools can be invoked with the correct cont


πŸ““ Additional Context

Sub-issues

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestsecurityImproves securitytriageIssues / Features awaiting triage

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions