-
Notifications
You must be signed in to change notification settings - Fork 880
Add configurable HTTP header forwarding #181
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
self._forward_headers = {h.lower() for h in (headers or ["Authorization"])} I think adding "Authorization" as default value here has no effect. This set is tested against lower cased strings so that would never match. Also, "Authorization" is added separately Suggest changing to this? self._forward_headers = {h.lower() for h in (headers or [])} Or to this: self._forward_headers = {h.lower() for h in (headers or ["authorization"])} |
|
Just to clarify, The special-case check for testing |
@erpic see @floran-putter 's message Re Authorization backwards compatibility. Can we merge? |
|
On god please merge this 😭 |
Codecov ReportAll modified and coverable lines are covered by tests ✅ 📢 Thoughts on this report? Let us know! |
shahar4499
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great job! Thanks!!
|
Hey there, please add this to the guide (https://fastapi-mcp.tadata.com/advanced/auth). I'm sure other devs will appreciate this as myself would have some hours ago haha |
Describe your changes
headersargument to FastApiMCP to specify an allow-list for HTTP header forwarding._execute_api_tool, match incoming headers case-insensitive against the allow-list and forward them using their original names."authorization"to"Authorization"and update the existing header-passthrough test accordingly.fastapi_mcp_with_custom_headerandtest_custom_header_passthrough_to_tool_handlerto test custom header passthrough.Issue ticket number and link (if applicable)
Closes #113
Screenshots of the feature / bugfix
Checklist before requesting a review