Add run-tradingview-mcp skill with CDP driver harness - #89
Open
BeauJohnson0213 wants to merge 1 commit into
Open
Add run-tradingview-mcp skill with CDP driver harness#89BeauJohnson0213 wants to merge 1 commit into
BeauJohnson0213 wants to merge 1 commit into
Conversation
This repo has no UI of its own — it drives a live TradingView chart over CDP — and its CLI/MCP tools report success against a chart that isn't actually working. driver.mjs verifies and repairs the states they paper over; SKILL.md documents it as the primary agent path. driver.mjs commands: check, dismiss, symbol, study, panes, shot, mcp, smoke. Also tracks start-tradingview-cdp.ps1, which the skill's first step depends on. TradingView Desktop on Windows ships as an MSIX package that Windows refuses to launch with extra flags, so --remote-debugging-port can never be passed to it. The connector only needs a Chromium page whose URL matches tradingview.com/chart, so the script opens Chrome on port 9222 instead. Idempotent: reuses a live CDP session if one exists. Behaviours found by driving the real chart and encoded in the driver: - Symbol switching silently fails on an anonymous session: setSymbol() returns success and symbol() echoes the new ticker, but symbolInfo() stays null and the bars keep the previous symbol's values. `symbol` navigates to ?symbol= instead and polls until it truly resolves. - Chrome does not paint canvases in a background tab, so screenshots come back blank while every data tool still reports correct values. `shot` calls Page.bringToFront() and waits for visibilityState. - setPaneHeight() does not shrink siblings; growing a pane past the container collapses the layout. `panes` redistributes instead. - The MCP server never closes stdout, so a naive pipe hangs. `mcp` resolves on the response id and kills the child. SKILL.md also records measured test baselines (npm test: 95 tests, 78 pass, 17 fail, exit 1) so a red suite isn't mistaken for a regression. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
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.
What this adds
A
run-tradingview-mcpskill at.claude/skills/run-tradingview-mcp/, so anagent (or a new contributor) can bring this project up on a clean machine and
actually drive it:
driver.mjs— the harness. Commands:check,dismiss,symbol,study,panes,shot,mcp,smoke.SKILL.md— its man page. Every command in it was run against a livechart; nothing is copied from the README.
start-tradingview-cdp.ps1— tracked because the skill's first stepdepends on it. TradingView Desktop on Windows ships as an MSIX package that
Windows won't launch with extra flags, so
--remote-debugging-portcan't bepassed to it.
findChartTarget()only needs a Chromium page matchingtradingview.com/chart, so the script opens Chrome on 9222 instead.Idempotent — reuses a live CDP session.
Why a driver and not just docs
The CLI and MCP tools report
success: truewhen the chart has not changed.The driver exists to tell those two states apart. Behaviours found by driving
the real chart, each now handled in code:
setSymbol()returns success andchart.symbol()echoes the new ticker, butmainSeries().symbolInfo()stays
null,status()is2, and the bars keep the previous symbol'svalues. Polled 60s; never resolves.
quote_getthen reports the new tickerwith the old symbol's OHLC.
driver.mjs symbolnavigates to?symbol=andpolls until it genuinely resolves.
back with UI but no candles — every
<canvas>stuck at300x150, PNG~37 KB instead of ~167 KB — while every data tool still returns correct
values. It survives reloads, so it reads as corrupted chart state.
driver.mjs shotcallsPage.bringToFront()and waits onvisibilityState.setPaneHeight()does not shrink siblings. Separate-pane studies (RSI)land in a zero-height pane, hidden from the chart and from
data_get_study_values. Growing that pane without reclaiming the spacepushes the total past the container and collapses the layout.
driver.mjs panesredistributes and keeps the total fixed.printf … | node src/server.jshangs.
driver.mjs mcp <tool> [json]resolves on the response id and killsthe child — a quick way to exercise one tool without restarting the client.
Scope and caveats
Verified on Windows 10, Node v24.18.0, Chrome 150, logged-out session.
Some findings are specific to that setup and may not reproduce for you:
[data-dialog-name="gopro"]signup modalare both anonymous-session behaviours. On a logged-in profile they may not
occur — worth confirming before treating them as general bugs.
(
NASDAQ:NVDA→BATS:NVDA), also an anonymous-session effect.SKILL.mdrecords measured test baselines so a red suite isn't mistaken for aregression:
npm test→ 95 tests, 78 pass, 17 fail, exit 1, ~10m41s. Of the17, one is environmental (
tv_launchasserts a TradingView binary on disk;not installed here), one looks like genuine API drift
(
bottomWidgetBar.hideWidget is not a function), and the rest cascade fromthe symbol failure above.
npm run test:unit→ 29 tests, 27 pass, 2 fail,both from
tv pine checkaborting on a libuv teardown assertion on Windowsafter printing correct JSON.
No changes to
src/, tests, or existing docs — this is additive.🤖 Generated with Claude Code