Repository navigation
Description
Describe the bug
When the server runs in a podman container using the OAuth ("login with GitHub") flow with a published fixed callback port — the exact configuration documented in the README's Docker OAuth section, just with podman instead of docker — the browser login always fails:
- The authorization page opens and can be approved on github.com.
- GitHub then redirects to
http://localhost:8085/callback?..., which the browser cannot reach ("This site can't be reached" — connection reset). - The pending tool call eventually fails with
github authorization failed: context deadline exceeded.
The cause is that isRunningInDocker() in internal/oauth/env.go does not detect podman containers, so listenCallback() (internal/oauth/flow.go) binds the callback server to 127.0.0.1 inside the container instead of all interfaces. A published port (-p 127.0.0.1:8085:8085) is delivered to the container's eth0, which can never reach the container's internal loopback — hence every connection to the published port is reset while the flow is live.
Detection fails under podman because:
- podman does not create
/.dockerenv(it creates/run/.containerenvinstead), and - under cgroup v2 + crun,
/proc/1/cgroupinside the container is0::/and contains neitherdockernorcontainerd.
Affected version
ghcr.io/github/github-mcp-server:latest (image pulled 2026-12-02):
time=2026-12-02T09:59:18.734Z level=INFO msg="starting server" version=v2.2.0
internal/oauth/env.go on current main still only checks /.dockerenv and /proc/1/cgroup.
Steps to reproduce the behavior
- Configure an MCP client with the README's Docker OAuth setup, using
podmanas the container runtime (Fedora 44, rootless podman):
{
"command": "podman",
"args": ["run", "-i", "--rm",
"-p", "127.0.0.1:8085:8085",
"-e", "GITHUB_OAUTH_CALLBACK_PORT",
"ghcr.io/github/github-mcp-server"],
"env": { "GITHUB_OAUTH_CALLBACK_PORT": "8085" }
}- Invoke any tool (e.g.
get_me) to trigger the OAuth login, and approve the authorization page in the browser. - The redirect to
http://localhost:8085/callback?...fails with "This site can't be reached". - See the tool call fail after the timeout with
github authorization failed: context deadline exceeded.
Evidence gathered while the flow was live:
- Inside the container's network namespace (
/proc/<container-pid>/net/tcp), the listener is bound to0100007F:1F95, i.e. container-internal127.0.0.1:8085, not0.0.0.0. - From the host,
curl http://127.0.0.1:8085/callbackgetsConnection reset by peerfor the entire duration of the flow (pasta/port-forwarding delivers toeth0, not the container loopback).
Expected vs actual behavior
Expected: Under podman with a published fixed callback port, the callback server binds all container interfaces (as it does under Docker), so the published port reaches it and the browser login completes.
Actual: The server believes it is running natively, binds 127.0.0.1 inside the container, and the OAuth callback is unreachable through the published port — browser login can never succeed.
Logs
time=2026-12-02T09:12:32.000Z level=INFO msg="server session connected" session_id=""
time=2026-12-02T09:12:46.124Z level=INFO msg="requesting github authorization via elicitation"
(No further log lines; the tool call later returns github authorization failed: context deadline exceeded.)
Suggested fix
Add podman detection to isRunningInDocker(), e.g. check for /run/.containerenv (created by podman) or honor the container=podman environment variable that podman sets inside containers:
if _, err := os.Stat("/run/.containerenv"); err == nil {
return true
}Workaround
Bind-mount a dummy /.dockerenv so the existing detection succeeds:
-v /dev/null:/.dockerenv
With this mount, the callback binds 0.0.0.0 inside the container and the published loopback port works as documented.
Activity