Issues with MCP Env Vars #6239

Closed
opened 2026-02-16 18:02:08 -05:00 by yindo · 0 comments
Owner

Originally created by @mynameistito on GitHub (Jan 15, 2026).

Originally assigned to: @rekram1-node on GitHub.

Description

Describe the Bug

I am attempting to enable the GitHub MCP (Model Context Protocol) integration. I have set the OC_CF_GITHUB_PAT environment variable, and the opencode debug config command confirms that the Authorization header is being constructed correctly.

However, when I actually attempt to run OpenCode and try to turn on the MCP, "nothing happens" (Failed). There is no error message thrown to the console; it appears to be a silent failure during the runtime initialization of the MCP, despite the configuration validator giving it a pass.

To Reproduce

  1. Set the environment variable in PowerShell:
    $env:OC_CF_GITHUB_PAT = 'my_github_pat'
    
  2. Verify the environment variable is accessible to Node:
    node -e "console.log('Bearer ' + process.env.OC_CF_GITHUB_PAT)"
    # Output: Bearer my_github_pat
    
  3. Run the OpenCode debug configuration to verify internal recognition:
    opencode debug config 2>&1 | Select-String -Pattern "Authorization"
    # Output: "Authorization": "Bearer my_github_pat"
    
  4. Start OpenCode / Attempt to use GitHub context.

Expected Behavior

OpenCode should initialize the GitHub MCP, and I should be able to access GitHub context/repositories.

Actual Behavior

The tool starts, but the GitHub integration is not active. No authentication errors are logged, even though the configuration debugger shows the token is present.

Screenshots / Logs

Output from my verification steps showing the config is seemingly correct:

PS > $env:OC_CF_GITHUB_PAT = 'my_github_pat'
PS > node -e "console.log('Bearer ' + process.env.OC_CF_GITHUB_PAT)"
Bearer my_github_pat

PS > opencode debug config 2>&1 | Select-String -Pattern "Authorization"
        "Authorization": "Bearer my_github_pat"

Environment

  • OS: Windows 10
  • OpenCode Version: 1.1.21
  • Shell: PowerShell 7.x
  • Terminal: Warp

Additional Context

  • The PAT has valid scopes (Repo/Read).
  • Since opencode debug config sees the variable.
  • Works Hardcoded "Authorization": "Bearer my_github_pat"

Relevant parts of my opencode.jsonc


{
  "$schema": "https://opencode.ai/config.json",
  "plugin": [
    "opencode-antigravity-auth@latest",
    "@franlol/opencode-md-table-formatter@latest",
    "opencode-anthropic-auth@latest",
  ],

  "mcp": {
    "github": {
      "type": "remote",
      "url": "https://api.githubcopilot.com/mcp/",
      "oauth": false,
      "headers": {
        "Authorization": "Bearer my_github_pat"
      },
      "enabled": true
    },
  },

  "experimental": {
    "mcp_timeout": 30000
  }
}

Plugins

Originally created by @mynameistito on GitHub (Jan 15, 2026). Originally assigned to: @rekram1-node on GitHub. ### Description ### Describe the Bug I am attempting to enable the GitHub MCP (Model Context Protocol) integration. I have set the `OC_CF_GITHUB_PAT` environment variable, and the `opencode debug config` command confirms that the Authorization header is being constructed correctly. However, when I actually attempt to run OpenCode and try to turn on the MCP, "nothing happens" (Failed). There is no error message thrown to the console; it appears to be a silent failure during the runtime initialization of the MCP, despite the configuration validator giving it a pass. ### To Reproduce 1. Set the environment variable in PowerShell: ```powershell $env:OC_CF_GITHUB_PAT = 'my_github_pat' ``` 2. Verify the environment variable is accessible to Node: ```powershell node -e "console.log('Bearer ' + process.env.OC_CF_GITHUB_PAT)" # Output: Bearer my_github_pat ``` 3. Run the OpenCode debug configuration to verify internal recognition: ```powershell opencode debug config 2>&1 | Select-String -Pattern "Authorization" # Output: "Authorization": "Bearer my_github_pat" ``` 4. Start OpenCode / Attempt to use GitHub context. ### Expected Behavior OpenCode should initialize the GitHub MCP, and I should be able to access GitHub context/repositories. ### Actual Behavior The tool starts, but the GitHub integration is not active. No authentication errors are logged, even though the configuration debugger shows the token is present. ### Screenshots / Logs Output from my verification steps showing the config is seemingly correct: ```powershell PS > $env:OC_CF_GITHUB_PAT = 'my_github_pat' PS > node -e "console.log('Bearer ' + process.env.OC_CF_GITHUB_PAT)" Bearer my_github_pat PS > opencode debug config 2>&1 | Select-String -Pattern "Authorization" "Authorization": "Bearer my_github_pat" ``` ### Environment * **OS:** Windows 10 * **OpenCode Version:** 1.1.21 * **Shell:** PowerShell 7.x * **Terminal:** Warp ### Additional Context * The PAT has valid scopes (Repo/Read). * Since `opencode debug config` sees the variable. * Works Hardcoded `"Authorization": "Bearer my_github_pat"` #### Relevant parts of my `opencode.jsonc` ```json { "$schema": "https://opencode.ai/config.json", "plugin": [ "opencode-antigravity-auth@latest", "@franlol/opencode-md-table-formatter@latest", "opencode-anthropic-auth@latest", ], "mcp": { "github": { "type": "remote", "url": "https://api.githubcopilot.com/mcp/", "oauth": false, "headers": { "Authorization": "Bearer my_github_pat" }, "enabled": true }, }, "experimental": { "mcp_timeout": 30000 } } ``` #### Plugins * [opencode-antigravity-auth@latest](https://github.com/NoeFabris/opencode-antigravity-auth) * [opencode-anthropic-auth@latest](https://github.com/anomalyco/opencode-anthropic-auth) * [@franlol/opencode-md-table-formatter@latest](https://github.com/franlol/opencode-md-table-formatter)
yindo added the windowsbug labels 2026-02-16 18:02:08 -05:00
yindo closed this issue 2026-02-16 18:02:08 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#6239