codeant-ai-for-open-source[bot] commented on code in PR #43842:
URL: https://github.com/apache/superset/pull/43842#discussion_r3930833708


##########
superset/initialization/__init__.py:
##########
@@ -558,7 +558,12 @@ def init_core_dependencies(self) -> None:
         )
 
         initialize_core_api_dependencies()
-        initialize_core_mcp_dependencies()
+        # MCP host tools only need to be registered in processes that serve MCP
+        # (the web app and the standalone MCP service). Deployments can disable
+        # this in processes that never serve MCP -- e.g. Celery workers -- to
+        # avoid importing the MCP stack where it is unused.
+        if self.config.get("CORE_MCP_HOST_TOOLS_ENABLED", True):
+            initialize_core_mcp_dependencies()

Review Comment:
   Yes. Decorator replacement should be independent of host-tool registration.
   
   `CORE_MCP_HOST_TOOLS_ENABLED=False` should prevent importing/registering the 
MCP host-tool stack, but it must still install the functional `@tool` and 
`@prompt` decorators before extensions load. Otherwise an extension that 
declares MCP metadata can raise `NotImplementedError` and prevent unrelated 
contributions, such as Celery tasks, from being registered.
   
   A minimal structure would be:
   
   ```python
   initialize_core_mcp_decorators()
   
   if self.config.get("CORE_MCP_HOST_TOOLS_ENABLED", True):
       initialize_core_mcp_host_tools()
   ```
   
   This likely requires splitting `initialize_core_mcp_dependencies()` into a 
lightweight decorator-initialization step and a host-tool registration step. 
The decorator path should avoid importing the MCP service application, 
preserving the worker memory benefit while maintaining extension-loading 
compatibility.



-- 
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]

Reply via email to