Repository navigation
fix(isolation): detect the runtime of Windows launchers with an .exe/.cmd suffix - #1778
Conversation
….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.
d7c0d9c to
5cc54c4
Compare
|
Codecov Report❌ Patch coverage is
📢 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>
|
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: I will merge once CI is green. |
Dumbris
left a comment
There was a problem hiding this comment.
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.
|
Merged. Thank you, @rudycelekli! Windows launchers like 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. |
Problem
IsolationManager.DetectRuntimeTypeswitches onfilepath.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 becausenpx.cmdis what resolves. None of those match a case, so they fall to thebinarydefault.python.exeandnode.exeonly work through the substring fallback.With Docker isolation enabled,
binaryselects the generic image, andTransformCommandForContainerpasses the original command through. The container is asked to runnpx.cmd(oruvx.exe) inside a Linux image where it doesn't exist, so the server never starts.Fix
Lowercase the base name and strip a
.exe,.cmdor.batsuffix before the switch, sonpx.cmdmaps tonpx,uvx.exetouvx, and so on. Then the right image and in-container command are used. Unsuffixed names are unchanged.Test
TestDetectRuntimeType_WindowsExecutableSuffixcoversuvx.exe,npx.cmd,NPX.CMD,npm.cmd,yarn.cmd,pip.exeandgo.exe, plusuvxand an unknownmy-tool. On main all seven suffixed names returnbinary; with this change they map to their runtime.go test -count=1 ./internal/upstream/core/passes.Made with Cursor