MikolajBalcerek commented on code in PR #45391:
URL: https://github.com/apache/superset/pull/45391#discussion_r4339910184
##########
superset/mcp_service/jwt_verifier.py:
##########
@@ -312,20 +315,34 @@ def __init__(
app: Any,
auth_enabled: bool = False,
page_config: dict[str, Any] | None = None,
+ mcp_path: str | None = None,
) -> None:
super().__init__(app)
self._html = _build_browser_hello_html(
auth_enabled=auth_enabled, page_config=page_config
)
+ # The streamable-HTTP endpoint FastMCP mounts (``/mcp`` by default).
+ self._mcp_path = _normalize_path(
+ mcp_path or fastmcp.settings.streamable_http_path
+ )
async def dispatch(
self, request: Request, call_next: Callable[..., Any]
) -> Response:
- if request.method in ("GET", "HEAD") and
_prefers_browser_html(request):
+ if (
+ request.method in ("GET", "HEAD")
+ and _normalize_path(request.url.path) == self._mcp_path
+ and _prefers_browser_html(request)
+ ):
return HTMLResponse(content=self._html, status_code=200)
return await call_next(request)
Review Comment:
Thanks, implemented and tested (both with prefix and without) on
https://github.com/apache/superset/pull/45391/changes/51e3d22283dc44e1b2a3b6d87b224f2d232a4659
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]