aminghadersohi commented on code in PR #41921:
URL: https://github.com/apache/superset/pull/41921#discussion_r3627338000


##########
superset/mcp_service/PRODUCTION.md:
##########
@@ -217,19 +217,49 @@ All MCP tools return consistent error schemas:
 
 **Error Tracking (Sentry)**:
 
+MCP tool execution runs on the FastMCP/Starlette asyncio stack, not Flask
+request handling, so `FlaskIntegration` alone does **not** capture MCP tool
+errors — it only sees the regular Superset web app's Flask requests. Use the
+vendor-neutral `MCP_ERROR_HOOK` config to forward system-class MCP errors
+(unexpected exceptions — not user errors like bad params or permission
+denials) to Sentry instead:
+
 ```python
 # superset_config.py
 import sentry_sdk
 from sentry_sdk.integrations.flask import FlaskIntegration
 
 sentry_sdk.init(
     dsn="https://[email protected]/project-id";,
-    integrations=[FlaskIntegration()],
+    integrations=[FlaskIntegration()],  # covers the Flask web app only
     environment="production",
     traces_sample_rate=0.1,  # 10% of transactions
 )
+
+
+def _mcp_error_hook(error: Exception, context: dict) -> None:
+    """Forward system-class MCP tool errors to Sentry.
+
+    ``context`` includes tool_name, mcp_call_id, user_id, error_type,
+    sanitized_message, and duration_ms — already sanitized by the MCP
+    service before this hook runs.
+    """
+    with sentry_sdk.push_scope() as scope:

Review Comment:
   Applied in 46c2332a6aca40a05c29223c187bfc891f9335cb — switched to 
`sentry_sdk.new_scope()`.



-- 
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