aminghadersohi opened a new pull request, #38400:
URL: https://github.com/apache/superset/pull/38400

   ### SUMMARY
   
   The `chart/`, `dashboard/`, and `dataset/` directories under 
`superset/mcp_service/` were missing `__init__.py` files. Since `setup.py` uses 
`setuptools.find_packages()`, which only discovers directories that contain 
`__init__.py`, these packages and all their sub-packages (`resources/`, 
`prompts/`, `tool/`) were excluded from built distributions.
   
   This caused MCP resources like `chart://configs` and `instance://metadata` 
to be unavailable in packaged deployments, even though they worked correctly in 
local development (where Python's namespace package mechanism allows imports 
without `__init__.py`).
   
   **Root cause**: `find_packages()` requires `__init__.py` to recognize a 
directory as a Python package. Without it, the entire subtree is skipped during 
packaging.
   
   **Fix**:
   - Added `__init__.py` to `superset/mcp_service/chart/`, `dashboard/`, and 
`dataset/`
   - Added test to verify all MCP resources are properly registered with the 
FastMCP server
   - Added test to verify all MCP sub-packages have `__init__.py` for 
setuptools discoverability
   
   For reference, these directories already had `__init__.py` and worked 
correctly:
   - `superset/mcp_service/system/` 
   - `superset/mcp_service/explore/`
   - `superset/mcp_service/sql_lab/`
   
   ### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
   
   N/A - no UI changes
   
   ### TESTING INSTRUCTIONS
   
   1. Run the new tests:
      ```bash
      pytest tests/unit_tests/mcp_service/test_mcp_tool_registration.py -v
      ```
   2. Verify all 4 tests pass, including the new 
`test_mcp_resources_registered` and 
`test_mcp_packages_discoverable_by_setuptools`
   3. Optionally, verify resources are listed by an MCP client:
      ```
      ListMcpResourcesTool for the connected MCP server should return 
chart://configs and instance://metadata
      ```
   
   ### ADDITIONAL INFORMATION
   - [ ] Has associated issue:
   - [ ] 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]

Reply via email to