Fintech Developer Tools 1 min read

TradingView MCP Bridge: Stop Coding Blind, Let Claude See Your Charts

B
Bright Coding
Author
Share:
TradingView MCP Bridge: Stop Coding Blind, Let Claude See Your Charts
Advertisement

TradingView MCP Bridge: Stop Coding Blind, Let Claude See Your Charts

What if your AI assistant could actually see your charts? Not read a CSV export. Not parse a screenshot you manually uploaded. But live, breathe, and interact with your TradingView Desktop instance in real-time—navigating timeframes, reading indicator values, drawing levels, and even writing Pine Script while you watch.

Here's the painful truth most traders and developers refuse to admit: Pine Script development is still stuck in the dark ages. You're toggling between browser tabs, manually copying error messages, squinting at compilation failures, and trying to describe chart patterns to an AI that has zero visual context. Hours evaporate. Edge cases multiply. And that "simple" indicator you wanted to build? It's now a three-day debugging marathon.

But what if Claude Code—Anthropic's terminal-based coding assistant—could bridge directly into your TradingView Desktop application? What if it could read your RSI divergence in real-time, inject Pine Script code with a single command, capture screenshots for visual analysis, and manage multi-pane layouts while you focus on strategy?

That's exactly what the TradingView MCP Bridge delivers. This isn't a trading bot. It's not a data scraper. It's a legibility layer—an open-source research project that transforms your opaque TradingView Desktop app into an interactive, AI-readable interface. And it's about to change how you build, test, and analyze trading strategies forever.


What Is the TradingView MCP Bridge?

The TradingView MCP Bridge is an open-source Model Context Protocol (MCP) server created by the GitHub user tradesdontlie. It connects Claude Code (or any MCP-compatible AI assistant) to your locally running TradingView Desktop application via the Chrome DevTools Protocol (CDP)—the same debugging interface built into Chromium and Electron apps like VS Code, Slack, and Discord.

Why is this trending now? Three converging forces:

  1. MCP is exploding. Anthropic's Model Context Protocol, released in late 2024, has become the de facto standard for giving LLMs structured tool access. Developers are racing to build MCP servers for every workflow imaginable.

  2. TradingView Desktop runs on Electron. That means it exposes CDP by default—if you know how to enable it. The bridge simply leverages what Google already built into Chromium.

  3. AI-assisted finance is hitting an inflection point. Traders and quants are desperate for tools that bridge the gap between natural language reasoning and professional trading interfaces. This project tackles that exact research question head-on.

The repository explicitly positions itself as research infrastructure, not a commercial product. It explores how LLM-based agents can interact with stateful desktop financial applications to support human decision-making. The focus? Latency constraints, ambiguous UI state interpretation, real-time data reliability, and whether natural language can effectively control complex charting software.

Critical distinction: This tool does NOT connect to TradingView's servers, bypass paywalls, or execute trades. It reads from and controls your already-running, already-paid-for local TradingView Desktop instance. All data processing stays on your machine. No market data gets transmitted externally.


Key Features That Make This Insane

The TradingView MCP Bridge ships with 78 MCP tools and a parallel CLI interface with 30 commands and 66 subcommands. Here's where it gets technically fascinating:

Pine Script AI Pair Programming

The bridge turns Claude into a Pine Script co-developer. Inject code directly into the TradingView editor, compile with auto-detection, read error consoles, and iterate without ever touching your mouse. The pine_smart_compile tool handles compilation checks automatically, while pine_get_errors surfaces diagnostics in a format Claude can parse and fix.

Live Chart State Extraction

Most "AI trading tools" force you to export CSVs or take screenshots. The bridge queries DOM state directly through CDP. Read current RSI, MACD, Bollinger Bands, and custom indicator values with sub-kilobyte payloads. The chart_get_state tool returns your full chart configuration—symbol, timeframe, all indicator names and IDs—in roughly 500 bytes.

Visual Analysis via Screenshots

The capture_screenshot tool grabs chart regions (full, chart-only, or strategy tester) and feeds them back to Claude for visual reasoning. Combine this with data_get_pine_lines and data_get_pine_labels to correlate visual patterns with structured data.

