Conversation
… mode
_spawnDetached passed no `env`, so the child inherited ELECTRON_RUN_AS_NODE
from the parent. When an Electron app hosts the MCP server — notably Claude
Code in the VS Code extension host — that variable is set to 1, and the
TradingView binary starts as a plain Node runtime instead of Electron. It
then rejects Chromium's --remote-debugging-port:
TradingView.exe: bad option: --remote-debugging-port=9222
That message is Node's CLI parser. `TradingView.exe --help` confirms it,
printing "Usage: node [options] [ script.js ] [arguments]" rather than the
Chromium switch list.
Strip the variable from the child environment.
Also report a launch where CDP never bound as success: false. It previously
returned success: true alongside cdp_ready: false, so a caller checking only
`success` saw a dead launch as a pass — which is what let this fail silently.
Test updated to match.
Side effect worth noting: because the direct spawn "failed early", launch fell
through to the MSIX local-copy path and copied ~382MB to LOCALAPPDATA, which
then failed for the same reason. With the variable cleared, TradingView starts
straight from WindowsApps and CDP binds normally — the fallback was never
needed on this machine.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This was referenced Sep 13, 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.
Problem
_spawnDetachedpasses noenv, so the spawned TradingView process inherits theserver's entire environment — including
ELECTRON_RUN_AS_NODE.When an Electron application hosts the MCP server, that variable is set to
1.The most common case is the VS Code extension host, which sets it for
extensions it launches; an MCP client running there (Claude Code, for example)
passes it to the server process, and the server passes it to TradingView.
With it set, the TradingView binary starts as a plain Node runtime rather than
Electron, and rejects Chromium's flag:
The process then exits and CDP never binds.
That message is Node's CLI parser, not Chromium's
Worth stating explicitly, because the error reads like TradingView dropped support
for the flag. Running the same binary with
--helpshows what is actuallyhappening:
That is Node's usage text. The binary is Electron —
resources/app.asar,icudtl.dat,v8_context_snapshot.bin, and the Chromium.pakfiles are allpresent next to it — it is simply being asked to behave as Node.
Reproduce
Or call
tv_launchfrom any MCP client hosted inside VS Code.Secondary cost: the MSIX fallback fires for the wrong reason
launchtreats any early exit as a failed direct spawn, so this bug falls throughto
_copyMsixPackageLocaland copies ~382 MB into%LOCALAPPDATA%\tradingview-mcp\.The copy then fails identically, because the environment variable is still
inherited. The user pays a large one-time copy and gets pointed at a Store/MSIX
explanation that is not the cause.
With the variable stripped, TradingView launches directly from
C:\Program Files\WindowsApps\...and CDP binds normally. The fallback was neverneeded on this machine.
It may be worth checking whether some existing "MSIX blocks the debug port"
reports are this same bug — the symptom is identical from the outside, and any
user running the server under VS Code would hit it regardless of how TradingView
was installed.
Changes
_spawnDetachedstripsELECTRON_RUN_AS_NODEfrom the child environment.launchnow returnssuccess: falsewhen CDP never bound. It previouslyreturned
success: truenext tocdp_ready: false, so a caller checking onlysuccesssaw a dead launch as a pass — which is what let this fail quietly.tests/launch.test.jsis updated to match.Happy to drop change 2 into its own PR, or leave it out entirely, if you would
rather keep the return shape as-is.
Verification
success: true,cdp_ready: false, 382 MB copied, CDP never bindsELECTRON_RUN_AS_NODE=1still set: launches fromWindowsApps,no fallback copy,
tv_health_checkreturnscdp_connected: truenpm run test:unit— 125/125 passnpm run lint— no new warningsOne pre-existing failure is unrelated and present on
mainbefore this change:source audit — no unsafe interpolation patternsintests/sanitization.test.js.The e2e test
tv_launch — auto-detect binaryalso fails on Windows independentlyof this change, as it only probes macOS paths.