aminghadersohi opened a new pull request, #38534: URL: https://github.com/apache/superset/pull/38534
### SUMMARY `fastmcp` is declared as an optional dependency in `pyproject.toml` (under `[project.optional-dependencies]`), but Superset crashes on startup if it is not installed. The root cause is that `initialize_core_mcp_dependencies()` unconditionally imports `superset.mcp_service.app`, which does `from fastmcp import FastMCP` at module level. This function is called during Superset's `init_core_dependencies()` in `superset/initialization/__init__.py`, making `fastmcp` effectively a hard requirement at startup. **Fix:** Guard the MCP initialization with early-return checks for both `superset_core.mcp.decorators` and `fastmcp` availability. When either is missing, MCP is simply disabled with an info log and Superset starts normally. Also wraps the call site in `init_core_dependencies()` with a try/except ImportError for defense in depth. Fixes #38514 ### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF N/A — backend change ### TESTING INSTRUCTIONS 1. Uninstall fastmcp: `pip uninstall fastmcp` 2. Start Superset: `superset run -p 8088` 3. Verify Superset starts without `ModuleNotFoundError` — should see info log: `fastmcp is not installed, skipping MCP initialization` 4. Reinstall fastmcp: `pip install fastmcp` 5. Restart Superset — MCP tools should register normally ### ADDITIONAL INFORMATION - [x] Has associated issue: Fixes #38514 - [ ] Required feature flags: - [ ] Changes UI - [ ] Includes DB Migration (follow approval process in [SIP-59](https://github.com/apache/superset/issues/13351)) - [ ] Migration is atomic, supports rollback & is backwards-compatible - [ ] Confirm DB migration upgrade and downgrade tested - [ ] Runtime estimates and downtime expectations provided - [ ] Introduces new feature or API - [ ] Removes existing feature or API -- 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]
