Skip to content

Add run-tradingview-mcp skill with CDP driver harness - #89

Open
BeauJohnson0213 wants to merge 1 commit into
LewisWJackson:mainfrom
BeauJohnson0213:add-run-skill
Open

Add run-tradingview-mcp skill with CDP driver harness#89
BeauJohnson0213 wants to merge 1 commit into
LewisWJackson:mainfrom
BeauJohnson0213:add-run-skill

Conversation

@BeauJohnson0213

Copy link
Copy Markdown

What this adds

A run-tradingview-mcp skill at .claude/skills/run-tradingview-mcp/, so an
agent (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 live
    chart; nothing is copied from the README.
  • start-tradingview-cdp.ps1 — tracked because the skill's first step
    depends on it. TradingView Desktop on Windows ships as an MSIX package that
    Windows won't launch with extra flags, so --remote-debugging-port can't be
    passed to it. findChartTarget() only needs a Chromium page matching
    tradingview.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: true when 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:

  • Symbol switching silently fails. setSymbol() returns success and
    chart.symbol() echoes the new ticker, but mainSeries().symbolInfo()
    stays null, status() is 2, and the bars keep the previous symbol's
    values. Polled 60s; never resolves. quote_get then reports the new ticker
    with the old symbol's OHLC. driver.mjs symbol navigates to ?symbol= and
    polls until it genuinely resolves.
  • Chrome does not paint canvases in a background tab. Screenshots come
    back with UI but no candles — every <canvas> stuck at 300x150, 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 shot calls Page.bringToFront() and waits on
    visibilityState.
  • 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 space
    pushes the total past the container and collapses the layout.
    driver.mjs panes redistributes and keeps the total fixed.
  • The MCP server never closes stdout, so printf … | node src/server.js
    hangs. driver.mjs mcp <tool> [json] resolves on the response id and kills
    the 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:

  • The symbol-switch failure and the [data-dialog-name="gopro"] signup modal
    are both anonymous-session behaviours. On a logged-in profile they may not
    occur — worth confirming before treating them as general bugs.
  • Symbols resolve to BATS/Cboe rather than the requested exchange
    (NASDAQ:NVDABATS:NVDA), also an anonymous-session effect.

SKILL.md records measured test baselines so a red suite isn't mistaken for a
regression: npm test → 95 tests, 78 pass, 17 fail, exit 1, ~10m41s. Of the
17, one is environmental (tv_launch asserts a TradingView binary on disk;
not installed here), one looks like genuine API drift
(bottomWidgetBar.hideWidget is not a function), and the rest cascade from
the symbol failure above. npm run test:unit → 29 tests, 27 pass, 2 fail,
both from tv pine check aborting on a libuv teardown assertion on Windows
after printing correct JSON.

No changes to src/, tests, or existing docs — this is additive.

🤖 Generated with Claude Code

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>
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.

1 participant