aminghadersohi commented on code in PR #40098:
URL: https://github.com/apache/superset/pull/40098#discussion_r3277200913
##########
superset/mcp_service/__main__.py:
##########
@@ -47,32 +47,27 @@ def secho_to_stderr(*args: Any, **kwargs: Any) -> Any:
def _add_default_middlewares() -> None:
"""Add the standard middleware stack to the MCP instance.
- This ensures all entry points (stdio, streamable-http, etc.) get
- the same protection middlewares that the Flask CLI and server.py add.
- Order is innermost → outermost (last-added wraps everything).
+ Delegates to ``server.build_middleware_list()`` for the core stack so
+ the stdio entry point stays in sync with the HTTP server without
+ duplicating middleware ordering. The optional response size guard is
+ appended separately (innermost position, same as in run_server()).
+
+ FastMCP wraps handlers so that the FIRST-added middleware is outermost.
+ ``build_middleware_list()`` already returns middlewares in the correct
+ outermost-first order.
"""
- from superset.mcp_service.middleware import (
- create_response_size_guard_middleware,
- GlobalErrorHandlerMiddleware,
- LoggingMiddleware,
- StructuredContentStripperMiddleware,
- )
-
- # Response size guard (innermost among these)
+ from superset.mcp_service.middleware import
create_response_size_guard_middleware
+ from superset.mcp_service.server import build_middleware_list
Review Comment:
any reason these are not upper level?
--
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]