TradingView MCP Bridgeのロゴ

TradingView MCP Bridge

コミュニティ
Weebapp003

tradingview mcp which connect claude code via chrome devtools protocol

公開者Weebapp003
リポジトリtradingview-mcp
言語JavaScript
フォーク
937
スター
135
利用可能なツール
0
通信方式stdio
カテゴリ
リンク
  • ツールをAIワークフローに接続

    TradingView MCP Bridgeは、対応するAIクライアントやAIエージェントから利用できるMCP機能を提供します。

  • 0個の利用可能なツール

    呼び出し可能なアクションを以下で確認できます。サーバーから提供されている場合は、名前や説明も表示されます。

  • コピーして使える設定

    セットアップ用の設定例を使って、お好みのMCPクライアントにこのサーバーを設定できます。

  • オープンソースの注目度

    リンク先のリポジトリには135件のスターと937件のフォークがあります。

TradingView MCP Bridge

Personal AI assistant for your TradingView Desktop charts. Connects Claude Code to your locally running TradingView app via Chrome DevTools Protocol for AI-assisted chart analysis, Pine Script development, and workflow automation.

[!WARNING] This tool is not affiliated with, endorsed by, or associated with TradingView Inc. It interacts with your locally running TradingView Desktop application via Chrome DevTools Protocol. Review the Disclaimer before use.

[!IMPORTANT] Requires a valid TradingView subscription. This tool does not bypass or circumvent any TradingView paywall or access control. It reads from and controls the TradingView Desktop app already running on your machine.

[!NOTE] All data processing occurs locally on your machine. No TradingView data is transmitted, stored, or redistributed externally by this tool.

[!CAUTION] This tool accesses undocumented internal TradingView APIs via the Electron debug interface. These can change or break without notice in any TradingView update. Pin your TradingView Desktop version if stability matters to you.