Multi-Pane Layout Automation

Set up professional watch stations programmatically: pane_set_layout 2x2, assign different symbols to each pane with pane_set_symbol, and stream data from all panes simultaneously via tv stream all.

Replay Mode Integration

Practice entries and exits on historical data with full AI assistance. replay_start jumps to a date, replay_step advances bar-by-bar, and replay_trade simulates position management—all controllable through natural language commands to Claude.

Streaming Data Pipelines

Poll your local TradingView instance at configurable intervals and output JSONL streams for downstream processing. Filter by quote ticks, bar updates, indicator values, or specific Pine drawings. Pipe directly to jq for transformation.

Context-Optimized Output

Every tool returns compact, deduplicated data by default. A full chart analysis workflow consumes ~5-10KB of context instead of ~80KB. Pine lines return unique price levels only. Labels cap at 50 per study. OHLCV summary mode sends stats plus last 5 bars. This matters enormously when you're paying per token or hitting context limits.


Real-World Use Cases Where This Dominates

1. Rapid Pine Script Prototyping

You're building a custom session profiler that marks Asian, London, and New York highs/lows with distinct labels and tables. Normally: write code, switch to TradingView, paste, compile, fix syntax errors, realize your table formatting is wrong, repeat. With the bridge: describe the indicator to Claude, let it generate Pine Script, inject via pine_set_source, compile with pine_smart_compile, and iterate on error feedback in a single conversational flow. Development time: collapsed from hours to minutes.

2. Multi-Timeframe Strategy Validation

Your setup requires checking 4H trend alignment, 1H entry signals, and 15M execution timing across three charts. Manually switching symbols and timeframes is cognitively expensive. With the bridge: pane_set_layout 2x2, assign ES1! at 4H, 1H, 15M, and daily contexts, then ask Claude to "analyze all panes for confluence." The AI reads indicator values from each timeframe programmatically and synthesizes a structured assessment.

3. Automated Level Management

You've drawn 47 support/resistance levels across multiple timeframes, and price is approaching a cluster. Which levels matter now? data_get_pine_lines --filter "NY Levels" extracts your labeled levels, Claude identifies the confluence zone, and draw_shape adds a fresh horizontal line at the precise price—all without you touching the chart.

4. Backtesting Workflow Documentation

You're running replay mode on March 2024 NFP events, practicing entries. The bridge logs every replay_step, replay_trade, and replay_status call with timestamps and P&L. Pipe this to a local file for later review, or have Claude generate a structured trading journal entry with screenshots captured at each decision point.

5. Real-Time Alert Augmentation

Create sophisticated alert conditions that combine multiple indicator states. Instead of TradingView's limited alert GUI, script the logic in Pine, deploy via pine_set_source, and use alert_create with precise price and indicator thresholds. When alerts fire, capture the chart state automatically for post-hoc analysis.


Step-by-Step Installation & Setup Guide

Prerequisites

Before starting, confirm you have:

  • TradingView Desktop with an active paid subscription (required for real-time data)
  • Node.js 18+ installed (node --version to check)
  • Claude Code with MCP support, or any terminal for CLI-only usage
  • macOS, Windows, or Linux operating system

Step 1: Clone and Install

# Clone the repository
git clone https://github.com/tradesdontlie/tradingview-mcp.git

# Enter the project directory
cd tradingview-mcp

# Install dependencies
npm install

Step 2: Launch TradingView with Debug Port Enabled

TradingView Desktop must run with Chrome DevTools Protocol on port 9222. This is disabled by default and requires explicit user action.

macOS users:

./scripts/launch_tv_debug_mac.sh

Windows users:

scripts\launch_tv_debug.bat

Linux users:

./scripts/launch_tv_debug_linux.sh

Manual launch (any platform):

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

Or ask Claude directly:

"Use tv_launch to start TradingView in debug mode"

The launch scripts auto-detect your TradingView installation. If they fail, common paths are:

  • Mac: /Applications/TradingView.app/Contents/MacOS/TradingView
  • Windows: %LOCALAPPDATA%\TradingView\TradingView.exe
  • Linux: /opt/TradingView/tradingview or ~/.local/share/TradingView/TradingView

