fix(proxy): fix Windows URL truncation at & in exec and browser open#245
Merged
TarasSpashchenko merged 2 commits intomainfrom Apr 10, 2026
Merged
fix(proxy): fix Windows URL truncation at & in exec and browser open#245TarasSpashchenko merged 2 commits intomainfrom
TarasSpashchenko merged 2 commits intomainfrom
Conversation
- exec.ts: quote args containing CMD metacharacters (& | < > ^ %) when shell:true on Windows, preventing codemie mcp add URL truncation - mcp-oauth-provider.ts: replace cmd /c start with PowerShell Start-Process to preserve & in OAuth authorization URLs opened in the browser - mcp/index.ts: remove unused ensureProxyCommandExists, simplify error handling Generated with AI Co-Authored-By: codemie-ai <codemie.ai@gmail.com>
The function was removed in the previous commit to silence a lint error caused by the call being commented out. Restore both the function and the call so codemie mcp add fails fast with a clear error when codemie-mcp-proxy is not on PATH. Generated with AI Co-Authored-By: codemie-ai <codemie.ai@gmail.com>
8nevil8
approved these changes
Apr 10, 2026
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.
Summary
Two Windows-specific bugs where
&characters in URLs were silently truncated, breaking thecodemie mcp addcommand and the MCP OAuth authorization flow.Changes
src/utils/exec.ts: Whenshell: trueon Windows, CMD treats&,|,<,>,^,%as metacharacters. Extended the argument quoting predicate to wrap args containing these characters in double quotes, preventing URL truncation when spawningclaude mcp addwith a URL that contains query parameters.src/mcp/auth/mcp-oauth-provider.ts:cmd /c start "" urlpasses the OAuth authorization URL unquoted to CMD, which splits on&, so?response_type=code&client_id=...&redirect_uri=...became just?response_type=code. Replaced withpowershell -NoProfile -Command "Start-Process 'url'"which passes the URL directly to the OS shell handler, bypassing CMD metacharacter parsing entirely.src/cli/commands/mcp/index.ts: Removed unusedensureProxyCommandExistsfunction and simplified the error handling block.Impact
Before:
codemie mcp addregistered MCP servers with a truncated URL (missing everything after the first&). The OAuth browser auth page showed{"error": "validation_failed"}becauseclient_idandredirect_uriwere stripped from the authorization URL.After: Full URLs are preserved on Windows for both the MCP server registration and the browser-based OAuth authorization flow.
Checklist