How It Works (and why it's safe to run)

This tool does not connect to TradingView's servers, modify any TradingView files, or intercept any network traffic. It communicates exclusively with your locally running TradingView Desktop instance via Chrome DevTools Protocol (CDP) — a standard debugging interface built into all Chromium/Electron applications by Google, including VS Code, Slack, and Discord.

The debug port is disabled by default and must be explicitly enabled by you using a standard Chromium flag (--remote-debugging-port=9222). Nothing happens without that deliberate step.

What This Tool Does Not Do

  • Connect to TradingView's servers or APIs
  • Store, transmit, or redistribute any market data
  • Work without a valid TradingView subscription and installed Desktop app
  • Bypass any TradingView paywall or access restriction
  • Execute real trades (chart interaction only)
  • Work if TradingView changes their internal Electron structure

Research Context

This project explores an open research question: how can LLM-based agents interact with professional trading interfaces to support human decision-making?

Specifically it investigates:

  • How structured tool APIs (MCP) can bridge LLMs and stateful desktop financial applications
  • What latency, context, and reliability constraints emerge when an agent operates on live chart data
  • How agents handle ambiguous financial UI state (e.g. interpreting Pine Script output, reading indicator tables)
  • Whether natural language is an effective interface for chart navigation and Pine Script development
  • The failure modes of LLM agents operating in real-time data environments

This is not a trading bot. It is an interface layer that makes a trading application legible to an LLM agent, allowing researchers and developers to study human-AI collaboration in financial workflows.

See RESEARCH.md for open questions, findings, and related work.

Prerequisites

  • TradingView Desktop app (paid subscription required for real-time data)
  • Node.js 18+
  • Claude Code with MCP support (for MCP tools) or any terminal (for CLI)
  • macOS, Windows, or Linux

What It Does

Gives your AI assistant eyes and hands on your own chart:

  • Pine Script development — write, inject, compile, debug, and iterate on scripts with AI assistance
  • Chart navigation — change symbols, timeframes, zoom to dates, add/remove indicators
  • Visual analysis — read your chart's indicator values, price levels, and annotations
  • Draw on charts — trend lines, horizontal lines, rectangles, text annotations
  • Manage alerts — create, list, and delete price alerts
  • Replay practice — step through historical bars, practice entries/exits
  • Screenshots — capture chart state for AI visual analysis
  • Multi-pane layouts — set up 2x2, 3x1, etc. grids with different symbols per pane
  • Monitor your chart — stream JSONL from your locally running chart for local monitoring scripts
  • CLI access — every MCP tool is also a tv CLI command, pipe-friendly with JSON output
  • Launch TradingView — auto-detect and launch with debug mode from any platform

Install with Claude Code

Paste this into Claude Code and it will handle the rest:

Install the TradingView MCP server. Clone https://github.com/Weebapp003/tradingview-mcp.git, run npm install, add it to my MCP config at ~/.claude/.mcp.json, and launch TradingView with the debug port. Then verify the connection with tv_health_check.

Or follow the manual steps below.

Quick Start

1. Install

bash
git clone https://github.com/Weebapp003/tradingview-mcp.git
cd tradingview-mcp
npm install

Redis (optional)

Redis caches short-lived chart reads when REDIS_URL is set:

bash
docker compose up -d
cp .env.example .env
ToolCache TTL
quote_get5 seconds
data_get_study_values10 seconds
data_get_ohlcv (summary=true)30 seconds

Without Redis, all tools work normally and skip caching. tv_health_check reports Redis connectivity when configured.

2. Launch TradingView with CDP

TradingView Desktop must be running with Chrome DevTools Protocol enabled on port 9222.

Mac:

bash
./scripts/launch_tv_debug_mac.sh

Windows:

bash
scripts\launch_tv_debug.bat

Linux:

bash
./scripts/launch_tv_debug_linux.sh

Or launch manually on any platform:

bash
/path/to/TradingView --remote-debugging-port=9222

Or use the MCP tool (auto-detects your install):

"Use tv_launch to start TradingView in debug mode"

3. Add to Claude Code

Add to your Claude Code MCP config (~/.claude/.mcp.json or project .mcp.json):

json
{
  "mcpServers": {
    "tradingview": {
      "command": "node",
      "args": ["/path/to/tradingview-mcp/src/server.js"]
    }
  }
}

Replace /path/to/tradingview-mcp with your actual path.

4. Verify

Ask Claude: "Use tv_health_check to verify TradingView is connected"

CLI

Every MCP tool is also accessible as a tv CLI command. All output is JSON for piping with jq.

bash
# Install globally (optional)
npm link

# Or run directly
node src/cli/index.js <command>

Quick Examples

bash
tv status                          # check connection
tv quote                           # current price
tv symbol AAPL                     # change symbol
tv ohlcv --summary                 # price summary
tv screenshot -r chart             # capture chart
tv pine compile                    # compile Pine Script
tv pane layout 2x2                 # 4-chart grid
tv pane symbol 1 ES1!              # set pane symbol
tv stream quote | jq '.close'      # monitor price changes

All Commands

tv status / launch / state / symbol / timeframe / type / info / search
tv quote / ohlcv / values
tv data lines/labels/tables/boxes/strategy/trades/equity/depth/indicator
tv pine get/set/compile/analyze/check/save/new/open/list/errors/console
tv draw shape/list/get/remove/clear
tv alert list/create/delete
tv watchlist get/add
tv indicator add/remove/toggle/set/get
tv layout list/switch
tv pane list/layout/focus/symbol
tv tab list/new/close/switch
tv replay start/step/stop/status/autoplay/trade
tv stream quote/bars/values/lines/labels/tables/all
tv ui click/keyboard/hover/scroll/find/eval/type/panel/fullscreen/mouse
tv screenshot / discover / ui-state / range / scroll

Streaming

The tv stream commands poll your locally running TradingView Desktop instance at regular intervals via Chrome DevTools Protocol on localhost.

No connection is made to TradingView's servers. All data stays on your machine.

[!WARNING] Programmatic consumption of TradingView data may conflict with their Terms of Use regardless of the data source. You are solely responsible for ensuring your usage complies.

bash
tv stream quote                          # price tick monitoring
tv stream bars                           # bar-by-bar updates
tv stream values                         # indicator value monitoring
tv stream lines --filter "NY Levels"     # price level monitoring
tv stream tables --filter Profiler       # table data monitoring
tv stream all                            # all panes at once (multi-symbol)

How Claude Knows Which Tool to Use

Claude reads CLAUDE.md automatically when working in this project. It contains a complete decision tree:

You say...Claude uses...
"What's on my chart?"chart_get_state → data_get_study_values → quote_get
"What levels are showing?"data_get_pine_lines → data_get_pine_labels
"Read the session table"data_get_pine_tables with study_filter
"Give me a full analysis"quote_get → data_get_study_values → data_get_pine_lines → data_get_pine_labels → data_get_pine_tables → data_get_ohlcv (summary) → capture_screenshot
"Switch to AAPL daily"chart_set_symbol → chart_set_timeframe
"Write a Pine Script for..."pine_set_source → pine_smart_compile → pine_get_errors
"Start replay at March 1st"replay_start → replay_step → replay_trade
"Set up a 4-chart grid"pane_set_layout → pane_set_symbol for each pane
"Draw a level at 24500"draw_shape (horizontal_line)
"Take a screenshot"capture_screenshot

Tool Reference (78 MCP tools)

Chart Reading

ToolWhen to useOutput size
chart_get_stateFirst call — get symbol, timeframe, all indicator names + IDs~500B
data_get_study_valuesRead current RSI, MACD, BB, EMA values from all indicators~500B
quote_getGet latest price, OHLC, volume~200B
data_get_ohlcvGet price bars. Use summary: true for compact stats500B (summary) / 8KB (100 bars)

Custom Indicator Data (Pine Drawings)

Read line.new(), label.new(), table.new(), box.new() output from any visible Pine indicator.

ToolWhen to useOutput size
data_get_pine_linesRead horizontal price levels (support/resistance, session levels)~1-3KB
data_get_pine_labelsRead text annotations + prices ("PDH 24550", "Bias Long")~2-5KB
data_get_pine_tablesRead data tables (session stats, analytics dashboards)~1-4KB
data_get_pine_boxesRead price zones / ranges as {high, low} pairs~1-2KB

Always use study_filter to target a specific indicator: study_filter: "Profiler".

Chart Control

ToolWhat it does
chart_set_symbolChange ticker (BTCUSD, AAPL, ES1!, NYMEX:CL1!)
chart_set_timeframeChange resolution (1, 5, 15, 60, D, W, M)
chart_set_typeChange style (Candles, HeikinAshi, Line, Area, Renko)
chart_manage_indicatorAdd/remove indicators. Use full names: "Relative Strength Index" not "RSI"
chart_scroll_to_dateJump to a date (ISO: "2025-01-15")
chart_set_visible_rangeZoom to exact range (unix timestamps)
symbol_info / symbol_searchSymbol metadata and search
indicator_set_inputs / indicator_toggle_visibilityChange indicator settings, show/hide

Multi-Pane Layouts

ToolWhat it does
pane_listList all panes with symbols and active state
pane_set_layoutChange grid: s, 2h, 2v, 2x2, 4, 6, 8
pane_focusFocus a specific pane by index
pane_set_symbolSet symbol on any pane

Tab Management

ToolWhat it does
tab_listList open chart tabs
tab_new / tab_closeOpen/close tabs
tab_switchSwitch to a tab by index

Pine Script Development

ToolStep
pine_set_source1. Inject code into editor
pine_smart_compile2. Compile with auto-detection + error check
pine_get_errors3. Read compilation errors if any
pine_get_console4. Read log.info() output
pine_save5. Save to TradingView cloud
pine_get_sourceRead current script (warning: can be 200KB+ for complex scripts)
pine_newCreate blank indicator/strategy/library
pine_open / pine_list_scriptsOpen or list saved scripts
pine_analyzeOffline static analysis (no chart needed)
pine_checkServer-side compile check (no chart needed)

Replay Mode

ToolStep
replay_startEnter replay at a date
replay_stepAdvance one bar
replay_autoplayAuto-advance (set speed in ms)
replay_tradeBuy/sell/close positions
replay_statusCheck position, P&L, date
replay_stopReturn to realtime

Drawing, Alerts, UI Automation

ToolWhat it does
draw_shapeDraw horizontal_line, trend_line, rectangle, text
draw_list / draw_remove_one / draw_clearManage drawings
alert_create / alert_list / alert_deleteManage price alerts
capture_screenshotScreenshot (regions: full, chart, strategy_tester)
batch_runRun action across multiple symbols/timeframes
watchlist_get / watchlist_addRead/modify watchlist
layout_list / layout_switchManage saved layouts
ui_open_panel / ui_click / ui_evaluateUI automation
tv_launch / tv_health_check / tv_discoverConnection management

Context Management

Tools return compact output by default to minimize context usage. For a typical "analyze my chart" workflow, total context is ~5-10KB instead of ~80KB.

FeatureHow it saves context
Pine linesReturns deduplicated price levels only, not every line object
Pine labelsCapped at 50 per study, text+price only
Pine tablesPre-formatted row strings, no cell metadata
Pine boxesDeduplicated {high, low} zones only
OHLCV summary modeStats + last 5 bars instead of all bars
Indicator inputsEncrypted/encoded blobs auto-filtered
verbose: truePass on any pine tool to get raw data with IDs/colors when needed
study_filterTarget one indicator instead of scanning all

Finding TradingView on Your System

Launch scripts and tv_launch auto-detect TradingView. If auto-detection fails:

PlatformCommon Locations
Mac/Applications/TradingView.app/Contents/MacOS/TradingView
Windows%LOCALAPPDATA%\TradingView\TradingView.exe, %PROGRAMFILES%\WindowsApps\TradingView*\TradingView.exe
Linux/opt/TradingView/tradingview, ~/.local/share/TradingView/TradingView, /snap/tradingview/current/tradingview

The key flag: --remote-debugging-port=9222

Testing

bash
# Requires TradingView running with --remote-debugging-port=9222
npm test

29 tests covering: Pine Script static analysis, server-side compilation, and CLI routing.

Architecture

Claude Code  ←→  MCP Server (stdio)  ←→  CDP (port 9222)  ←→  TradingView Desktop (Electron)
  • Transport: MCP over stdio (78 tools) + CLI (tv command, 30 commands with 66 subcommands)
  • Connection: Chrome DevTools Protocol on localhost:9222
  • Streaming: Poll-and-diff loop with deduplication, JSONL output to stdout
  • No dependencies beyond @modelcontextprotocol/sdk and chrome-remote-interface

Attributions

This project is not affiliated with, endorsed by, or associated with:

  • TradingView Inc. — TradingView is a trademark of TradingView Inc.
  • Anthropic — Claude and Claude Code are trademarks of Anthropic, PBC.

This tool is an independent MCP server that connects to Claude Code via the standard MCP protocol. It does not contain or modify any Anthropic software.

Disclaimer

This project is provided for personal, educational, and research purposes only.

How this tool works: This tool uses the Chrome DevTools Protocol (CDP), a standard debugging interface built into all Chromium-based applications by Google. It does not reverse engineer any proprietary TradingView protocol, connect to TradingView's servers, or bypass any access controls. The debug port must be explicitly enabled by the user via a standard Chromium command-line flag (--remote-debugging-port=9222).

By using this software, you acknowledge and agree that:

  1. You are solely responsible for ensuring your use of this tool complies with TradingView's Terms of Use and all applicable laws.
  2. TradingView's Terms of Use restrict automated data collection, scraping, and non-display usage of their platform and data. This tool uses Chrome DevTools Protocol to programmatically interact with the TradingView Desktop app, which may conflict with those terms.
  3. You assume all risk associated with using this tool. The authors are not responsible for any account bans, suspensions, legal actions, or other consequences resulting from its use.
  4. This tool must not be used for, including but not limited to:
    • Redistributing, reselling, or commercially exploiting TradingView's market data
    • Circumventing TradingView's access controls or subscription restrictions
    • Performing automated trading or algorithmic decision-making using extracted data
    • Violating the intellectual property rights of Pine Script indicator authors
    • Connecting to TradingView's servers or infrastructure (all access is via the locally running Desktop app)
  5. The streaming functionality monitors your locally running TradingView Desktop instance only. It does not connect to TradingView's servers or extract data from TradingView's infrastructure.
  6. Market data accessed through this tool remains subject to exchange and data provider licensing terms. Do not redistribute, store, or commercially exploit any data obtained through this tool.
  7. This tool accesses internal, undocumented TradingView application interfaces that may change or break at any time without notice.

Use at your own risk. If you are unsure whether your intended use complies with TradingView's terms, do not use this tool.

License

MIT — see LICENSE for details.

The MIT license applies to the source code of this project only. It does not grant any rights to TradingView's software, data, trademarks, or intellectual property.

インストール

TypingMind
{
  "mcpServers": {
    "weebapp003-tradingview-mcp": {
      "command": "npx",
      "args": [
        "tradingview-mcp"
      ]
    }
  }
}

TradingView MCP BridgeのMCPを複数のAIモデルで活用

TypingMindはワークスペース単位でMCPツールに接続します。そのため、一度TradingView MCP Bridgeに接続すれば、モデルごとに個別に設定することなく、TypingMind内のさまざまなAIモデルで利用できます。 このMCPは、デバイス上のTypingMind MCPコネクタを通じてローカルで動作します。

ローカルコネクタのセットアップガイド

MCPサーバーが、お使いのコンピューター上のローカルファイル、アプリ、非公開リソースにアクセスする必要がある場合は、この方法を使います。

1

MCP設定を開く

TypingMindで「設定」、「詳細設定」、「MCP」の順に進み、「コネクタを設定」を選択してください。

  1. ブラウザでTypingMindを開いてください。
  2. 設定アイコンをクリックしてください。
  3. 「詳細設定」に移動してください。
  4. 「MCP」セクションを開いてください。
  5. 「コネクタを設定」をクリックし、「このデバイス」を選択してください。
「このデバイス」が選択されたTypingMindのMCPコネクタ設定画面
2

コネクタのコマンドを実行

「このデバイス」を選択し、TypingMindからコマンドをコピーしてターミナルで実行してください。MCPの使用中は、プロセスを実行したままにしてください。

  1. TypingMindに表示されるセットアップコマンドをコピーしてください。
  2. macOSではターミナルを、WindowsではWindows Terminalを開いてください。
  3. コマンドを貼り付けて実行してください。
  4. ターミナルで続行の確認を求められた場合は、パッケージのインストールを承認してください。
  5. MCPツールの使用中は、ターミナルウィンドウを開いたまま、プロセスの実行を継続してください。
3

TradingView MCP Bridgeをサーバーとして追加

コネクタのステータスが「準備完了」になったら、「サーバーを編集」をクリックし、MCPサーバーの設定を貼り付けてください。

  1. コネクタのステータスが「準備完了」になるまでお待ちください。
  2. 「サーバーを編集」をクリックしてください。
  3. TradingView MCP BridgeのMCPサーバー設定を貼り付けてください。
  4. サーバー一覧を保存してください。
  5. コネクタが引き続き使用可能か確認するには、更新してください。
稼働中のサーバーと「サーバーを編集」ボタンが表示されたTypingMindのMCP設定画面
{
  "mcpServers": {
    "weebapp003-tradingview-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "tradingview-mcp"
      ]
    }
  }
}
4

