Skip to content

fix(isolation): detect the runtime of Windows launchers with an .exe/.cmd suffix - #1778

Merged
Dumbris merged 2 commits into
smart-mcp-proxy:mainfrom
rudycelekli:fix/isolation-runtime-windows-ext-20261024-01
Oct 29, 2026
Merged

Dumbris merged 2 commits into
smart-mcp-proxy:mainfrom
rudycelekli:fix/isolation-runtime-windows-ext-20261024-01

Conversation

@rudycelekli

Copy link
Copy Markdown
Contributor

Problem

IsolationManager.DetectRuntimeType switches on filepath.Base(command) exactly. On Windows the launchers carry an executable suffix: uvx.exe, npx.cmd, npm.cmd, yarn.cmd, pip.exe, go.exe. Configs often name them that way, either by full path or because npx.cmd is what resolves. None of those match a case, so they fall to the binary default. python.exe and node.exe only work through the substring fallback.

With Docker isolation enabled, binary selects the generic image, and TransformCommandForContainer passes the original command through. The container is asked to run npx.cmd (or uvx.exe) inside a Linux image where it doesn't exist, so the server never starts.

Fix

Lowercase the base name and strip a .exe, .cmd or .bat suffix before the switch, so npx.cmd maps to npx, uvx.exe to uvx, and so on. Then the right image and in-container command are used. Unsuffixed names are unchanged.

Test

TestDetectRuntimeType_WindowsExecutableSuffix covers uvx.exe, npx.cmd, NPX.CMD, npm.cmd, yarn.cmd, pip.exe and go.exe, plus uvx and an unknown my-tool. On main all seven suffixed names return binary; with this change they map to their runtime. go test -count=1 ./internal/upstream/core/ passes.

Made with Cursor

….cmd suffix

DetectRuntimeType switched on the exact base name, so a Windows config
naming uvx.exe, npx.cmd, npm.cmd, pip.exe or go.exe fell to the
"binary" default. Docker isolation then picked the generic image and
ran e.g. npx.cmd inside a Linux container, where it does not exist, so
the server never started. Lowercase the base name and strip a .exe,
.cmd or .bat suffix before matching.
@rudycelekli
rudycelekli force-pushed the fix/isolation-runtime-windows-ext-20261024-01 branch from d7c0d9c to 5cc54c4 Compare October 24, 2026 22:18
@codecov-commenter

codecov-commenter commented Oct 24, 2026 •

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 83.33333% with 2 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
internal/diagnostics/remediation.go 75.00% 0 Missing and 2 partials ⚠️

📢 Thoughts on this report? Let us know!

…ockerRuntimeType

Review finding on smart-mcp-proxy#1778: core.DetectRuntimeType now lowercases the command
and strips .exe/.cmd/.bat, but its diagnostics mirror did not, so a uvx.exe
server got remediation for a "uvx.exe" runtime and no git-dependency hint
while spawn used the uvx image and the git-capable substitute.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Dumbris

Dumbris commented Oct 26, 2026

Copy link
Copy Markdown
Member

Verified the bug on main and the fix; thank you! The review found one gap, so I pushed a small maintainer commit on top of your branch: internal/diagnostics.detectDockerRuntimeType is documented as a mirror of DetectRuntimeType; the commit applies the same suffix stripping there, so remediation hints for uvx.exe match what spawn actually does.

I will merge once CI is green.

@Dumbris Dumbris left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Verified: the bug reproduces on main and the PR fixes it. The review found one gap, closed by the maintainer commit on top (regression test included). Race tests and CI lint for the touched packages are clean on this branch merged with main, and the result was cross-reviewed clean.

@Dumbris
Dumbris merged commit 9d084c2 into smart-mcp-proxy:main Oct 29, 2026
47 checks passed
@Dumbris

Dumbris commented Oct 29, 2026

Copy link
Copy Markdown
Member

Merged. Thank you, @rudycelekli! Windows launchers like uvx.exe and npx.cmd now get the right runtime detection (and the matching isolation image) instead of falling through to a plain binary, and diagnostics stay in step with it.

Contributions like this are what keep MCPProxy moving, and they matter a lot to the project.

One small ask, only if you feel like it: a short public note about your change (a tweet, a LinkedIn post, a line in a community you are part of) helps more people discover MCPProxy. No pressure at all, and I would be glad to repost it.

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.

3 participants