Can’t pass per-request headers like Authorization using from_openapi #344
-
I’m trying to use FastMCP.from_openapi to build a server from an OpenAPI spec, but I can’t figure out how to forward per-request headers (like Authorization or Cookie) from the MCP client. The headers parameter on from_openapi only supports static headers, which doesn’t work in a multi-user setup. Ideally, the MCP client would send headers and the server would forward them for each request, but I haven’t found a way to do that with from_openapi. Here’s the basic setup:
I’ve worked around this by creating a manual tool like this:
But this feels like a hack, and it defeats the point of using from_openapi. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
That's an excellent point. I've turned this into #346 |
Beta Was this translation helpful? Give feedback.
That's an excellent point. I've turned this into #346