Skip to content

Commit ba6c941

Browse files
Merge pull request #201 from docker/bugfix-docker-compose-check-container-env
Skip connecting to OAuth stream in container mode
2 parents db5d68d + 0086482 commit ba6c941

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

pkg/gateway/run.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,10 @@ func (g *Gateway) Run(ctx context.Context) error {
260260
return fmt.Errorf("loading configuration: %w", err)
261261
}
262262

263-
if g.McpOAuthDcrEnabled {
263+
// When running in Container mode, disable OAuth notification monitoring and authentication
264+
inContainer := os.Getenv("DOCKER_MCP_IN_CONTAINER") == "1"
265+
266+
if g.McpOAuthDcrEnabled && !inContainer {
264267
// Start OAuth notification monitor to receive OAuth related events from Docker Desktop
265268
log.Log("- Starting OAuth notification monitor")
266269
monitor := oauth.NewNotificationMonitor()
@@ -319,7 +322,6 @@ func (g *Gateway) Run(ctx context.Context) error {
319322
// Initialize authentication token for SSE and streaming modes
320323
// Skip authentication when running in container (DOCKER_MCP_IN_CONTAINER=1)
321324
transport := strings.ToLower(g.Transport)
322-
inContainer := os.Getenv("DOCKER_MCP_IN_CONTAINER") == "1"
323325
if (transport == "sse" || transport == "http" || transport == "streamable" || transport == "streaming" || transport == "streamable-http") && !inContainer {
324326
token, wasGenerated, err := getOrGenerateAuthToken()
325327
if err != nil {

0 commit comments

Comments
 (0)