Step 3: Configure Claude Code MCP Integration

Add the TradingView MCP server to your Claude Code configuration. Edit ~/.claude/.mcp.json (global) or .mcp.json (project-local):

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

Replace /path/to/tradingview-mcp with your actual absolute path. For example, on macOS: /Users/yourname/projects/tradingview-mcp/src/server.js.

Step 4: Verify the Connection

Ask Claude:

"Use tv_health_check to verify TradingView is connected"

Or via CLI:

tv status

Expected output: JSON confirming CDP connection, TradingView version, and active chart state.

Optional: Install CLI Globally

npm link

This makes tv available system-wide. All CLI output is JSON-formatted for piping with jq.


REAL Code Examples from the Repository

The following examples are extracted directly from the TradingView MCP Bridge documentation, with detailed technical commentary.

Example 1: Basic CLI Symbol Switching and Quote Retrieval

# Check if TradingView is accessible via CDP
tv status
# Output: {"connected": true, "version": "2.9.1", "chart": {"symbol": "BTCUSD", "timeframe": "D"}}

# Switch to Apple stock on the daily timeframe
tv symbol AAPL
# Internally calls chart_set_symbol, waits for DOM stability, returns new state

# Get current price and OHLC data
tv quote
# Returns: {"symbol": "AAPL", "open": 189.50, "high": 191.20, "low": 188.90, "close": 190.75, "volume": 54200000}

# Get compact price summary instead of full bar history
tv ohlcv --summary
# Returns statistical summary + last 5 bars only, keeping payload under 500 bytes

Technical breakdown: These commands demonstrate the fundamental read/write cycle. tv status verifies the CDP websocket connection on localhost:9222. tv symbol AAPL doesn't just change a variable—it triggers actual DOM manipulation within TradingView's Electron app, waits for the chart to stabilize, and confirms the new state. The --summary flag is critical for context efficiency; without it, 100 bars of OHLCV data balloons to ~8KB.

Example 2: Pine Script Development Workflow

# Inject Pine Script source code into the TradingView editor
tv pine set "
//@version=5
indicator('Session Highlighter', overlay=true)
asiaHigh = ta.highest(high, 8)
asiaLow = ta.lowest(low, 8)
plot(asiaHigh, 'Asia High', color=color.new(color.red, 70))
plot(asiaLow, 'Asia Low', color=color.new(color.green, 70))
"

# Compile with intelligent error detection
tv pine compile
# Auto-detects compilation state, retries if needed, returns success or errors

# Check for compilation errors explicitly if compile was ambiguous
tv pine errors
# Returns: []  (empty array means clean compile)

# Read log output from Pine Script console
tv pine console
# Captures log.info(), log.warning(), log.error() output for debugging

# Save to TradingView cloud storage
tv pine save
# Persists the script under your TradingView account

Technical breakdown: This is where the bridge shines for developer productivity. The pine set command injects code via CDP's Runtime.evaluate into TradingView's Monaco editor instance. pine compile triggers the compilation button programmatically and polls for completion—critical because TradingView's compilation is asynchronous and can take 500ms-3s depending on complexity. The error reading parses TradingView's internal notification DOM, not official APIs, which is why the project warns these interfaces can break without notice.

Example 3: Streaming Price Monitoring with jq Pipeline

# Stream quote ticks and extract just the closing price
tv stream quote | jq '.close'
# Output: 190.75
#         190.80
#         190.82
#         ... (updates as price changes)

# Stream with filtering for specific indicator data
tv stream lines --filter "NY Levels"
# Monitors Pine Script line drawings labeled "NY Levels" for changes
# Only emits when line coordinates change, not on every poll

# Full multi-pane streaming
tv stream all
# Outputs JSONL with data from all visible panes simultaneously
# Format: {"pane": 0, "symbol": "ES1!", "quote": {...}, "values": [...]}
#         {"pane": 1, "symbol": "NQ1!", "quote": {...}, "values": [...]}