複数のモデルで同じ接続を使用

サーバー一覧を保存し、「プラグイン」を開いてTradingView MCP BridgeのMCPツールを有効にしてください。その後、TypingMindで対応するAIモデルを選択し、チャットでツールを使うか、AIエージェントに割り当ててください。

  1. TypingMindの「プラグイン」ページを開いてください。
  2. TradingView MCP BridgeのMCPツールを有効にしてください。
  3. チャットを開始し、使用するAIモデルを選択してください。
  4. MCPツールをチャットで使うか、AIエージェントに割り当ててください。
  5. MCPに再接続することなく、必要に応じて別のAIモデルに切り替えられます。
選択したAIモデルと有効なMCPツールを使用したTypingMindのチャット
TradingView MCP Bridgeを使ってこのタスクを手伝ってもらえますか?
TradingView MCP Bridge
はい、読みました。
TradingView MCP Bridgeで調べた結果をお伝えします。

よくある質問

TradingView MCP Bridge MCPサーバーは何に使いますか?

TradingView MCP Bridgeは、対応するAIクライアントを外部ツールやコンテキストに接続するためのMCPサーバーです。TypingMindでは、このMCPサーバーを一度追加するだけで、AIワークスペース内でそのツールを利用できるようになります。

TypingMindでTradingView MCP Bridge MCPを複数のAIモデルと併用できますか?

