aminghadersohi opened a new pull request, #40471:
URL: https://github.com/apache/superset/pull/40471

   ### SUMMARY
   
   Adds a browser-friendly hello page for the MCP endpoint. When a user opens 
the MCP URL in a browser, they see a styled HTML page with setup instructions 
instead of a `405 Method Not Allowed`.
   
   **Implementation:** `BrowserHelloMiddleware` (`BaseHTTPMiddleware`) 
intercepts `GET`/`HEAD` requests with a browser `Accept: text/html` header 
before they reach FastMCP's router. Wired in `server.py` for both single-pod 
(`mcp.run()`) and multi-pod (`mcp.http_app()` + uvicorn) paths.
   
   **Features:**
   - Auth-aware config snippet: omits `Authorization` header when auth is off, 
includes it when auth is on
   - Branding from Flask config: title and description use `APP_NAME`; logo 
shown if `APP_ICON` is an absolute URL or if `SUPERSET_WEBSERVER_ADDRESS` is 
set (used to resolve relative icon paths)
   - Config-driven via `MCP_HELLO_PAGE` dict — deployments can override 
`title`, `server_key`, `show_transport`, `clients`, `logo_url`, and `app_name`
   
   ### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
   
   **Before:** `405 Method Not Allowed` for any browser `GET` to `/mcp`
   
   **After:** 200 HTML page with setup instructions. Config snippet adapts to 
auth state:
   - Auth off: `{"url": "<this-url>", "transport": "streamable-http"}`
   - Auth on: includes `"Authorization": "Bearer <your-api-key>"`
   
   ### TESTING INSTRUCTIONS
   
   1. Start MCP server: `superset mcp run --port 5008 --debug`
   2. Browser visit `http://localhost:5008/mcp` — should show the HTML hello 
page
   3. Browser visit `http://localhost:5008/` — should also show the hello page
   4. `curl -s -H "Accept: text/html,*/*" http://localhost:5008/mcp` — should 
return 200 HTML
   5. `curl -s -H "Accept: application/json" http://localhost:5008/mcp` — 
should return 405 (unaffected)
   6. Set `MCP_AUTH_ENABLED = True` in config, restart — config snippet should 
include `Authorization` header
   7. Set `MCP_HELLO_PAGE = {"title": "My MCP", "server_key": "my-superset"}` — 
page should reflect overrides
   
   ### ADDITIONAL INFORMATION
   
   - [ ] Has associated issue:
   - [ ] Required feature flags:
   - [ ] Changes UI
   - [ ] Includes DB Migration
   - [x] Introduces new feature or API
   - [ ] Removes existing feature or API


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