Skip to content

fix(upstream): direct-exec resolved docker for user-supplied docker run (#696/MCP-2868)#714

Merged
Dumbris merged 1 commit into
mainfrom
fix/mcp2868-docker-direct-exec-user-supplied
Jun 18, 2026
Merged

fix(upstream): direct-exec resolved docker for user-supplied docker run (#696/MCP-2868)#714
Dumbris merged 1 commit into
mainfrom
fix/mcp2868-docker-direct-exec-user-supplied

Conversation

@Dumbris

@Dumbris Dumbris commented Jun 18, 2026

Copy link
Copy Markdown
Member

Summary

Fixes the remaining GH #696 failure, confirmed still broken on v0.41.0. Upstream servers whose config command IS docker (a user-supplied docker run … <image>) resolved the bundled Docker Desktop CLI for the status field but the spawn still shell-wrapped bare docker via $SHELL -l -c "docker run …". On a default Docker Desktop macOS install the docker CLI lives only at /Applications/Docker.app/Contents/Resources/bin/docker and is not on the login-shell PATH → zsh:1: command not found: docker.

PR #703's direct-exec fix only covered the isolation-injection path (setupDockerIsolation, used for uvx/npx wrapped into docker run). The user-supplied docker run branch in connectStdio was never covered.

Change

  • Extract the resolve→spawn-decision logic (resolve docker to an absolute path, gate direct-exec on a verified absolute executable + guaranteed daemon env, else login-shell-wrap the resolved path / bare docker) out of setupDockerIsolation into a shared method (*Client).resolveDockerSpawn(finalArgs). setupDockerIsolation now delegates to it — behavior unchanged.
  • In connection_stdio.go, the user-supplied docker run branch now calls resolveDockerSpawn(argsToWrap) instead of wrapWithUserShell("docker", …), then inserts --cidfile via the helper matching the spawn shape (insertCidfileIntoDockerArgs on direct-exec, insertCidfileIntoShellDockerCommand on the shell-wrap fallback). Existing -e env injection is preserved; new debug log lines reuse Debug logs leak upstream secrets in cleartext (inconsistent argv redaction) #712's shellwrap.RedactDockerArgs.
  • Docs (docs/docker-isolation.md) updated: direct-exec now covers both Docker spawn paths.

Tests (TDD — failing test written first)

  • TestResolveDockerSpawnUserSuppliedDockerRunDirectExec — user docker run, resolved absolute executable + dockerDaemonEnvGOOS=darwinfinalCommand == resolved absolute path, shellWrapped == false, -e KEY=VALUE env flags present, args-based cidfile inserted right after run.
  • TestResolveDockerSpawnUserSuppliedFallsBackToShellWrap — resolution fails → shell-wrapped bare docker, env value preserved in the command string.

Verification

  • go test -race ./internal/upstream/core/...
  • golangci-lint run --config .github/.golangci.yml ./internal/upstream/core/... → 0 issues ✅
  • go build ./...

Rebased onto current main (includes #712 / eba4a85).

Related #696
Related #712

…ocker run

User-supplied `docker run …` upstreams (config command IS `docker`)
resolved the bundled Docker Desktop CLI for the status field but still
shell-wrapped bare `docker` via `$SHELL -l -c "docker run …"` at spawn.
On a default Docker Desktop macOS install the CLI lives only inside the
app bundle and is not on the login-shell PATH, so the spawn failed with
`zsh:1: command not found: docker` (GH #696, still broken on v0.41.0).

PR #703's direct-exec fix covered only the isolation-injection path
(setupDockerIsolation). Extract its resolve→spawn-decision logic into a
shared `resolveDockerSpawn` method and reuse it on the user-supplied
`docker run` branch in connectStdio, inserting --cidfile via the helper
that matches the spawn shape (args-based on direct-exec, string-based on
the login-shell fallback) and keeping the existing -e env injection.

setupDockerIsolation behavior is unchanged (now delegates to the shared
method). Docs updated to note direct-exec now covers both Docker spawn
paths.

Related #696
Related #712
@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying mcpproxy-docs with  Cloudflare Pages  Cloudflare Pages

Latest commit: b047e0a
Status: ✅  Deploy successful!
Preview URL: https://3e36a8aa.mcpproxy-docs.pages.dev
Branch Preview URL: https://fix-mcp2868-docker-direct-ex.mcpproxy-docs.pages.dev

View logs

@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

❌ Patch coverage is 14.28571% with 12 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
internal/upstream/core/connection_stdio.go 0.00% 12 Missing ⚠️

📢 Thoughts on this report? Let us know!

@github-actions

Copy link
Copy Markdown

📦 Build Artifacts

Workflow Run: View Run
Branch: fix/mcp2868-docker-direct-exec-user-supplied

Available Artifacts

  • archive-darwin-amd64 (28 MB)
  • archive-darwin-arm64 (25 MB)
  • archive-linux-amd64 (16 MB)
  • archive-linux-arm64 (14 MB)
  • archive-windows-amd64 (28 MB)
  • archive-windows-arm64 (25 MB)
  • frontend-dist-pr (0 MB)
  • installer-dmg-darwin-amd64 (21 MB)
  • installer-dmg-darwin-arm64 (19 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 27744840131 --repo smart-mcp-proxy/mcpproxy-go

Note: Artifacts expire in 14 days.

@mcpproxy-gatekeeper mcpproxy-gatekeeper Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved via Claude Code review: resolveDockerSpawn shared between isolation and user-supplied docker paths; user docker run now direct-execs resolved absolute binary (GH #696). Both direct-exec and shell-wrap fallback tested; rebased on #712 redactor. CI green (33/0).

@Dumbris Dumbris merged commit 5cc9eee into main Jun 18, 2026
37 checks passed
@Dumbris Dumbris deleted the fix/mcp2868-docker-direct-exec-user-supplied branch June 18, 2026 08:14
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.

2 participants