How to Add Custom Headers to Outgoing Backend Requests (Proxy Mode, HTTP) #1800
Unanswered
rishidhupar
asked this question in
Q&A
Replies: 2 comments
-
|
If I understand it correctly, proxy server is just a local MCP server with stdio transport which redirect to another MCP server with HTTP transport. So you would have to pass those headers somehow through stdio. I don't know if there is any possible solution to achieve that atm. |
Beta Was this translation helpful? Give feedback.
0 replies
-
|
@rishidhupar I’m running into the same issue with the exact same setup. I also tried adding a custom middleware (as mentioned in this comment: #2819), but unfortunately it didn’t resolve the problem. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi,
We’re running FastMCP in proxy mode, both our proxy and backends use HTTP transport.
I’d like to know if there’s a recommended way to add custom headers to outgoing requests sent from the proxy to the backend servers (and not responses to clients). I see how to add middleware for responses, but haven’t found a clear way to intercept and modify backend request headers.
The specific use-case is related to authentication and passing metadata from the proxy server to backends.
Is there an official pattern or hook for this, or do we need to customize the transport layer directly?
Any code samples or pointers would be appreciated!
Thanks in advance,
Rishi
Beta Was this translation helpful? Give feedback.
All reactions