Skip to content

Compiler does not forward OIDC env vars to MCP Gateway docker run command #25646

@bbonafed

Description

@bbonafed

Summary

The mcp_setup_generator.go compiler does not include ACTIONS_ID_TOKEN_REQUEST_URL or ACTIONS_ID_TOKEN_REQUEST_TOKEN in the -e flags of the MCP_GATEWAY_DOCKER_COMMAND it generates. This means the MCP gateway container cannot mint GitHub OIDC tokens for HTTP MCP servers with auth: { type: github-oidc }.

This is the compiler-side counterpart to the firewall fix in gh-aw-firewall#1796. The firewall issue (gh-aw-firewall#1792) explicitly noted that both layers must be addressed:

The gh-aw compiler (mcp_setup_generator.go) is being fixed to include these vars in the docker run command it generates for the MCP gateway. However, the AWF firewall also controls which host environment variables reach the agent container, so both layers must be addressed.

The firewall layer was fixed (gh-aw-firewall#1796, shipped in v0.25.17), but the compiler layer was not. Issue #25224 was closed without a compiler-side PR.

Environment

  • gh-aw CLI: v0.68.0
  • gh-aw-firewall/agent: v0.25.18
  • gh-aw-mcpg: v0.2.17

Two-hop architecture

Host runner (has ACTIONS_ID_TOKEN_REQUEST_URL)
    ↓ docker-manager.ts forwards env vars (FIXED in firewall v0.25.17)
Agent/Firewall container (now has ACTIONS_ID_TOKEN_REQUEST_URL)
    ↓ MCP_GATEWAY_DOCKER_COMMAND executes "docker run -e VAR1 -e VAR2 ..."
MCP Gateway container (MISSING — no -e flag for OIDC vars)

The firewall fix ensures the OIDC vars reach the agent container. But the MCP gateway is a separate Docker container started via MCP_GATEWAY_DOCKER_COMMAND. Without explicit -e ACTIONS_ID_TOKEN_REQUEST_URL -e ACTIONS_ID_TOKEN_REQUEST_TOKEN flags in that command, the vars are not forwarded to the gateway.

Source code confirmation (v0.68.0)

pkg/workflow/mcp_setup_generator.go (lines 650–813): Builds the entire MCP_GATEWAY_DOCKER_COMMAND with ~40+ explicit -e env vars. Zero references to ACTIONS_ID_TOKEN_REQUEST_URL, ACTIONS_ID_TOKEN_REQUEST_TOKEN, OIDC, or github-oidc.

pkg/workflow/mcp_environment.go: Also has zero OIDC-related references. The collectMCPEnvironmentVariables function handles HTTP header secrets, safe-outputs, mcp-scripts, and GitHub MCP tokens — but has no code path for github-oidc auth.

standardEnvVars dedup list (lines 756–768): Does not include the OIDC vars.

Meanwhile, the gateway (gh-aw-mcpg) correctly validates these vars at startup:

  • internal/config/validation.go (lines 261–270): Fail-fast check for ACTIONS_ID_TOKEN_REQUEST_URL when auth.type == "github-oidc"
  • internal/launcher/launcher.go (lines 68–71): Initializes OIDC provider from os.Getenv("ACTIONS_ID_TOKEN_REQUEST_URL")

Proposed fix

In mcp_setup_generator.go, conditionally add the two OIDC env vars when any HTTP MCP server uses auth.type: "github-oidc":

// GitHub Actions OIDC env vars — required by the gateway to mint tokens
// for servers with auth.type: "github-oidc" (spec §7.6.1)
if hasGitHubOIDCAuth {
    containerCmd.WriteString(" -e ACTIONS_ID_TOKEN_REQUEST_URL")
    containerCmd.WriteString(" -e ACTIONS_ID_TOKEN_REQUEST_TOKEN")
}

Also add them to the standardEnvVars dedup list to prevent duplicate -e flags.

A hasGitHubOIDCAuth boolean can be derived by iterating over the HTTP MCP tools and checking if any have auth.type == "github-oidc".

Workaround

Users can manually patch the compiled lock file to add -e ACTIONS_ID_TOKEN_REQUEST_URL -e ACTIONS_ID_TOKEN_REQUEST_TOKEN to the MCP_GATEWAY_DOCKER_COMMAND string after each gh aw compile. This must be re-applied after every recompile.

References

  • Original issue: MCP Gateway container missing ACTIONS_ID_TOKEN_REQUEST_URL / ACTIONS_ID_TOKEN_REQUEST_TOKEN env vars #25224 (closed, but compiler fix was not included)
  • Firewall tracking issue: gh-aw-firewall#1792 (closed, firewall layer fixed)
  • Firewall fix PR: gh-aw-firewall#1796 (merged in v0.25.17)
  • Gateway fail-fast validation: gh-aw-mcpg#3367 (merged in v0.2.17)
  • MCP Gateway Spec §7.6.1: OIDC authentication
  • Source: pkg/workflow/mcp_setup_generator.go (lines ~650–813)
  • Source: pkg/workflow/mcp_environment.go (collectMCPEnvironmentVariables)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions