@@ -180,15 +180,15 @@ async def my_new_prompt_handler(
180180
181181### How to Add a New Resource
182182
183- Resources still use direct FastMCP decorators plus ` @mcp_auth_hook ` for authentication:
183+ Resources use direct FastMCP decorators and ** must include ` @mcp_auth_hook ` ** for authentication:
184184
185185``` python
186186# superset/mcp_service/chart/resources/my_new_resource.py
187187from superset.mcp_service.app import mcp
188- from superset.mcp_service.auth import mcp_auth_hook
188+ from superset.mcp_service.auth import mcp_auth_hook # REQUIRED for resources
189189
190190@mcp.resource (" superset://chart/my_resource" )
191- @mcp_auth_hook
191+ @mcp_auth_hook # Always add this decorator to resources
192192def get_my_resource () -> str :
193193 """ Resource description for LLMs."""
194194 return " Resource data here..."
@@ -200,13 +200,11 @@ def get_my_resource() -> str:
200200
201201The ` @tool ` decorator from ` superset_core.mcp.decorators ` accepts:
202202
203- | Parameter | Description | Default |
204- | -----------| -------------| ---------|
205- | ` tags ` | List of tags (e.g., ` ["core"] ` , ` ["mutate"] ` ) | ` [] ` |
206- | ` class_permission_name ` | FAB permission class (e.g., ` "Chart" ` , ` "Dashboard" ` ) | ` None ` |
207- | ` method_permission_name ` | Permission action (e.g., ` "read" ` , ` "write" ` ) | Auto: ` "write" ` if ` "mutate" ` in tags, else ` "read" ` |
208- | ` protect ` | Enable authentication wrapping | ` True ` |
209- | ` annotations ` | MCP ` ToolAnnotations ` object | ` None ` |
203+ - ** ` tags ` ** : List of tags (e.g., ` ["core"] ` , ` ["mutate"] ` ). Default: ` [] `
204+ - ** ` class_permission_name ` ** : FAB permission class (e.g., ` "Chart" ` , ` "Dashboard" ` ). Default: ` None `
205+ - ** ` method_permission_name ` ** : Permission action (e.g., ` "read" ` , ` "write" ` ). Default: Auto — ` "write" ` if ` "mutate" ` in tags, else ` "read" `
206+ - ** ` protect ` ** : Enable authentication wrapping. Default: ` True `
207+ - ** ` annotations ` ** : MCP ` ToolAnnotations ` object. Default: ` None `
210208
211209** ToolAnnotations** (from ` superset_core.mcp.decorators ` ):
212210``` python
@@ -421,13 +419,11 @@ These are used internally by `ModelListCore` for `filters` and `select_columns`.
421419
422420The MCP service uses FastMCP middleware (registered in ` server.py ` ):
423421
424- | Middleware | Purpose |
425- | -----------| ---------|
426- | ` LoggingMiddleware ` | Logs tool calls with duration, entity IDs, sanitizes sensitive data |
427- | ` GlobalErrorHandlerMiddleware ` | Catches unhandled exceptions, converts to ToolError |
428- | ` StructuredContentStripperMiddleware ` | Strips structuredContent from responses (Claude.ai compatibility) |
429- | ` ResponseSizeGuardMiddleware ` | Prevents oversized responses from crashing clients |
430- | ` ResponseCachingMiddleware ` | Optional response caching (in-memory by default, Redis when store enabled) |
422+ - ** ` LoggingMiddleware ` ** : Logs tool calls with duration, entity IDs, sanitizes sensitive data
423+ - ** ` GlobalErrorHandlerMiddleware ` ** : Catches unhandled exceptions, converts to ToolError
424+ - ** ` StructuredContentStripperMiddleware ` ** : Strips structuredContent from responses (Claude.ai compatibility)
425+ - ** ` ResponseSizeGuardMiddleware ` ** : Prevents oversized responses from crashing clients
426+ - ** ` ResponseCachingMiddleware ` ** : Optional response caching (in-memory by default, Redis when store enabled)
431427
432428Middleware is applied in ` server.py ` and should NOT be modified in individual tools.
433429
0 commit comments