feat(mcp): add create_rls_filter tool for row-level security management#40356
Draft
aminghadersohi wants to merge 1 commit into
Draft
feat(mcp): add create_rls_filter tool for row-level security management#40356aminghadersohi wants to merge 1 commit into
aminghadersohi wants to merge 1 commit into
Conversation
Adds a new admin-only MCP mutation tool that creates row-level security filter rules via CreateRLSRuleCommand, following the same pattern as create_virtual_dataset. Supports Regular and Base filter types with SQL WHERE clauses applied to specified tables and roles.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #40356 +/- ##
==========================================
- Coverage 64.20% 64.19% -0.01%
==========================================
Files 2592 2595 +3
Lines 139004 139061 +57
Branches 32273 32275 +2
==========================================
+ Hits 89241 89274 +33
- Misses 48231 48255 +24
Partials 1532 1532
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
SUMMARY
Adds a new
create_rls_filterMCP mutation tool that allows AI assistants to create row-level security (RLS) filter rules in Apache Superset.RLS filters restrict which rows users can see based on their role membership. This tool enables programmatic creation of these access-control policies via the MCP service.
Key design decisions:
CreateRLSRuleCommandfromsuperset.commands.security.create— same command used by the REST APIPOST /api/v1/rowlevelsecurity/Row Level Securitywrite permission (class_permission_name="Row Level Security",method_permission_name="write")mutatewithreadOnlyHint=Falsefollowing the mutation tool patternsuperset/mcp_service/rls/following the existing module structureSupported filter types:
Regular: Hides rows from specified roles unless the SQL clause matchesBase: Shows only rows where the SQL clause matches to specified rolesBEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
N/A — backend-only MCP tool.
TESTING INSTRUCTIONS
create_rls_filterwith:{ "name": "EMEA filter", "filter_type": "Regular", "tables": [<valid_table_id>], "roles": [<valid_role_id>], "clause": "region = 'EMEA'" }Error cases to test:
DatasourceNotFoundValidationErrormessageRolesNotFoundValidationErrormessageADDITIONAL INFORMATION