mirror of
https://github.com/apache/superset.git
synced 2026-05-12 11:25:56 +00:00
- Updates create_chart logic to automatically remove x_axis from groupby for ECharts timeseries charts, preventing duplicate dimension usage. - Updates and expands unit test to verify x_axis is excluded from groupby, using improved test mocks for accurate backend simulation. - Updates documentation (README.md, README_ARCHITECTURE.md, README_PHASE1_STATUS.md, README_SCHEMAS.md) to clarify create_chart tool behavior and schema, including new groupby/x_axis handling. - No breaking changes to tool signatures; behavior is now more robust and LLM-friendly.
4.9 KiB
4.9 KiB
Superset MCP Service – Phase 1 Status Update
Background
The Model Context Protocol (MCP) is a new protocol for exposing high-level, structured actions in Superset, designed for LLM agents and automation. Phase 1 delivers a foundational, extensible MCP service in Superset, leveraging internal APIs (DAOs/commands) and providing a versioned, developer-friendly interface for both Apache and Preset use cases. (SIP-171)
Phase 1 Objectives (from SoW/SIP-171)
- Standalone MCP service, config flag, CLI, modular, stateless
- Strong typing: all actions use DAOs/commands and Pydantic schemas
- Clear extension points for Preset-specific auth, RBAC, and logging
- 3+ high-value MCP actions (list, info, mutation)
- Developer experience: easy to run, clear docs, tests
- Auth/RBAC/logging hooks stubbed, ready for enterprise
- Out of scope: full RBAC, impersonation, logging, external identity provider integration
What’s Delivered (Phase 1)
- Service infrastructure: ASGI-based FastMCP server, config flag, CLI (
superset mcp run), stateless - Strong typing: All tool input/output uses Pydantic v2 models with field descriptions
- Modular tools: Grouped by domain (
dashboard/,dataset/,chart/,system/), shared abstractions inmodel_tools.pyandmiddleware.py - Abstracted, reusable tools: List, info, and available filters tools are now abstracted and reusable across datasets, charts, and dashboards
- Tool registration: All tool functions use
@mcp.tooland@mcp_auth_hookdecorators for registration and auth (no more add_tool); DAOs/commands imported inside function body - DAO wrapper removed: The old dao wrapper has been removed for clarity and maintainability
- Auth/RBAC/logging hooks: Stubbed in
auth.pyandmiddleware.py, admin mode by default, ready for extension - Extension points: Documented and ready for Preset/enterprise
- Core actions implemented:
list_dashboards,list_datasets(now returns columns and metrics),list_chartsget_dashboard_info,get_dataset_info(now returns columns and metrics),get_chart_infoget_dashboard_available_filters,get_dataset_available_filters,get_chart_available_filterscreate_chart_simple(PoC for mutation)create_chart(advanced ECharts chart creation, supports stack, area, smooth, show_value, color_scheme, legend_type, legend_orientation, tooltip_sorting, y_axis_format, y_axis_bounds, x_axis_time_format, rich_tooltip, extra_options)get_superset_instance_info
- Tests: Unit and integration tests for all core tools, with improved coverage and best practices. Dataset and chart tools now have tests verifying advanced ECharts options and extra_options are included in responses.
- Docs: Architecture, schemas, and dev guides up to date
- Tool module reorganization: Modules have been reorganized for clarity and maintainability
- Chart creation tool modeling: Progress on modeling chart creation tool input parameters for flexibility and LLM-friendliness
What’s Next / Planned
- Primary focus: chart_create tool
- Design and implement a robust chart creation tool
- Explore how prompt engineering can guide chart creation (e.g., mapping user intent to chart config)
- Integrate prompt injection prevention from the start
- Support creating a chart and navigating the user to Explore with the settings (without saving the chart)
- Investigate backend rendering of charts for previews or agent feedback
- Add mutation tools for iterating on charts, dashboards, datasets, etc. (e.g., update, refine, clone)
- More advanced mutations (create/update/delete)
- Navigation tools (e.g., generate_explore_link, open_sql_lab_with_context)
- Full RBAC, impersonation, logging (stubbed only in Phase 1)
- Preset/enterprise integration (hooks ready)
Summary Table
| SoW Objective/Deliverable | Status (Phase 1) |
|---|---|
| Standalone MCP service, config flag, CLI | ✅ Delivered |
| Modular, typed schemas | ✅ Delivered |
| Abstracted, reusable list/info/filter tools | ✅ Delivered |
| 3+ core actions (list/count) | ✅ Delivered |
| Mutations (create/update) | 🟡 PoC for chart creation |
| Navigation actions | 🟡 Planned |
| Auth/RBAC hooks (stubbed) | ✅ Delivered |
| Documentation & dev guide | ✅ Delivered |
| Preset extension points | ✅ Delivered |
| Demo script/notebook | 🟡 Not in OSS, easy to run/tests |