Technical breakdown: The streaming implementation uses a poll-and-diff loop with deduplication. The bridge queries CDP at regular intervals, compares against cached state, and only emits when values actually change. This is essential because CDP has no native push mechanism for arbitrary DOM properties. The jq integration enables Unix-style composability—pipe to files, databases, or alerting systems. The --filter parameter uses fuzzy string matching against Pine Script study titles, since TradingView's internal indicator IDs are opaque hashes.

Example 4: Multi-Pane Layout Configuration

# Set up a 2x2 grid with four charts
tv pane layout 2x2
# Valid layouts: s (single), 2h (2 horizontal), 2v (2 vertical), 
#                2x2, 4, 6, 8

# Assign different symbols to each pane
tv pane symbol 1 ES1!    # Pane 0: E-mini S&P 500
tv pane symbol 2 NQ1!    # Pane 1: E-mini Nasdaq
tv pane symbol 3 YM1!    # Pane 2: E-mini Dow
tv pane symbol 4 RTY1!   # Pane 3: E-mini Russell 2000

# Verify configuration
tv pane list
# Returns: [{"index": 0, "symbol": "ES1!", "active": true}, ...]

Technical breakdown: Pane manipulation is particularly complex because TradingView's layout system uses a custom grid engine, not standard CSS Grid or Flexbox. The bridge reverse-engineers the layout mutation API through CDP, triggering the same internal functions that the UI calls when you click layout buttons. The pane symbol command includes automatic timeframe inheritance—you can override per-pane if needed.

Example 5: Screenshot Capture for AI Visual Analysis

# Capture full chart area for Claude to analyze
tv screenshot -r chart
# Returns: {"path": "/tmp/tv_screenshot_20250115_143022.png", "width": 1920, "height": 1080}

# Capture strategy tester region specifically
tv screenshot -r strategy_tester
# Isolates backtest results panel for performance review

Technical breakdown: Screenshots use CDP's Page.captureScreenshot with element clipping based on calculated DOM bounding boxes. The -r (region) parameter maps to predefined selectors that resolve even when UI panels are repositioned. This enables true multimodal analysis: Claude reads structured data via MCP tools, sees visual patterns via screenshots, and synthesizes both for comprehensive chart interpretation.


Advanced Usage & Best Practices

Pin Your TradingView Version

The bridge accesses undocumented internal APIs that can change in any update. If stability matters, disable auto-updates and pin to a known-working version. The project explicitly warns: "These can change or break without notice."

Use study_filter Religiously

Without filtering, indicator data queries scan all visible studies—wasteful and slow. Always specify study_filter: "Exact Indicator Name" to target precise Pine Script outputs. The name must match TradingView's display title exactly, including spaces.

Leverage batch_run for Systematic Analysis

Need to check the same indicator across 20 symbols? batch_run executes actions across multiple symbols and timeframes with a single command, reducing conversational overhead with Claude and minimizing context consumption.

Combine Streaming with Local Databases

Pipe tv stream all to SQLite or InfluxDB for historical pattern mining. Since all data stays local, you're not violating data redistribution terms. Example: tv stream bars | jq -c '{t: .time, o: .open, h: .high, l: .low, c: .close}' | sqlite3 importer.sql.

Master the Decision Tree in CLAUDE.md

The repository includes a CLAUDE.md file that Claude reads automatically when working in the project. It contains a complete mapping of natural language intents to MCP tool sequences. Study it to craft prompts that trigger optimal tool chains.


Comparison with Alternatives

