fix: do not truncate MCP paths containing spaces#4409
Open
Diarica wants to merge 1 commit into
Open
Conversation
Two code paths were splitting MCP server commands on whitespace without the shouldSplitPluginCommand guard that NormalizePluginCommandLine has, which truncated any command path with spaces. 1. Frontend AddServerForm / EditServerForm (CapabilitiesPanel.tsx): split(/\s+/) on the command field before sending to the Go backend. A path like "C:\Program Files\MyApp\server.exe" became command "C:\Program" with args ["Files\MyApp\server.exe"]. 2. Legacy config parser (mcpjson.go parseLegacyMCPSpec): Always split the body on spaces. The v0.x config.json format uses "name=command args..." lines; for paths with spaces like "ida=C:\PersonalData\Software\Learn\IDA Pro\ida_bridge.bat", this truncated the command to "C:\PersonalData\Software\Learn\IDA". Fix: in the frontend, pass the full command string through and let NormalizePluginCommandLine handle the split on the Go side. In parseLegacyMCPSpec, only split when shouldSplitPluginCommand returns true (known runner like npx/node, or quoted command), otherwise keep the full body as the command. Fixes e.g. IDA Pro MCP server configuration where the binary path contains spaces.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Two code paths were splitting MCP server commands on whitespace without the shouldSplitPluginCommand guard, which truncated any command path with spaces.
Bug 1 - Frontend forms
AddServerForm and EditServerForm in CapabilitiesPanel.tsx used command.trim().split(/\s+/) before sending to the Go backend. A path like C:\Program Files\MyApp\server.exe became command=C:\Program with args [Files\MyApp\server.exe].
Bug 2 - Legacy config.json parser
parseLegacyMCPSpec in mcpjson.go always split the command body on spaces via splitPluginCommandLine. The v0.x config.json format uses name=command args... lines. For a path with spaces like ida=C:\PersonalData\Software\Learn\IDA Pro\ida_bridge.bat, this truncated the executable to C:\PersonalData\Software\Learn\IDA.
Fix
Files