Conversation
…ging This upgrade fixes an issue where cross-client audience scopes configured in the Dex provider were being ignored when clients requested specific OAuth scopes. The fix in mcp-oauth v0.2.56 ensures that mandatory scopes like `audience:server:client_id:dex-k8s-authenticator` are always merged into client-requested scopes, enabling proper SSO token forwarding for Kubernetes OIDC authentication. Related: giantswarm/mcp-oauth#203
teemow
added a commit
that referenced
this pull request
Jan 31, 2026
…-cross-client-scope-fix * origin/main: Fix: Upgrade mcp-oauth to v0.2.56 for cross-client audience scope merging (#328)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Problem
When users authenticated to muster, client-requested OAuth scopes (
openid profile email offline_access) were overriding the provider's configured cross-client audience scopes. This resulted in tokens that lacked thedex-k8s-authenticatoraudience required for Kubernetes API access.Symptom:
muster agentcould connect to mcp-kubernetes via SSO, but Kubernetes API calls failed with "the server has asked for the client to provide credentials".Additionally, when MCP servers experienced transient failures (e.g., 503 Service Unavailable), muster would not automatically retry connecting to them.
Root Cause
OAuth scope merging: The
CopyScopesfunction in mcp-oauth used either client-requested scopes OR provider defaults, not both. Cross-client audience scopes configured viarequiredAudiencesin MCPServer CRs were being ignored.Missing retry logic: The orchestrator lacked automatic retry for failed MCP servers, requiring manual intervention for transient issues.
Fix
mcp-oauth v0.2.56 includes a fix that merges mandatory scopes (cross-client audiences like
audience:server:client_id:dex-k8s-authenticator) from provider defaults into client-requested scopes.Automatic retry loop: Added a background goroutine in the orchestrator that checks failed/unreachable MCP servers every 30 seconds and attempts reconnection when their backoff period expires.
HTTP 5xx detection: Extended transient error detection to recognize HTTP 5xx server errors (500-504, 507-509) as retry-eligible.
Changes
Orchestrator (
internal/orchestrator/orchestrator.go)RetryIntervalconstant (30 seconds) at file-level with other constantssync.WaitGroupfor tracking in-flight retry goroutines (clean shutdown)retryFailedMCPServers()- background loop respecting context cancellationattemptReconnectFailedServers()- checks backoff and spawns restart goroutinesshouldAttemptRetry()- extracted eligibility check for readabilityMCP Server Service (
internal/services/mcpserver/service.go)isTransientConnectivityError()with consolidated HTTP 5xx patternsTests (
internal/services/mcpserver/service_test.go)Test Plan
make test)muster auth statusshowsgazelle-mcp-kubernetesasConnected [SSO: Forwarded]kubernetes_cluster_healthtool returns healthy status instead of auth errorRelated