MCP ENV variables are not injected? #25

Closed
opened 2026-02-16 17:24:54 -05:00 by yindo · 3 comments
Owner

Originally created by @itschip on GitHub (May 24, 2025).

I'm having some trouble with the mcp server. it doesn't seem like the env variable is injected? From what I saw in mcp-go/client, it just merges this list with the rest of os.Environ. Is this the correct format?

If this is a known bug, I''ll take a look at it and make a PR for it. Does seem like some work is begin on the llm agents on #35 however. Not sure if I should touch it before that.

  "mcpServers": {
    "github": {
      "command": "docker",
      "env": [
        "GITHUB_PERSONAL_ACCESS_TOKEN=<token>"
      ],
      "args": [
        "run",
        "-i",
        "--rm",
        "-e",
        "GITHUB_PERSONAL_ACCESS_TOKEN",
        "ghcr.io/github/github-mcp-server"
      ],
      "type": "stdio",
      "url": "",
      "headers": null
    }
  },
Originally created by @itschip on GitHub (May 24, 2025). I'm having some trouble with the mcp server. it doesn't seem like the env variable is injected? From what I saw in mcp-go/client, it just merges this list with the rest of `os.Environ`. Is this the correct format? If this is a known bug, I''ll take a look at it and make a PR for it. Does seem like some work is begin on the llm agents on #35 however. Not sure if I should touch it before that. ```json "mcpServers": { "github": { "command": "docker", "env": [ "GITHUB_PERSONAL_ACCESS_TOKEN=<token>" ], "args": [ "run", "-i", "--rm", "-e", "GITHUB_PERSONAL_ACCESS_TOKEN", "ghcr.io/github/github-mcp-server" ], "type": "stdio", "url": "", "headers": null } }, ```
yindo closed this issue 2026-02-16 17:24:54 -05:00
Author
Owner

@itschip commented on GitHub (May 24, 2025):

Ok, it does actually look like the environment variables are injected. The container just exits for some reason

@itschip commented on GitHub (May 24, 2025): Ok, it does actually look like the environment variables are injected. The container just exits for some reason
Author
Owner

@itschip commented on GitHub (May 24, 2025):

Disregard :D I was under the impression that the mcp container would run at all times. It works fine :D

@itschip commented on GitHub (May 24, 2025): Disregard :D I was under the impression that the mcp container would run at all times. It works fine :D
Author
Owner

@ruchernchong commented on GitHub (Jun 14, 2025):

Where is that snippet stored at?

@ruchernchong commented on GitHub (Jun 14, 2025): Where is that snippet stored at?
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#25