cw1427 opened a new issue, #41610:
URL: https://github.com/apache/superset/issues/41610

   ### Bug description
   
   I have successfuly start mcp and setup the mcp client via cline. which could 
fetcht eh mcp tools info as below successfully with the user's  access_token.  
But when ask to execute the SQL have error response the g.user not found.
   
   `Error: Error calling tool 'execute_sql': No authenticated user found. Tried:
     - g.user was not set by JWT middleware (MCP_AUTH_ENABLED=True, JWT keys 
configured=True)
     - MCP_DEV_USERNAME is not configured
   
   Either pass a valid JWT bearer token or configure MCP_DEV_USERNAME for 
development.
   2026-07-01 06:13:55,068:ERROR:superset.mcp_service.auth:MCP user resolution 
failed, denying request: No authenticated user found. Tried:
     - g.user was not set by JWT middleware (MCP_AUTH_ENABLED=True, JWT keys 
configured=True)
     - MCP_DEV_USERNAME is not configured
   
   Either pass a valid JWT bearer token or configure MCP_DEV_USERNAME for 
development.
   [07/01/26 06:13:55] Error calling tool 'execute_sql'
                       ╭─────────── Traceback (most recent call last) 
────────────╮
                       │ 
/usr/local/lib/python3.10/site-packages/fastmcp/server/s │
                       │ erver.py:1282 in call_tool                             
  │
                       │                                                        
  │
                       │ 
/usr/local/lib/python3.10/site-packages/fastmcp/tools/ba │
                       │ se.py:392 in _run                                      
  │
                       │                                                        
  │
                       │                 ... 2 frames hidden ...                
  │
                       │                                                        
  │
                       │ 
/usr/local/lib/python3.10/site-packages/superset/mcp_ser │
                       │ vice/auth.py:309 in _setup_user_context                
  │
                       │                                                        
  │
                       │   306 │                                                
  │
                       │   307 │   for attempt in range(2):                     
  │
                       │   308 │   │   try:                                     
  │
                       │ ❱ 309 │   │   │   user = get_user_from_request()       
  │
                       │   310 │   │   │                                        
  │
                       │   311 │   │   │   # Validate user has necessary 
relation │
                       │   312 │   │   │   # Force access to ensure they're 
loade │
                       │                                                        
  │
                       │ 
/usr/local/lib/python3.10/site-packages/superset/mcp_ser │
                       │ vice/auth.py:213 in get_user_from_request              
  │
                       │                                                        
  │
                       │   210 │   │   │   f"JWT keys 
configured={jwt_configured} │
                       │   211 │   │   )                                        
  │
                       │   212 │   │   details.append("MCP_DEV_USERNAME is not 
co │
                       │ ❱ 213 │   │   raise ValueError(                        
  │                                                                             
                                                                                
                                                                                
                                                               │   214 │   │   
│   "No authenticated user found. Tried:\n │                                    
                                                                                
                                                                                
                                                                                
                        │   215 │   │   │   + "\n".join(f"  - {d}" for d in 
detail │                                                                        
                                                                                
             
                                                                                
                                                        │   216 │   │   │   + 
"\n\nEither pass a valid JWT bearer  │                                          
                                                                                
                                                                                
                                                                                
                  ╰──────────────────────────────────────────────────────────╯  
                                                                                
                                                                                
                                                                                
                                                          ValueError: 
 No authenticated user found. Tried:                                            
                                                                                
                                                                                
                                                                                
                               - g.user was not set by JWT middleware           
                                                                                
                                                                                
                                                                                
                                                                     
(MCP_AUTH_ENABLED=True, JWT keys configured=True)                               
                                                                                
                                                                                
                                                 
                                                                          - 
MCP_DEV_USERNAME is not configured                                              
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                            
Either pass a valid JWT bearer token or configure                               
                                                                                
                                              
                                                                                
                                                                           
MCP_DEV_USERNAME for development.                                               
                                                                                
                                                                                
                                                                                
                    2026-07-01 
06:13:55,130:ERROR:superset.mcp_service.middleware:MCP tool error: 
tool=execute_sql, user_id=None, duration_ms=62, error_type=ToolError, 
error=Error calling tool 'execute_sql': No authenticated user found. Tried:     
                                                                                
                                                      - g.user was not set by 
JWT middleware (MCP_AUTH_ENABLED=True, JWT keys configured=True)                
                                     
                                                                                
                                                                                
                                                            - MCP_DEV_USERNAME 
is not configured                                                               
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                           Either pass a valid 
JWT bearer Token: [REDACTED] configure M
 CP_DEV_USERNAME for development.                                               
                                                                                
                                                                                
                                                             2026-07-01 
06:13:55,131:WARNING:superset.mcp_service.middleware:Failed to log error event: 
DBEventLogger.log() missing 3 required positional arguments: 'dashboard_id', 
'slice_id', and 'referrer'         
   `
   
   Mcp server was successfully started:
   
   docker: entrypoint.sh script to start the mcp and superset
   if [ "$SUPERSET_ENV" = "prod" ]; then
       # Start superset worker for SQL Lab
       celery --app=superset.tasks.celery_app:app worker -f 
/home/superset/log/celery_worker1.log -Ofair -nworker1 -c 4 -Q 
celery,thumbnails,reports &
       celery --app=superset.tasks.celery_app:app worker -f 
/home/superset/log/celery_worker2.log -Ofair -nworker2 -c 4 -Q 
celery,thumbnails,reports &
       celery --app=superset.tasks.celery_app:app beat -f 
/home/superset/log/celery_beat.log -s /home/superset/log/celerybeat-schedule &
       celery --app=superset.tasks.celery_app:app flower 
--basic-auth=fadm:${FLOWER_PWD} &
       superset mcp run --host 0.0.0.0 --port 5008 > 
/home/superset/log/mcp_server.log 2>&1 &
       echo Started Celery workers[worker1, worker2] mcp server and Flower UI.
   
       # Start the prod web server
       gunicorn -w 10 -k gevent --timeout 600 -b  0.0.0.0:8088 
--limit-request-line 0 --limit-request-field_size 0 "superset.app:create_app()"
   
   026-07-01 06:11:34,339:INFO:httpx:HTTP Request: GET 
https://pypi.org/pypi/fastmcp/json "HTTP/1.1 200 OK"
   
   
   
╭──────────────────────────────────────────────────────────────────────────────╮
   │                                                                            
  │
   │                                                                            
  │
   │                         ▄▀▀ ▄▀█ █▀▀ ▀█▀ █▀▄▀█ █▀▀ █▀█                      
  │
   │                         █▀  █▀█ ▄▄█  █  █ ▀ █ █▄▄ █▀▀                      
  │
   │                                                                            
  │
   │                                                                            
  │
   │                                                                            
  │
   │                                FastMCP 3.4.2                               
  │
   │                            https://gofastmcp.com                           
  │
   │                                                                            
  │
   │                  🖥   Server:      Mozart MCP Server, 3.4.2                 
   │
   │                  🚀 Deploy free: https://horizon.prefect.io                 
 │
   │                                                                            
  │
   
╰──────────────────────────────────────────────────────────────────────────────╯
   
   
   [07/01/26 06:11:34] INFO     Starting MCP server 'Mozart MCP    
transport.py:304
                                Server' with transport
                                'streamable-http' (stateless) on
                                http://0.0.0.0:5008/mcp
   INFO:     Started server process [90]
   INFO:     Waiting for application startup.
   2026-07-01 
06:11:34,368:INFO:mcp.server.streamable_http_manager:StreamableHTTP session 
manager started
   INFO:     Application startup complete.
   INFO:     Uvicorn running on http://0.0.0.0:5008 (Press CTRL+C to quit)
   "mcp_server.log" 477L, 44759C                                                
      
   
   ### Screenshots/recordings
   
   <img width="424" height="452" alt="Image" 
src="https://github.com/user-attachments/assets/702a1bdb-dec9-447e-9c70-00bddb5609eb";
 />
   
   mcp client connected successfully, but ask execute sql got g.user not found 
error
   
   ### Superset version
   
   6.1.0
   
   ### Python version
   
   3.10
   
   ### Node version
   
   16
   
   ### Browser
   
   Chrome
   
   ### Additional context
   
   _No response_
   
   ### Checklist
   
   - [x] I have searched Superset docs and Slack and didn't find a solution to 
my problem.
   - [x] I have searched the GitHub issue tracker and didn't find a similar bug 
report.
   - [x] I have checked Superset's logs for errors and if I found a relevant 
Python stacktrace, I included it here as text in the "additional context" 
section.


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