Skip to content

Commit 6599587

Browse files
committed
skip creds gateway duplication check for one time auth
Signed-off-by: Keval Mahajan <[email protected]>
1 parent e392df2 commit 6599587

File tree

1 file changed

+19
-18
lines changed

1 file changed

+19
-18
lines changed

mcpgateway/services/gateway_service.py

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -792,13 +792,13 @@ async def register_gateway(
792792
decoded_auth_value = gateway.auth_value
793793

794794
# Check for duplicate gateway
795-
duplicate_gateway = self._check_gateway_uniqueness(
796-
db=db, url=normalized_url, auth_value=decoded_auth_value, oauth_config=gateway.oauth_config, team_id=team_id, owner_email=owner_email, visibility=visibility
797-
)
798-
799-
if duplicate_gateway:
795+
if not gateway.one_time_auth:
796+
duplicate_gateway = self._check_gateway_uniqueness(
797+
db=db, url=normalized_url, auth_value=decoded_auth_value, oauth_config=gateway.oauth_config, team_id=team_id, owner_email=owner_email, visibility=visibility
798+
)
800799

801-
raise GatewayDuplicateConflictError(duplicate_gateway=duplicate_gateway)
800+
if duplicate_gateway:
801+
raise GatewayDuplicateConflictError(duplicate_gateway=duplicate_gateway)
802802

803803
# Prevent URL-only gateways (no auth at all)
804804
# if not decoded_auth_value and not gateway.oauth_config:
@@ -1393,19 +1393,20 @@ async def update_gateway(
13931393
final_visibility = gateway_update.visibility if gateway_update.visibility is not None else gateway.visibility
13941394

13951395
# Check for duplicates with updated credentials
1396-
duplicate_gateway = self._check_gateway_uniqueness(
1397-
db=db,
1398-
url=normalized_url,
1399-
auth_value=final_auth_value,
1400-
oauth_config=final_oauth_config,
1401-
team_id=gateway.team_id,
1402-
visibility=final_visibility,
1403-
gateway_id=gateway_id, # Exclude current gateway from check
1404-
owner_email=user_email,
1405-
)
1396+
if not gateway_update.one_time_auth:
1397+
duplicate_gateway = self._check_gateway_uniqueness(
1398+
db=db,
1399+
url=normalized_url,
1400+
auth_value=final_auth_value,
1401+
oauth_config=final_oauth_config,
1402+
team_id=gateway.team_id,
1403+
visibility=final_visibility,
1404+
gateway_id=gateway_id, # Exclude current gateway from check
1405+
owner_email=user_email,
1406+
)
14061407

1407-
if duplicate_gateway:
1408-
raise GatewayDuplicateConflictError(duplicate_gateway=duplicate_gateway)
1408+
if duplicate_gateway:
1409+
raise GatewayDuplicateConflictError(duplicate_gateway=duplicate_gateway)
14091410

14101411
# FIX for Issue #1025: Determine if URL actually changed before we update it
14111412
# We need this early because we update gateway.url below, and need to know

0 commit comments

Comments
 (0)