codeant-ai-for-open-source[bot] commented on PR #38867:
URL: https://github.com/apache/superset/pull/38867#issuecomment-4131249923

   ## **Sequence Diagram**
   
   This PR changes the MCP Flask singleton to detect an existing Flask app via 
has_app_context and reuse it when running inside Superset, only creating a new 
app when no app context exists, avoiding double initialization and fragile 
appbuilder internals.
   
   ```mermaid
   sequenceDiagram
       participant CLI
       participant FlaskCLI
       participant MCPModule
       participant FlaskApp
   
       CLI->>FlaskCLI: Run superset mcp run
       FlaskCLI->>FlaskApp: Create app and push context
       FlaskCLI->>MCPModule: Import MCP flask_singleton
       MCPModule->>MCPModule: Check has_app_context
   
       alt App context exists
           MCPModule->>FlaskApp: Reuse current_app for MCP service
       else No app context
           MCPModule->>FlaskApp: Create new Flask app for MCP service
       end
   ```
   
   ---
   *Generated by [CodeAnt AI](https://codeant.ai)*
   


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