Skip to content

Adding oauth per-server mode function#459

Open
cutecatfann wants to merge 1 commit intomainfrom
per_server_mode
Open

Adding oauth per-server mode function#459
cutecatfann wants to merge 1 commit intomainfrom
per_server_mode

Conversation

@cutecatfann
Copy link
Copy Markdown
Contributor

What I did

  • Added ShouldUseGatewayOAuth(ctx, isCommunity) as the per-server decision function for whether the Gateway should own the OAuth lifecycle (localhost callback, PKCE, token storage) instead of delegating to Docker Desktop
  • Preserves IsCEMode() unchanged for the notification monitor in pkg/gateway/run.go, which only needs the single global CE-vs-Desktop decision

The existing IsCEMode() is a binary global check: either the Gateway owns all OAuth, or Desktop owns all OAuth. This does not support the case where Desktop is running but a community-registered server (not in the Docker catalog) needs Gateway-managed OAuth. ShouldUseGatewayOAuth introduces the per-server decision that downstream tickets will wire into individual call sites.

Decision logic

Environment Server type McpGatewayOAuth flag Result
CE mode (no Desktop) any n/a true (Gateway owns OAuth)
Desktop catalog n/a false (Desktop owns OAuth)
Desktop community ON true (Gateway owns OAuth)
Desktop community OFF or error false (Desktop owns OAuth)

When the Desktop backend is unreachable or the McpGatewayOAuth Unleash flag is not yet registered (MCPT-480 not deployed), the function returns false so callers fall back to Desktop OAuth rather than breaking.

@cutecatfann cutecatfann requested a review from a team as a code owner March 30, 2026 20:45
@cutecatfann cutecatfann changed the title Cleaning up go code Adding oauth per-server mode function Mar 30, 2026
@cutecatfann cutecatfann self-assigned this Mar 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant