Skip to content

Antigravity MCP env blocks pass literal "$VAR" to Docker (shell expansion bug) #2418

@panteleimon-a

Description

@panteleimon-a

Describe the bug
Antigravity MCP config env block doesn't expand shell variables (passes literal "$VAR" string to Docker instead of actual value). Docker receives unexpanded placeholder, causing GitHub API 401 Unauthorized errors.

Affected version
$ docker run -i --rm ghcr.io/github/github-mcp-server ./github-mcp-server --version
github-mcp-server 0.1.2 (commit abc1234)
(Run this and paste exact output)

Steps to reproduce the behavior
Add to ~/.zshrc: export GITHUB_PERSONAL_ACCESS_TOKEN="ghp_your_real_token" → source ~/.zshrc

Verify: curl -H "Authorization: Bearer $GITHUB_PERSONAL_ACCESS_TOKEN" https://github.com/__api/user → 200 OK

Add MCP config to Antigravity:

{
  "mcpServers": {
    "github-mcp-server": {
      "$typeName": "exa.cascade_plugins_pb.CascadePluginCommandTemplate",
      "command": "docker",
      "args": ["run", "-i", "--rm", "-e", "GITHUB_PERSONAL_ACCESS_TOKEN", "ghcr.io/github/github-mcp-server"],
      "env": {
        "GITHUB_PERSONAL_ACCESS_TOKEN": "$GITHUB_PERSONAL_ACCESS_TOKEN"
      }
    }
  }
}

Restart Antigravity

Run GitHub MCP tool → fails

Expected vs actual behavior
Expected: Shell expands $GITHUB_PERSONAL_ACCESS_TOKEN → Docker gets real token → GitHub API works.

Actual: Docker gets literal "$GITHUB_PERSONAL_ACCESS_TOKEN" string → 401 Bad credentials.

Logs

failed to list issues: non-200 OK status code: 401 Unauthorized
{"message": "Bad credentials"}

Workaround: Use sh -c wrapper (shell expands before Docker):

"command": "sh",
"args": ["-c", "docker run -i --rm -e GITHUB_PERSONAL_ACCESS_TOKEN -e ACCEPT_POLICIES_AND_CONFIG_CHANGES=yes ghcr.io/github/github-mcp-server"]

Metadata

Metadata

Assignees

No one assigned

    Labels

    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