Skip to content

feat(mcp): dynamic feature availability via menus and feature flags - #37964

Merged
Antonio-RiveroMartnez merged 9 commits into
apache:masterfrom
aminghadersohi:amin/mcp-unavailable-features-warning
Feb 25, 2026
Merged

Antonio-RiveroMartnez merged 9 commits into
apache:masterfrom
aminghadersohi:amin/mcp-unavailable-features-warning

Conversation

@aminghadersohi

@aminghadersohi aminghadersohi commented Feb 13, 2026 •

Copy link
Copy Markdown
Contributor

SUMMARY

When the MCP service can't answer a user's question via available tools, LLMs fall back to suggesting UI features that may not exist in a given deployment. This misleads users.

This PR adds dynamic feature detection to get_instance_info so LLMs know what's actually available at request time:

  • get_instance_info now returns a feature_availability section containing accessible_menus — the menu items the current user can access (via security_manager.user_view_menu_names("menu_access"))
  • MCP instructions now direct LLMs to call get_instance_info for feature availability instead of assuming what exists

Why dynamic? Menus already track what's available per-user and per-deployment via FAB role permissions. Querying them at request time means feature availability stays in sync automatically — no manual configuration needed.

Example get_instance_info response (truncated)

{
  "instance_summary": { "total_dashboards": 0, "total_charts": 0, "total_datasets": 15, ... },
  "current_user": { "id": 1, "username": "admin", "first_name": "Admin I.", ... },
  "feature_availability": {
    "accessible_menus": [
      "Action Log", "Alerts & Report", "Annotation Layers", "CSS Templates",
      "Charts", "Dashboards", "Data", "Databases", "Datasets", "Extensions",
      "Home", "List Groups", "List Roles", "List Users", "Manage", "Plugins",
      "Query Search", "Row Level Security", "SQL Editor", "SQL Lab",
      "Saved Queries", "Security", "Tags", "Tasks", "Themes", "User Registrations"
    ]
  },
  "timestamp": "2026-02-24T18:23:43.927486Z"
}

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

N/A - backend change, no UI impact

TESTING INSTRUCTIONS

Automated Tests

pytest tests/unit_tests/mcp_service/test_mcp_config.py tests/unit_tests/mcp_service/system/test_system_utils.py -x -v

QA Manual Testing Steps

Test 1: Feature availability in get_instance_info

  1. Connect an MCP client and call get_instance_info
  2. Expected: Response includes feature_availability with accessible_menus populated from the user's FAB permissions

Test 2: Per-user menu access

  1. Connect as a user with limited roles (e.g., Gamma)
  2. Call get_instance_info
  3. Expected: accessible_menus only contains menus the user has menu_access permission for — admin-only menus should not appear

Test 3: Instructions reference get_instance_info

  1. Inspect the MCP server instructions
  2. Expected: Instructions mention "Feature Availability" and direct LLMs to call get_instance_info for accessible menus

ADDITIONAL INFORMATION

  • Has associated issue:
  • Required feature flags:
  • Changes UI
  • Includes DB Migration (follow approval process in SIP-59)
    • 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

@bito-code-review

bito-code-review Bot commented Feb 13, 2026 •

Copy link
Copy Markdown
Contributor

Code Review Agent Run #8dd73a

Actionable Suggestions - 0
Review Details
  • Files reviewed - 3 · Commit Range: 427ba68..427ba68
    • superset/mcp_service/app.py
    • superset/mcp_service/mcp_config.py
    • tests/unit_tests/mcp_service/test_mcp_config.py
  • Files skipped - 0
  • Tools
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ Successful
    • MyPy (Static Code Analysis) - ✔︎ Successful
    • Astral Ruff (Static Code Analysis) - ✔︎ Successful

Bito Usage Guide

Commands

Type the following command in the pull request comment and save the comment.

  • /review - Manually triggers a full AI review.

  • /pause - Pauses automatic reviews on this pull request.

  • /resume - Resumes automatic reviews.

  • /resolve - Marks all Bito-posted review comments as resolved.

  • /abort - Cancels all in-progress reviews.

Refer to the documentation for additional commands.

Configuration

This repository uses Superset You can customize the agent settings here or contact your Bito workspace admin at evan@preset.io.

Documentation & Help

AI Code Review powered by Bito Logo

@dosubot dosubot Bot added the change:backend Requires changing the backend label Feb 13, 2026
@codecov

codecov Bot commented Feb 13, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 14 lines in your changes missing coverage. Please review.
✅ Project coverage is 66.38%. Comparing base (7b04d25) to head (69b69a0).
⚠️ Report is 5 commits behind head on master.

Files with missing lines Patch % Lines
superset/mcp_service/system/system_utils.py 0.00% 11 Missing ⚠️
superset/mcp_service/system/schemas.py 0.00% 3 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           master   #37964       +/-   ##
===========================================
+ Coverage        0   66.38%   +66.38%     
===========================================
  Files           0      670      +670     
  Lines           0    51469    +51469     
  Branches        0     5810     +5810     
===========================================
+ Hits            0    34169    +34169     
- Misses          0    15905    +15905     
- Partials        0     1395     +1395     
Flag Coverage Δ
hive 41.40% <0.00%> (?)
mysql 64.49% <0.00%> (?)
postgres 64.57% <0.00%> (?)
presto 41.42% <0.00%> (?)
python 66.36% <0.00%> (?)
sqlite 64.16% <0.00%> (?)
unit 100.00% <ø> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@netlify

netlify Bot commented Feb 13, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for superset-docs-preview ready!

Name Link
🔨 Latest commit b0ed63c
🔍 Latest deploy log https://app.netlify.com/projects/superset-docs-preview/deploys/699dd9180611a2000910a9de
😎 Deploy Preview https://deploy-preview-37964--superset-docs-preview.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@bito-code-review

bito-code-review Bot commented Feb 13, 2026 •

Copy link
Copy Markdown
Contributor

Code Review Agent Run #590807

Actionable Suggestions - 0
Additional Suggestions - 1
  • tests/unit_tests/mcp_service/test_mcp_config.py - 1
    • Docstring mismatch · Line 183-183
      The docstring appears inconsistent with the test function name and the actual code being tested, which calls `init_fastmcp_server()`. It looks like this might be an oversight in the change.
      Code suggestion
       @@ -183,1 +183,1 @@
      -    """Test that init reads MCP_UNAVAILABLE_FEATURES from Flask config."""
      +    """Test that init_fastmcp_server reads MCP_UNAVAILABLE_FEATURES from Flask config."""
Review Details
  • Files reviewed - 3 · Commit Range: 427ba68..15d10f0
    • superset/mcp_service/app.py
    • superset/mcp_service/mcp_config.py
    • tests/unit_tests/mcp_service/test_mcp_config.py
  • Files skipped - 0
  • Tools
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ Successful
    • MyPy (Static Code Analysis) - ✔︎ Successful
    • Astral Ruff (Static Code Analysis) - ✔︎ Successful

Bito Usage Guide

Commands

Type the following command in the pull request comment and save the comment.

  • /review - Manually triggers a full AI review.

  • /pause - Pauses automatic reviews on this pull request.

  • /resume - Resumes automatic reviews.

  • /resolve - Marks all Bito-posted review comments as resolved.

  • /abort - Cancels all in-progress reviews.

Refer to the documentation for additional commands.

Configuration

This repository uses Superset You can customize the agent settings here or contact your Bito workspace admin at evan@preset.io.

Documentation & Help

AI Code Review powered by Bito Logo

Comment thread superset/mcp_service/app.py Outdated
@bito-code-review

Copy link
Copy Markdown
Contributor

The features in unavailable_features are arbitrary strings not tied to tool names, as you noted. By default, there's no exhaustive list; it's configurable via MCP_UNAVAILABLE_FEATURES in the config, with an example like ["Action Log (Settings > Security > Action Log)", "List Users page"]. To make it easier, consider adding a documented list of all possible features in the config file or README, based on Superset's UI elements.

@pull-request-size pull-request-size Bot added size/L and removed size/M labels Feb 20, 2026
@bito-code-review

bito-code-review Bot commented Feb 20, 2026 •

Copy link
Copy Markdown
Contributor

Code Review Agent Run #9642bb

Actionable Suggestions - 0
Review Details
  • Files reviewed - 3 · Commit Range: 15d10f0..266d14d
    • superset/mcp_service/app.py
    • superset/mcp_service/mcp_config.py
    • tests/unit_tests/mcp_service/test_mcp_config.py
  • Files skipped - 0
  • Tools
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ Successful
    • MyPy (Static Code Analysis) - ✔︎ Successful
    • Astral Ruff (Static Code Analysis) - ✔︎ Successful

Bito Usage Guide

Commands

Type the following command in the pull request comment and save the comment.

  • /review - Manually triggers a full AI review.

  • /pause - Pauses automatic reviews on this pull request.

  • /resume - Resumes automatic reviews.

  • /resolve - Marks all Bito-posted review comments as resolved.

  • /abort - Cancels all in-progress reviews.

Refer to the documentation for additional commands.

Configuration

This repository uses Superset You can customize the agent settings here or contact your Bito workspace admin at evan@preset.io.

Documentation & Help

AI Code Review powered by Bito Logo

Comment thread superset/mcp_service/mcp_config.py Outdated
Comment thread superset/mcp_service/mcp_config.py Outdated
Comment thread superset/mcp_service/mcp_config.py Outdated
…c warnings

When the MCP service can't answer a user's question via available tools,
LLMs may suggest Superset UI features that don't exist in all deployments
(e.g., Action Log, List Users in Preset). This adds a configurable list
that gets injected into MCP instructions so LLMs know not to suggest them.
Add MCP_FEATURE_ACTION_LOG, MCP_FEATURE_LIST_USERS, MCP_FEATURE_LIST_ROLES
constants and MCP_ALL_KNOWN_FEATURES convenience list so deployers can
reference well-known features instead of guessing string values.

Addresses review feedback requesting a standard way to discover available
feature names for the config.

Also fixes test docstring line-length violation (E501).
…tion

Instead of maintaining a static list of MCP_FEATURE_* constants that
operators must manually keep in sync, dynamically detect feature
availability at request time by querying:
- FAB security manager for accessible menus (user_view_menu_names)
- Feature flag manager for enabled/disabled flags (get_feature_flags)
- MCP_UNAVAILABLE_FEATURES as a minimal escape hatch for custom notes

The get_instance_info tool now returns a feature_availability section
with accessible_menus, enabled_feature_flags, and custom_unavailable_features,
giving LLMs accurate per-user context without stale hardcoded lists.
@aminghadersohi
aminghadersohi force-pushed the amin/mcp-unavailable-features-warning branch from 8921e1e to b0ed63c Compare February 24, 2026 17:00
Dynamic detection via menus and feature flags makes this config
redundant. No reason to keep a static escape hatch when the same
information is already available from existing systems.
@aminghadersohi aminghadersohi changed the title feat(mcp): add MCP_UNAVAILABLE_FEATURES config for deployment-specific warnings feat(mcp): dynamic feature availability via menus and feature flags Feb 24, 2026
@bito-code-review

bito-code-review Bot commented Feb 24, 2026 •

Copy link
Copy Markdown
Contributor

Code Review Agent Run #b128d6

Actionable Suggestions - 0
Review Details
  • Files reviewed - 7 · Commit Range: 999ffae..3000b33
    • superset/mcp_service/app.py
    • superset/mcp_service/system/schemas.py
    • superset/mcp_service/system/system_utils.py
    • superset/mcp_service/system/tool/get_instance_info.py
    • tests/unit_tests/mcp_service/system/test_system_utils.py
    • tests/unit_tests/mcp_service/system/tool/test_get_current_user.py
    • tests/unit_tests/mcp_service/test_mcp_config.py
  • Files skipped - 0
  • Tools
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ Successful
    • MyPy (Static Code Analysis) - ✔︎ Successful
    • Astral Ruff (Static Code Analysis) - ✔︎ Successful

Bito Usage Guide

Commands

Type the following command in the pull request comment and save the comment.

  • /review - Manually triggers a full AI review.

  • /pause - Pauses automatic reviews on this pull request.

  • /resume - Resumes automatic reviews.

  • /resolve - Marks all Bito-posted review comments as resolved.

  • /abort - Cancels all in-progress reviews.

Refer to the documentation for additional commands.

Configuration

This repository uses Superset You can customize the agent settings here or contact your Bito workspace admin at evan@preset.io.

Documentation & Help

AI Code Review powered by Bito Logo

Only expose accessible_menus — feature flags are internal implementation
details that add noise and potential security surface area.
@bito-code-review

bito-code-review Bot commented Feb 24, 2026 •

Copy link
Copy Markdown
Contributor

Code Review Agent Run #f1d8c0

Actionable Suggestions - 0
Review Details
  • Files reviewed - 7 · Commit Range: 3000b33..69b69a0
    • superset/mcp_service/app.py
    • superset/mcp_service/system/schemas.py
    • superset/mcp_service/system/system_utils.py
    • superset/mcp_service/system/tool/get_instance_info.py
    • tests/unit_tests/mcp_service/system/test_system_utils.py
    • tests/unit_tests/mcp_service/system/tool/test_get_current_user.py
    • tests/unit_tests/mcp_service/test_mcp_config.py
  • Files skipped - 0
  • Tools
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ Successful
    • MyPy (Static Code Analysis) - ✔︎ Successful
    • Astral Ruff (Static Code Analysis) - ✔︎ Successful

Bito Usage Guide

Commands

Type the following command in the pull request comment and save the comment.

  • /review - Manually triggers a full AI review.

  • /pause - Pauses automatic reviews on this pull request.

  • /resume - Resumes automatic reviews.

  • /resolve - Marks all Bito-posted review comments as resolved.

  • /abort - Cancels all in-progress reviews.

Refer to the documentation for additional commands.

Configuration

This repository uses Superset You can customize the agent settings here or contact your Bito workspace admin at evan@preset.io.

Documentation & Help

AI Code Review powered by Bito Logo

@Antonio-RiveroMartnez
Antonio-RiveroMartnez merged commit 1cd35bb into apache:master Feb 25, 2026
67 checks passed
aminghadersohi added a commit to preset-io/superset that referenced this pull request Mar 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

change:backend Requires changing the backend size/L

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants