From f8d041e42ea1615b4330f42e8c69d7e312980fde Mon Sep 17 00:00:00 2001 From: Ilia Manolov Date: Thu, 4 Dec 2025 14:28:29 +0000 Subject: [PATCH] Fix: Propagate app_user_email when a global context already exists Signed-off-by: Ilia Manolov --- mcpgateway/services/tool_service.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/mcpgateway/services/tool_service.py b/mcpgateway/services/tool_service.py index 731b67e0a..984e490f3 100644 --- a/mcpgateway/services/tool_service.py +++ b/mcpgateway/services/tool_service.py @@ -1222,6 +1222,8 @@ async def invoke_tool( gateway_id = getattr(tool, "gateway_id", None) if gateway_id and isinstance(gateway_id, str): global_context.server_id = gateway_id + if gateway_id and isinstance(app_user_email, str): + global_context.user = app_user_email else: # Create new context (fallback when middleware didn't run) request_id = uuid.uuid4().hex