TradingView MCP

TradingView MCP

Controls and reads a live TradingView Desktop chart via Chrome DevTools Protocol, enabling market scanning, morning briefs, backtesting, and live NSE PCR data through a local dashboard.

Category
访问服务器

README

TradingView MCP

Control and read a live TradingView Desktop chart from Claude Code via Chrome DevTools Protocol — plus a local web dashboard for market scanning, backtesting, and live NSE PCR data.

Built on tradingview-mcp-jackson by @LewisWJackson, itself built on tradingview-mcp by @tradesdontlie. Go star both.

[!WARNING] Not affiliated with TradingView Inc. or Anthropic. Requires a valid TradingView subscription — this does not bypass any paywall, it only reads/controls the TradingView Desktop app already running on your machine. All data processing is local; nothing is sent anywhere. See Disclaimer.


What's New in This Fork

Feature What it does
morning_brief / session_save / session_get Scan your watchlist, apply rules.json, generate a session bias, save/compare day to day
tv brief CLI Run the morning brief from the terminal
Launch fix tv_launch compatibility with TradingView Desktop v2.14+
Local web dashboard (npm run dashboard) localhost:3010 — Market Data table, Strategy-1 scanner, S1-Lab (first-hour OH/OL backtesting + signal-frequency leaderboard), Heatmap, live NIFTY/BANKNIFTY/FINNIFTY/MIDCPNIFTY PCR from NSE
Light / dark theme Toggle in the dashboard header, persists across sessions

Setup

Prerequisites: TradingView Desktop (paid subscription), Node.js 18+, Claude Code (or any terminal for the CLI), macOS/Windows/Linux.

git clone https://github.com/Kabeeraa27/TradingViewMCP.git
cd TradingViewMCP
npm install
cp rules.example.json rules.json   # fill in your watchlist, bias & risk rules

Launch TradingView with the debug port enabled (required for every MCP/CDP tool and the dashboard's scans):

OS Command
Windows scripts\launch_tv_debug.bat
Mac ./scripts/launch_tv_debug_mac.sh
Linux ./scripts/launch_tv_debug_linux.sh

Add to Claude Code — merge into ~/.claude/.mcp.json:

{
  "mcpServers": {
    "tradingview": {
      "command": "node",
      "args": ["/Users/YOUR_USERNAME/TradingViewMCP/src/server.js"]
    }
  }
}

Restart Claude Code, then ask: "Use tv_health_check to verify TradingView is connected."

Optional — local dashboard (independent of Claude Code): npm run dashboard, then open http://localhost:3010. Live PCR fetches from NSE automatically, no extra config.

Optional — CLI: npm link once, then tv brief, tv status, tv --help, etc.

Or paste this into Claude Code and it handles the clone/install/config/verify for you:

Set up TradingView MCP for me.
Clone https://github.com/Kabeeraa27/TradingViewMCP.git to ~/TradingViewMCP, run npm install, then add it to my MCP config at ~/.claude/.mcp.json (merge with any existing servers, don't overwrite them).
The config block is: { "mcpServers": { "tradingview": { "command": "node", "args": ["/Users/YOUR_USERNAME/TradingViewMCP/src/server.js"] } } } — replace YOUR_USERNAME with my actual username.
Then copy rules.example.json to rules.json and open it so I can fill in my trading rules.
Finally restart and verify with tv_health_check.

Runtime data (rules.json, strategy1-log.json, strategy1-lab-log.json, pcr/history.json) is gitignored — your trading data never gets committed or clobbered by git pull.


Morning Brief Workflow

  1. TradingView is open (debug port on)
  2. tv brief in your terminal (or ask Claude: "run morning_brief")
  3. Claude scans your watchlist, applies rules.json, prints a bias per symbol:
    BTCUSD | BIAS: Bearish | KEY LEVEL: 94,200 | WATCH: RSI crossing 50 on 4H
    
  4. "save this brief"session_save; next morning, "get yesterday's session"session_get

What This Tool Does

Morning brief · Pine Script dev (write/inject/compile/debug) · chart navigation & indicators · reading price levels/labels/tables from custom Pine drawings · drawing trend lines/levels/boxes · alerts · replay mode with P&L tracking · screenshots · multi-pane layouts · live JSONL streaming · CLI for every tool.

Claude picks the right tool automatically via the decision tree in CLAUDE.md.


Tool Reference (81 MCP tools)

Chart Reading

Tool Use Size
chart_get_state First call — symbol, timeframe, indicator IDs ~500B
data_get_study_values Current RSI/MACD/BB/EMA values ~500B
quote_get Latest price, OHLC, volume ~200B
data_get_ohlcv Price bars — use summary: true for compact stats 500B–8KB

Pine Drawings (line.new(), label.new(), table.new(), box.new())

Tool Reads
data_get_pine_lines Horizontal price levels
data_get_pine_labels Text annotations + prices
data_get_pine_tables Data tables
data_get_pine_boxes Price zones as {high, low}

Use study_filter: "MyIndicator" to target one indicator.

Chart Control

chart_set_symbol · chart_set_timeframe · chart_set_type · chart_manage_indicator (use full names, e.g. "Relative Strength Index" not "RSI") · chart_scroll_to_date · indicator_set_inputs / indicator_toggle_visibility

Pine Script

pine_set_sourcepine_smart_compilepine_get_errorspine_get_consolepine_save. Offline: pine_analyze, pine_check.

Replay

replay_startreplay_step / replay_autoplayreplay_tradereplay_statusreplay_stop

Multi-pane, alerts, drawing, UI

pane_set_layout (s/2h/2v/2x2/4/6/8) · pane_set_symbol · draw_shape · alert_create/list/delete · batch_run · watchlist_get/add · capture_screenshot · tv_launch / tv_health_check

Morning Brief

morning_brief (reads rules.json) · session_save · session_get


CLI

tv brief                      tv status               tv symbol BTCUSD
tv session get                tv quote                tv ohlcv --summary
tv session save --brief "…"   tv screenshot -r chart  tv pine compile
tv pane layout 2x2            tv stream quote | jq '.close'

Full list: tv --help


Troubleshooting

Problem Solution
cdp_connected: false / ECONNREFUSED TradingView isn't running with --remote-debugging-port=9222 — use the launch script
MCP server not showing in Claude Code Check ~/.claude/.mcp.json syntax, restart Claude Code
tv command not found npm link from the project directory
"No rules.json found" cp rules.example.json rules.json
Watchlist empty Add symbols to rules.json's watchlist array
Stale data TradingView still loading — wait a few seconds
Pine Editor tools fail Open the panel first: ui_open_panel pine-editor open

Architecture

Claude Code  ←→  MCP Server (stdio)  ←→  CDP (port 9222)  ←→  TradingView Desktop (Electron)

CLI (tv) talks to the same server. No external network calls except live PCR (NSE) in the dashboard — everything else runs locally.


Disclaimer

For personal, educational, and research use only. Uses the Chrome DevTools Protocol — a standard Chromium debugging interface, explicitly enabled by you via a command-line flag. Does not reverse-engineer any proprietary protocol or bypass access controls.

By using this you agree: you're responsible for complying with TradingView's Terms of Use; this accesses undocumented internal APIs that may change anytime; it must not be used to redistribute/resell/commercially exploit TradingView's data; the authors aren't responsible for account bans or other consequences. Use at your own risk.

License

MIT — see LICENSE. Applies to source code only, not TradingView's software, data, or trademarks.

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选
mcp-server-qdrant

mcp-server-qdrant

这个仓库展示了如何为向量搜索引擎 Qdrant 创建一个 MCP (Managed Control Plane) 服务器的示例。

官方
精选