Skip to content

Conversation

yasirusman85
Copy link

This PR fixes a startup bug in chrome-devtools-mcp where passing --browserUrl "" (as happens in VS Code Insiders with GitHub Copilot MCP integration) caused the process to exit with:

Invalid URL

Before fix

node build/src/index.js --browserUrl ""
# → Invalid URL, process exited with code 1

After fix

node build/src/index.js --browserUrl ""
# → Falls back to channel=stable, server starts successfully
chrome-devtools-mcp exposes content of the browser instance...

Root cause

  • cli.ts coerced even empty strings via new URL(url), which throws.
  • VS Code Insiders MCP integration sometimes passes --browserUrl "" instead of omitting the flag.

Fix

  • Updated coerce in cli.ts to safely ignore empty/blank strings.
  • Fallback logic now correctly assigns channel: "stable".

Impact

  • Fixes MCP server crash in VS Code Insiders.
  • Preserves existing behavior for valid URLs and other CLI options.

@yasirusman85 yasirusman85 changed the title Fix: handle empty --browserUrl to prevent Invalid URL crash fix(cli): handle empty --browserUrl to prevent Invalid URL crash Oct 4, 2025
@Lightning00Blade Lightning00Blade self-requested a review October 6, 2025 14:37
@Lightning00Blade
Copy link
Collaborator

@yasirusman85
Please remove all unrelated changes to the console, and after that I will be happy to review the PR.

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.

2 participants