MCP Servers

模型上下文协议服务器、框架、SDK 和模板的综合目录。

T
Tradingview MCP Pro
作者 @ChrisSc

AI-assisted TradingView chart analysis — connect Claude Code to your TradingView Desktop for personal workflow automation

创建于 4/11/2026
更新于 about 6 hours ago
Repository documentation and setup instructions

TradingView MCP Pro

83 MCP tools for AI-assisted TradingView chart analysis and Pine Script development. TypeScript, strict mode, zero external network calls.

Claude Code  <-->  MCP Server (stdio)  <-->  CDP (port 9222)  <-->  TradingView Desktop

[!WARNING] Not affiliated with TradingView Inc. or Anthropic. This tool connects to your locally running TradingView Desktop app via Chrome DevTools Protocol. See Disclaimer.

[!IMPORTANT] Requires a valid TradingView subscription. Does not bypass any paywall. Reads from and controls the TradingView Desktop app already running on your machine.

[!NOTE] All processing is local. No TradingView data leaves your machine.


Quick Start

1. Clone and install

git clone https://github.com/ChrisSc/tradingview-mcp-pro.git ~/tradingview-mcp-pro
cd ~/tradingview-mcp-pro
npm install

2. Set up your rules

cp rules.example.json rules.json

Edit rules.json with your watchlist, bias criteria, and risk rules.

3. Launch TradingView with CDP

TradingView Desktop must be running with the debug port enabled:

Mac:

open -a "TradingView" --args --remote-debugging-port=9222

Or use the MCP tool after setup: tv_launch

4. Add to Claude Code

Add to ~/.claude.json:

{
  "mcpServers": {
    "tradingview": {
      "command": "npx",
      "args": ["tsx", "/Users/YOUR_USERNAME/tradingview-mcp-pro/src/server.ts"]
    }
  }
}

Replace YOUR_USERNAME with your actual username.

5. Verify

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


What It Does

| Capability | Description | |-----------|-------------| | Morning brief | Scan watchlist, read indicators, apply your rules, generate session bias | | Pine Script dev | Write, inject, compile, debug Pine scripts with AI assistance | | Chart control | Change symbols, timeframes, zoom to dates, add/remove indicators | | Visual analysis | Read indicator values, price levels, custom indicator drawings | | Draw on charts | Trend lines, horizontal levels, rectangles, text labels | | Manage alerts | Create, list, delete price alerts programmatically | | Replay mode | Step through history, practice entries/exits with P&L tracking | | Multi-pane | Grid layouts (2x2, 3x1, etc.) with different symbols per pane | | Screenshots | Capture chart state (full, chart-only, strategy tester) | | Stream data | JSONL output from live chart for monitoring scripts | | CLI access | Every tool is also a tv command with pipe-friendly JSON output |


Tool Reference (83 MCP tools)

Morning Brief

| Tool | Description | |------|-------------| | morning_brief | Scan watchlist, read indicators, apply rules.json, return structured session data | | session_save | Save brief to ~/.tradingview-mcp/sessions/YYYY-MM-DD.json | | session_get | Retrieve today's or yesterday's saved brief |

Chart Reading

| Tool | Description | Output | |------|-------------|--------| | chart_get_state | Symbol, timeframe, all indicator names + entity IDs | ~500B | | data_get_study_values | Current RSI, MACD, BB, EMA values from all indicators | ~500B | | quote_get | Latest price, OHLC, volume | ~200B | | data_get_ohlcv | Price bars. Always use summary: true unless you need individual bars | 500B-8KB |

Custom Indicator Data (Pine Drawings)

| Tool | Reads | |------|-------| | data_get_pine_lines | Horizontal price levels from line.new() | | data_get_pine_labels | Text annotations from label.new() | | data_get_pine_tables | Table data from table.new() | | data_get_pine_boxes | Price zones from box.new() |

Always use study_filter to target a specific indicator.

Chart Control

| Tool | Description | |------|-------------| | chart_set_symbol | Change ticker (BTCUSD, AAPL, ES1!, NYMEX:CL1!) | | chart_set_timeframe | Change resolution (1, 5, 15, 60, D, W, M) | | chart_set_type | Change style (Candles, HeikinAshi, Line, Area, Renko) | | chart_manage_indicator | Add/remove indicators. Use full names: "Relative Strength Index" not "RSI" | | chart_scroll_to_date | Jump to a date (ISO: "2025-01-15") | | chart_set_visible_range | Zoom to exact date range (unix timestamps) | | indicator_set_inputs | Change indicator settings (length, source, etc.) | | indicator_toggle_visibility | Show/hide indicators | | symbol_info | Detailed symbol metadata | | symbol_search | Search symbols by name/keyword |