Feature TradingView MCP Bridge TradingView Web API (Unofficial) Manual Screenshot + GPT TradingView Pine Editor Alone
Real-time data access ✅ Live DOM queries ⚠️ Rate-limited, fragile ❌ Static only ✅ Native
Pine Script AI assistance ✅ Full injection/compile/debug cycle ❌ Not applicable ❌ Not applicable ❌ No AI integration
Chart control (navigate, zoom, draw) ✅ 78 MCP tools ❌ Read-only typically ❌ Manual only ✅ Manual only
Multi-pane automation ✅ Programmatic layout management ❌ Not applicable ❌ Not applicable ❌ Manual only
Visual AI analysis ✅ Native screenshot + structured data ❌ Not applicable ✅ Possible but manual ❌ Not applicable
Data stays local ✅ Zero external transmission ⚠️ Often proxies through servers ✅ If local GPT ✅ Native
Setup complexity ⚠️ Requires Node.js, CDP, Claude Code ⚠️ Requires API keys, proxy handling ✅ Simple ✅ None
Reliability/stability ⚠️ Undocumented APIs can break ⚠️ Cat-and-mouse with TradingView ✅ Stable ✅ Stable
Cost ✅ Free, open-source (MIT) ⚠️ Often paid services ✅ Variable (API costs) ✅ Included in subscription

Verdict: The bridge occupies a unique niche. It's the only solution that gives an AI assistant both structured data access and visual context while keeping everything local. The trade-off is maintenance overhead from undocumented APIs. For serious Pine Script developers and quantitative researchers, this is unmatched. For casual traders, manual methods may suffice.


FAQ

Does this bypass TradingView's paywall or subscription requirements?

Absolutely not. A valid TradingView subscription is mandatory. The bridge only interacts with your already-running, already-paid-for Desktop application. It cannot and does not circumvent any access controls.

Is my trading data sent to external servers?

No. All processing occurs locally on your machine. The bridge communicates exclusively via localhost:9222 using Chrome DevTools Protocol. No market data is transmitted, stored, or redistributed by this tool.

Can this execute real trades automatically?

No. The bridge is for chart interaction only—analysis, Pine Script development, navigation, and visualization. It does not connect to brokers or trading APIs.

What happens when TradingView updates their app?

The bridge accesses internal, undocumented Electron APIs that can change without notice. Features may break until the bridge is updated. Pin your TradingView Desktop version if stability is critical.

Do I need Claude Code specifically, or will other AI assistants work?

The MCP protocol is theoretically compatible with any MCP-supporting client. However, the bridge is optimized for Claude Code and includes CLAUDE.md for prompt engineering. Other assistants may require additional configuration.

Is this legal to use?

The tool itself is legal (MIT licensed). However, programmatic interaction with TradingView Desktop may conflict with their Terms of Use. You are solely responsible for compliance. The project includes an extensive disclaimer; read it carefully.

Can I use this for commercial trading strategies or redistribute data?

No. The license and disclaimer explicitly prohibit redistributing, reselling, or commercially exploiting TradingView's market data. This is for personal, educational, and research purposes only.


Conclusion

The TradingView MCP Bridge represents something genuinely new: a research-grade interface layer that makes professional trading software legible to large language models. It's not a magic money machine. It's not a sanctioned TradingView product. What it is, fundamentally, is a productivity multiplier for developers and researchers who live in both the AI and trading worlds.

If you've ever lost an afternoon to Pine Script syntax debugging, wished you could ask an AI "what's this chart telling me," or dreamed of automating multi-timeframe analysis workflows, this tool demands your attention. The setup requires technical comfort—Node.js, command lines, configuration files—but the payoff is a level of AI-assisted chart interaction that simply didn't exist before.

My take? This is early-stage infrastructure for a future where AI agents routinely operate complex desktop applications on our behalf. The research questions it explores—latency, reliability, ambiguous UI interpretation—will define how financial AI evolves over the next decade. Getting hands-on now means building intuition that competitors won't have.

Ready to give Claude eyes on your charts? Clone the repository, enable that debug port, and start building. The future of AI-assisted trading analysis is local, open-source, and waiting for you at https://github.com/tradesdontlie/tradingview-mcp.


Disclaimer: This article is for informational purposes only. Trading involves substantial risk of loss. The TradingView MCP Bridge is an independent research project not affiliated with TradingView Inc. or Anthropic. Always review the project's disclaimer and ensure your usage complies with all applicable terms and laws.

Advertisement

Comments (0)

No comments yet. Be the first to share your thoughts!

Leave a Comment

Apps & Tools Open Source

Apps & Tools Open Source

Bright Coding Prompt

Bright Coding Prompt

Categories

Advertisement
Advertisement