Skip to content

fix(docker): honour MCPPROXY_LISTEN in the server image (#1942) - #1948

Merged
Dumbris merged 1 commit into
mainfrom
codex/1942-container-listen
Nov 20, 2026
Merged

Dumbris merged 1 commit into
mainfrom
codex/1942-container-listen

Conversation

@Dumbris

@Dumbris Dumbris commented Nov 20, 2026

Copy link
Copy Markdown
Member

Fixes #1942.

Problem

The server image's ENTRYPOINT ["mcpproxy","serve","--listen","0.0.0.0:8080"] passed a flag, and --listen outranks MCPPROXY_LISTEN, so docker run -e MCPPROXY_LISTEN=... was silently ignored.

Change

  • Dockerfile: ENV MCPPROXY_LISTEN=0.0.0.0:8080 + ENTRYPOINT ["mcpproxy","serve"].
    • Container default is unchanged: 0.0.0.0:8080.
    • Precedence is unchanged: --listen (container args) > MCPPROXY_LISTEN > config listen > default. -e MCPPROXY_LISTEN= (empty) falls back to the config file (internal/config/loader.go only applies a non-empty value).
    • Existing docker run IMAGE --config=... --data-dir=... invocations keep working. serve does not validate positional args, so a stray leading serve in args is still inert.
  • scripts/test-docker-listen.sh is a real-container smoke test, wired into the PR docker-image job:
    1. With defaults, /healthz answers on 8080.
    2. With -e MCPPROXY_LISTEN=0.0.0.0:9090, it answers on 9090 and not on 8080.
    3. With --listen 0.0.0.0:7070 plus that env, it answers on 7070 and not on 9090.
  • Docs: installation (Port bullet), deploying-for-a-team (entrypoint description), environment-variables (precedence + image default). The inert leading "serve" is dropped from the K8s args and compose command examples.

Verification

I could not run Docker or go build locally in this session (both needed approval), so the CI Build Server Docker Image job is the real-container check. An independent read-only review traced the precedence against loader.go/main.go and checked the script. It found no defects.

🤖 Generated with Claude Code

The ENTRYPOINT hardcoded `--listen 0.0.0.0:8080`, and a flag outranks
MCPPROXY_LISTEN, so `-e MCPPROXY_LISTEN=...` was a silent no-op. Move the
container default into `ENV MCPPROXY_LISTEN=0.0.0.0:8080` and make the
ENTRYPOINT `mcpproxy serve`. Default stays 0.0.0.0:8080; `--listen` passed as
container args still wins over the variable.

The PR docker-image job now runs scripts/test-docker-listen.sh against the
built image: default answers on 8080, MCPPROXY_LISTEN moves the listener off
8080, --listen beats MCPPROXY_LISTEN.

Docs: installation, deploying-for-a-team, environment-variables; drop the inert
leading "serve" from the K8s args and compose command examples.

Fixes #1942

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying mcpproxy-docs with  Cloudflare Pages  Cloudflare Pages

Latest commit: 574ecf4
Status: ✅  Deploy successful!
Preview URL: https://ece2ee5a.mcpproxy-docs.pages.dev
Branch Preview URL: https://codex-1942-container-listen.mcpproxy-docs.pages.dev

View logs

@Dumbris

Dumbris commented Nov 20, 2026

Copy link
Copy Markdown
Member Author

Independent runtime check passed on all three cases with the candidate Linux server binary in real containers. Default listened on 8080, MCPPROXY_LISTEN moved it to 9090, and an explicit --listen moved it to 7070. The superseded ports stopped answering. I used a scratch base with the PR’s ENV and ENTRYPOINT, and remapped the host-side test ports because 18080 was occupied. The full multi-stage image remains covered by PR CI.

@github-actions

Copy link
Copy Markdown
Contributor

📦 Build Artifacts

Workflow Run: View Run
Branch: codex/1942-container-listen

Available Artifacts

  • archive-darwin-amd64 (33 MB)
  • archive-darwin-arm64 (30 MB)
  • archive-linux-amd64 (20 MB)
  • archive-linux-arm64 (18 MB)
  • archive-windows-amd64 (33 MB)
  • archive-windows-arm64 (29 MB)
  • frontend-dist-pr (0 MB)
  • installer-dmg-darwin-amd64 (29 MB)
  • installer-dmg-darwin-arm64 (26 MB)
  • smart-mcp-proxymcpproxy-goMSEWTV.dockerbuild (0 MB)

How to Download

Option 1: GitHub Web UI (easiest)

  1. Go to the workflow run page linked above
  2. Scroll to the bottom "Artifacts" section
  3. Click on the artifact you want to download

Option 2: GitHub CLI

gh run download 44719577416 --repo smart-mcp-proxy/mcpproxy-go

Note: Artifacts expire in 14 days.

@codecov-commenter

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@Dumbris

Dumbris commented Nov 20, 2026

Copy link
Copy Markdown
Member Author

Release-coordination QA:

  • Independent review (opencode github-copilot/gpt-6.1-sol, variant high) of the merge with main e832195: VERDICT CLEAN. Precedence is flag > MCPPROXY_LISTEN > config file. An empty env value falls back to the config file. The env value is never persisted. The smoke test fails closed.
  • Real container: a distroless image with this Dockerfile's runtime stage and a server-edition binary built from the merged tree. scripts/test-docker-listen.sh: default 8080, env override, and flag-over-env all pass. Extra check: with -e MCPPROXY_LISTEN= and a mounted config with listen 0.0.0.0:9191, the server answers on 9191 and the file keeps 9191.
  • Required checks green. Integration Tests (not required) was still running at merge.

@Dumbris
Dumbris merged commit 947d62a into main Nov 20, 2026
53 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: cant change MCPPROXY_LISTEN

2 participants