Pine Script Development

| Tool | Step | |------|------| | pine_set_source | 1. Inject code into editor | | pine_smart_compile | 2. Compile with auto-detection + error check | | pine_get_errors | 3. Read compilation errors | | pine_get_console | 4. Read log.info() output | | pine_save | 5. Save to TradingView cloud | | pine_new | Create blank indicator/strategy/library | | pine_open | Load a saved script by name | | pine_list_scripts | List all saved scripts | | pine_get_source | Read current code (warning: can be large) | | pine_analyze | Offline static analysis (no chart needed) | | pine_check | Server-side compile check (no chart needed) | | pine_compile | Raw compile without auto-detection |

Replay Mode

| Tool | Description | |------|-------------| | replay_start | Enter replay at a date | | replay_step | Advance one bar | | replay_autoplay | Auto-advance (set speed in ms) | | replay_trade | Buy/sell/close positions | | replay_status | Check position, P&L, date | | replay_stop | Return to realtime |

Layout, Alerts, Drawing, UI, Batch

| Tool | Description | |------|-------------| | pane_list / pane_set_layout / pane_focus / pane_set_symbol | Multi-pane grid management | | draw_shape / draw_list / draw_remove_one / draw_clear / draw_get_properties | Chart drawings | | alert_create / alert_list / alert_delete | Price alerts | | batch_run | Run action across multiple symbols/timeframes | | watchlist_get / watchlist_add | Read/modify watchlist | | capture_screenshot | Screenshot (regions: full, chart, strategy_tester) | | tv_launch / tv_health_check / tv_discover / tv_ui_state | Launch and diagnose | | tab_list / tab_new / tab_close / tab_switch | Tab management | | ui_click / ui_open_panel / ui_fullscreen / ui_keyboard / ui_type_text | UI automation | | ui_hover / ui_scroll / ui_mouse_click / ui_find_element / ui_evaluate | Advanced UI | | layout_list / layout_switch | Saved layout management |


CLI

npm link                             # install tv CLI globally (one time)

tv brief                             # morning brief
tv session get                       # yesterday's saved brief
tv status                            # check connection
tv quote                             # current price
tv symbol BTCUSD                     # 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 stream quote | jq '.close'        # stream price ticks
tv --help                            # full command list

Development

TypeScript (strict mode), Node16 ESM. 60 .ts source files, 4 .ts test files.

npm run start              # run MCP server via tsx
npm run dev                # watch mode
npm run build              # compile to dist/ via tsc
npm run typecheck          # type-check without emitting
npm run test:all           # run all test suites

Dependencies

| Package | Purpose | |---------|---------| | @modelcontextprotocol/sdk | MCP server framework | | chrome-remote-interface | CDP client | | dotenv | Environment config | | typescript | Compiler (dev) | | tsx | TypeScript execution (dev) |


Troubleshooting

| Problem | Solution | |---------|----------| | cdp_connected: false | TradingView isn't running with --remote-debugging-port=9222 | | ECONNREFUSED | TradingView isn't running or port 9222 is blocked | | MCP server not showing in Claude Code | Check ~/.claude.json syntax, restart Claude Code | | tv command not found | Run npm link from the project directory | | morning_brief -- no rules | Run cp rules.example.json rules.json and fill it in | | Tools return stale data | TradingView still loading -- wait a few seconds | | Pine Editor tools fail | Open Pine Editor panel first: ui_open_panel pine-editor open |


Credits

Built on tradingview-mcp by @tradesdontlie. Full credit for the original foundation.


Disclaimer

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

This tool uses the Chrome DevTools Protocol (CDP), a standard debugging interface built into all Chromium-based applications. 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.

By using this software you agree that:

  1. You are solely responsible for ensuring your use complies with TradingView's Terms of Use and all applicable laws.
  2. This tool accesses undocumented internal TradingView APIs that may change at any time.
  3. This tool must not be used to redistribute, resell, or commercially exploit TradingView's market data.
  4. The authors are not responsible for any account actions or consequences.

Use at your own risk.

License

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

快速设置
此服务器的安装指南

安装包 (如果需要)

npx @modelcontextprotocol/server-tradingview-mcp-pro

Cursor 配置 (mcp.json)

{ "mcpServers": { "chrissc-tradingview-mcp-pro": { "command": "npx", "args": [ "chrissc-tradingview-mcp-pro" ] } } }