はい。TypingMindはワークスペース単位でMCPツールに接続するため、モデルごとにMCPサーバーを設定する必要はありません。Claude、ChatGPT、Geminiや、TypingMindで設定したその他のAIモデルでTradingView MCP Bridgeを利用できます。

TypingMindでTradingView MCP Bridge MCPを使うメリットは何ですか?

TypingMindは、複数のAIモデル、プロンプト、プラグイン、AIエージェント、APIキー、MCPツールを1つのワークスペースにまとめられる、LLMチャット向けの優れたフロントエンドです。TradingView MCP Bridgeを接続すると、TypingMindでチャットのワークフローを整理しながら、お好みのモデルでそのMCPツールを利用できます。

TradingView MCP Bridge MCPをTypingMindに接続するにはどうすればよいですか?

TradingView MCP BridgeはTypingMindのローカルMCPコネクタ経由で動作します。MCPサーバーがコンピューター上のローカルファイル、デスクトップアプリ、コマンドラインツール、プライベートリソースにアクセスする必要がある場合に最適です。

TypingMindでTradingView MCP Bridge MCPのどのようなツールを利用できますか?

TradingView MCP BridgeはMCP機能を提供しています。TypingMindのプラグインページで有効にすると、チャットで使用したり、AIエージェントに割り当てたりできます。

TradingView MCP Bridge MCPを使うには、APIキーをTypingMindと共有する必要がありますか?

いいえ。TypingMindはローカルファーストの設計で、モデルプロバイダー、APIキー、プロンプト、MCP設定をご自身で管理できます。TradingView MCP Bridgeで認証が必要な場合は、接続の作成時に、そのMCPサーバーに必要なヘッダー、OAuth設定、またはローカル設定を追加してください。

関連するMCPサーバー

すべて見る

今すぐ自分専用のAIワークスペースを作成

ニュースレターに登録すると、新機能や今後のプレゼント企画のお知らせが届きます👇