From 94de44cd6abf3b4441b4596a10b232b6ed91b111 Mon Sep 17 00:00:00 2001 From: Keval Mahajan Date: Sun, 9 Nov 2025 17:42:13 +0530 Subject: [PATCH 01/10] Single auth use option Signed-off-by: Keval Mahajan --- mcpgateway/admin.py | 1 + mcpgateway/schemas.py | 4 ++++ mcpgateway/services/gateway_service.py | 6 ++++++ 3 files changed, 11 insertions(+) diff --git a/mcpgateway/admin.py b/mcpgateway/admin.py index 2cb621d06..7e5c7f6b3 100644 --- a/mcpgateway/admin.py +++ b/mcpgateway/admin.py @@ -6783,6 +6783,7 @@ async def admin_add_gateway(request: Request, db: Session = Depends(get_db), use auth_header_value=str(form.get("auth_header_value", "")), auth_headers=auth_headers if auth_headers else None, oauth_config=oauth_config, + one_time_auth=form.get("one_time_auth", False), passthrough_headers=passthrough_headers, visibility=visibility, ca_certificate=ca_certificate, diff --git a/mcpgateway/schemas.py b/mcpgateway/schemas.py index 0e4164c42..1a4b1e9d7 100644 --- a/mcpgateway/schemas.py +++ b/mcpgateway/schemas.py @@ -2413,6 +2413,10 @@ class GatewayCreate(BaseModel): # Adding `auth_value` as an alias for better access post-validation auth_value: Optional[str] = Field(None, validate_default=True) + + # One time auth - do not store the auth in gateway flag + one_time_auth: Optional[bool] = Field(default=False, description="The authentication should be used only once and not stored in the gateway") + tags: Optional[List[str]] = Field(default_factory=list, description="Tags for categorizing the gateway") # Team scoping fields for resource organization diff --git a/mcpgateway/services/gateway_service.py b/mcpgateway/services/gateway_service.py index 5472e17ee..1ed8dc831 100644 --- a/mcpgateway/services/gateway_service.py +++ b/mcpgateway/services/gateway_service.py @@ -738,6 +738,12 @@ async def register_gateway( ca_certificate = getattr(gateway, "ca_certificate", None) capabilities, tools, resources, prompts = await self._initialize_gateway(normalized_url, authentication_headers, gateway.transport, auth_type, oauth_config, ca_certificate) + if gateway.one_time_auth: + # For one-time auth, clear auth_type and auth_value after initialization + auth_type = None + auth_value = None + oauth_config = None + tools = [ DbTool( original_name=tool.name, From b66fdda1f2c754b4bd75dbb9a2c37e3eeb3e7c00 Mon Sep 17 00:00:00 2001 From: Keval Mahajan Date: Sun, 9 Nov 2025 17:57:50 +0530 Subject: [PATCH 02/10] one time authentication checkbox added Signed-off-by: Keval Mahajan --- mcpgateway/templates/admin.html | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/mcpgateway/templates/admin.html b/mcpgateway/templates/admin.html index 1a702c800..dbccb106f 100644 --- a/mcpgateway/templates/admin.html +++ b/mcpgateway/templates/admin.html @@ -4608,6 +4608,32 @@

+ +
+ + +
+
+
+ + +