Skip to content

Missing Explanation of headers allowlist in FastApiMCP #249

@sarang-pratham

Description

@sarang-pratham

Describe

While using the library, I noticed that the FastApiMCP class supports forwarding custom HTTP headers via the headers allowlist parameter (defined in fastapi_mcp/server.py).
However, this behavior is not documented in docs/advanced/auth.mdx.

Currently the docs explain basic authorization header passthrough, but users have no indication that:

  • additional headers can be forwarded
  • the feature is configurable at initialization
  • forwarded headers are accessible inside tools

Documenting this would make custom authentication, tracing, and metadata propagation much more discoverable.

Proposed Addition

Add a new subsection under the Advanced Auth page: Forwarding Custom HTTP Headers
explain the headers allowlist to show how to pass it to FastApiMCP(headers=[...])

Additional Context

I already prepared a pull request #248 adding this documentation.
Opening this issue to track the improvement and reference the PR.

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationImprovements or additions to documentation

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions