File tree Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -23,8 +23,16 @@ def get_snowflake_token(mcp: FastMCP) -> Optional[str]:
23
23
# Get token from request headers for non-stdio transports
24
24
context = mcp .get_context ()
25
25
if context and hasattr (context , 'request_context' ) and context .request_context :
26
- headers = context .request_context .request .headers
27
- return headers .get ("X-Snowflake-Token" )
26
+ token = context .request_context .request .headers ["X-Snowflake-Token" ]
27
+ if token :
28
+ logger .info ("Successfully retrieved Snowflake token from X-Snowflake-Token header" )
29
+ return token
30
+ else :
31
+ logger .warning ("X-Snowflake-Token header is present but empty" )
32
+ else :
33
+ logger .error ("Request context not available for non-stdio transport" )
34
+ except KeyError :
35
+ logger .error ("X-Snowflake-Token header not found in request headers" )
28
36
except Exception as e :
29
37
logger .error (f"Error getting token from request context: { e } " )
30
38
return None
You can’t perform that action at this time.
0 commit comments