Skip to content

fix(shellwrap): convert backslash Windows paths for Git Bash (finish or take over PR #1319) - #1493

Merged
Dumbris merged 2 commits into
mainfrom
fix/issues-b1-backend-shellwrap
Oct 5, 2026
Merged

Dumbris merged 2 commits into
mainfrom
fix/issues-b1-backend-shellwrap

Conversation

@Dumbris

@Dumbris Dumbris commented Oct 5, 2026

Copy link
Copy Markdown
Member

Summary

Fix stdio servers on Windows with Git Bash or MSYS shells failing to execute commands due to backslash-style path handling. Converted paths use forward slashes which are accepted by both Windows CreateProcess and MSYS's exec layer.

  • Windows: Git Bash cannot exec backslash-style Windows paths, breaks every wrapper-script stdio server #1318 — Git Bash stdio command execution: Convert backslash paths to forward slashes when wrapping commands for bash-like shells on Windows. Fixed verified against 14 real wrapper-.cmd-based servers: connected server count went from 13 to 27, tool count 249 to 403. Tests: unit tests for path conversion logic, real Git Bash exec check.

  • Path conversion scoping: Refined to convert only path-like arguments (drive-letter and UNC paths), leaving regex patterns, domain\user values and other backslash strings untouched. Tests: comprehensive cases covering .cmd commands, paths with spaces, script args, regex args, domain\user, UNC paths, and cmd.exe behavior.

  • Cross-platform test injection: Injected GOOS into tests so Windows code paths can be verified on any host (Linux/macOS) without running the full integration. Tests: stubWindows() helper, non-Windows preservation test.

Closes #1318

LocoLoboZ and others added 2 commits October 5, 2026 13:49
WrapWithUserShell correctly single-quotes a backslash-style Windows path
(e.g. C:\ProgramData\foo\bar.cmd) when the resolved login shell is bash-like,
but Git Bash / MSYS still cannot execute it: MSYS's own exec layer only
resolves POSIX-style paths. A backslash path falls through to bash's PATH
lookup, which fails with "command not found" and mangles the path in its
own error rendering (backslashes silently dropped).

This breaks every stdio server configured with an absolute Windows-path
command (wrapper .cmd/.bat scripts are the common case) on any Windows host
where the resolved shell is bash-like, e.g. Git Bash / VS Code integrated
terminal / MSYS2 set as $SHELL.

Fix: convert backslashes to forward slashes in the command and args before
shell-escaping, but only on the Windows + bash-like-shell branch. Windows'
CreateProcess and MSYS's exec layer both accept forward-slash paths, so this
is safe in both directions.

Verified against a real config with 14 wrapper-.cmd-based stdio servers that
were all failing with this exact error: connected server count went from 13
to 27, tool count from 249 to 403, after rebuilding with this fix.

Fixes #1318
@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying mcpproxy-docs with  Cloudflare Pages  Cloudflare Pages

Latest commit: fdb05a8
Status: ✅  Deploy successful!
Preview URL: https://a8422c13.mcpproxy-docs.pages.dev
Branch Preview URL: https://fix-issues-b1-backend-shellw.mcpproxy-docs.pages.dev

View logs

@github-actions

github-actions Bot commented Oct 5, 2026

Copy link
Copy Markdown
Contributor

📦 Build Artifacts

Workflow Run: View Run
Branch: fix/issues-b1-backend-shellwrap

Available Artifacts

  • archive-darwin-amd64 (31 MB)
  • archive-darwin-arm64 (28 MB)
  • archive-linux-amd64 (19 MB)
  • archive-linux-arm64 (17 MB)
  • archive-windows-amd64 (31 MB)
  • archive-windows-arm64 (27 MB)
  • frontend-dist-pr (0 MB)
  • installer-dmg-darwin-amd64 (27 MB)
  • installer-dmg-darwin-arm64 (24 MB)
  • smart-mcp-proxymcpproxy-goYIQMXX.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 37300187772 --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

❌ Patch coverage is 89.47368% with 2 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
internal/shellwrap/shellwrap.go 89.47% 0 Missing and 2 partials ⚠️

📢 Thoughts on this report? Let us know!

@Dumbris
Dumbris merged commit 6d9caa9 into main Oct 5, 2026
43 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.

Windows: Git Bash cannot exec backslash-style Windows paths, breaks every wrapper-script stdio server

3 participants