TradingView MCP Bridge
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@TradingView MCP Bridgecompile my Pine Script strategy and show the test results"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
TradingView MCP Bridge
A local, developer-first bridge that lets an AI agent read and drive your TradingView Desktop charts in real time. It speaks the Model Context Protocol (MCP) to your AI client and the Chrome DevTools Protocol to the app, exposing 78 tools plus a tv CLI for chart analysis, Pine Script development, alerts, replay practice, and multi-pane automation — entirely on your own machine, with no website login and no calls to TradingView's servers.

A strategy built and stress-tested entirely through this MCP workflow — the AI reads the TradingView Desktop chart, iterates the Pine Script, and reads the Strategy Tester results back. (Deriv BOOM 1000, 1m; strategy source kept private.)
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.
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.
All data processing occurs locally on your machine. No TradingView data is transmitted, stored, or redistributed externally by this tool.
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
At heart, this project is a translation layer. It turns an AI agent's natural-language intent ("what levels are on my chart?", "compile this strategy", "step the replay forward") into concrete operations against the chart you already have open, and turns the chart's live, in-memory state back into compact structured data the agent can reason about. No web scraping, no TradingView server calls, no intercepted traffic — every action runs against the Electron renderer already on your machine.
Architecture at a glance
graph LR
A[AI client] -->|MCP over stdio| B[MCP server]
B --> C[Tool layer]
C --> D[Core logic]
D -->|Runtime.evaluate| E[CDP client]
E -->|remote debug port 9222| F[TradingView Desktop]
D -.-> G[MetaTrader 5 - optional]The code is split into three thin layers so the logic stays testable and the surface stays small:
Layer | Path | Responsibility |
Tools |
| Declares each MCP tool — name, input schema, description — and delegates to core. This is the only layer the AI sees. |
Core |
| All real behaviour: |
CLI |
| Mirrors every capability as a |
The MCP server (src/server.js) speaks MCP over stdio to the AI client; the CLI (src/cli/index.js) is a second front-end onto the exact same core. Both lean on a single dependency of substance — chrome-remote-interface — and little else.
1 · Connecting to the desktop app
TradingView Desktop is an Electron app. Launched with --remote-debugging-port=9222, Electron exposes a standard Chrome DevTools Protocol (CDP) endpoint on 127.0.0.1:9222. The connection layer (src/connection.js):
Lists debug targets at
/json/listand picks the page target whose URL is your chart (tradingview.com/chart), attaches withchrome-remote-interface, and enables theRuntime,Page, andDOMdomains.Binds to
127.0.0.1, notlocalhost— on Windowslocalhostcan resolve to IPv6::1first, which Electron's debug server doesn't listen on.Caches the client behind a fast liveness check and reconnects with exponential backoff (5 attempts).
tab_switchre-attaches transparently, so later reads follow the tab you activated.
2 · Reading the chart
Every read is a small JavaScript expression evaluated inside the page via Runtime.evaluate (returned by value). Rather than guess at pixels, it reaches into TradingView's own in-memory model through API paths found by live probing, for example:
window.TradingViewApi._activeChartWidgetWV.value()— the active chart widget…_chartWidget.model().mainSeries().bars()— raw OHLCVmodel().dataSources()— studies, plus strategy performance / orders / report data
Because it reads the same objects the UI renders from, the numbers returned match exactly what you see on screen. Every value interpolated into an expression is escaped with JSON.stringify, and any number bound for a write is validated finite first, so a stray NaN can never reach state that persists to your TradingView cloud.
3 · Reading custom Pine drawings
Levels and annotations drawn by indicators with line.new(), label.new(), table.new(), and box.new() are invisible to ordinary price/indicator reads. The data core walks the study's internal graphics collection (its _primitivesCollection … _primitivesDataById) to extract those primitives, then deduplicates and caps them — so a dashboard-heavy chart returns a few KB of clean rows (data_get_pine_lines/labels/tables/boxes) instead of hundreds of raw objects. Pass study_filter to target one indicator, or verbose: true when you actually want raw IDs and colours.
4 · Controlling the chart & developing Pine
Writes travel the same bridge (with DOM/Input events where a genuine click is needed): change symbol, timeframe, or chart type; add/remove indicators; draw shapes; create alerts; build multi-pane layouts; drive replay. The Pine workflow is a tight loop — pine_set_source injects code, pine_smart_compile compiles it, and pine_get_errors / pine_get_console read the compiler output and log.info() back — so the agent fixes its own mistakes before pine_save writes to the cloud.
5 · Streaming
tv stream … runs a poll-and-diff loop against those same local APIs and prints newline-delimited JSON (JSONL) to stdout — only changes are emitted, so you can pipe a live feed of quotes, bars, indicator values, or Pine levels straight into jq, a file, or your own script.
6 · Acting on signals — the optional MetaTrader 5 layer
The MCP server itself only reads and controls charts; it never places an order. In this project the chart read is interpreted into a directional bias and handed to a separate MetaTrader 5 bridge that attaches to your local terminal and submits the matching order — gated by DRY_RUN (log-only) and MAX_LOT (size cap). See Connect to MetaTrader 5.
Why it's safe to run
No servers, no files, no interception. It only talks to the Electron instance already running under your login.
Opt-in by design. The debug port stays closed until you pass
--remote-debugging-port— nothing listens otherwise.Local and inspectable. Data stays on your machine, and the CLI lets you see exactly what each tool returns.
Guarded writes. Inputs are escaped and numeric writes are finite-checked before they can touch persisted state.
Related MCP server: TradingView MCP Bridge
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
Why This Exists
Most trading automation lives outside the chart — separate data feeds, separate brokers, separate dashboards. This project takes the opposite approach: it makes the chart you already trust the source of truth, and gives an AI agent a first-class way to read and act on it.
That opens up a few things worth building:
Letting an agent read the exact state a human sees — indicator values, custom Pine levels, session tables — instead of a re-derived approximation.
Iterating Pine Script conversationally: describe the idea, let the agent write it, compile, read the errors, and fix.
Turning a discretionary setup into a repeatable one — reading a bias off the chart and, optionally, routing it to a MetaTrader 5 terminal for execution.
Probing where LLM agents break down on live, stateful financial UIs.
See RESEARCH.md for deeper notes and open questions.
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
tvCLI command, pipe-friendly with JSON outputLaunch 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/allisonbit/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
git clone https://github.com/allisonbit/tradingview-mcp.git
cd tradingview-mcp
npm install2. Launch TradingView with CDP
TradingView Desktop must be running with Chrome DevTools Protocol enabled on port 9222.
Mac:
./scripts/launch_tv_debug_mac.shWindows:
scripts\launch_tv_debug.batLinux:
./scripts/launch_tv_debug_linux.shOr launch manually on any platform:
/path/to/TradingView --remote-debugging-port=9222Or 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):
{
"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"
A healthy response looks like:
{ "success": true, "cdp_connected": true, "chart_symbol": "BOOM_1000", "api_available": true }If cdp_connected is false, TradingView isn't running with --remote-debugging-port=9222 — re-run the launch script from step 2.
How the TradingView Desktop link works (as configured here)
This is the exact wiring used on the machine this project was built on:
Launch TradingView Desktop with the debug port.
scripts\launch_tv_debug.batcloses any running TradingView, auto-detects the install (including Microsoft Store / MSIX builds viaGet-AppxPackage), and starts it with--remote-debugging-port=9222.Wait for CDP. The script polls
http://127.0.0.1:9222/json/versionuntil the DevTools endpoint answers. It uses127.0.0.1rather thanlocalhost, because Electron's debug server may not listen on IPv6::1.Register the server in your MCP config with the absolute path to
src/server.js:
{
"mcpServers": {
"tradingview": {
"command": "node",
"args": ["C:/path/to/tradingview-mcp/src/server.js"]
}
}
}Restart the MCP client (Claude Code / Qoder) so it spawns the server, then run
tv_health_check. The desktop app carries your existing TradingView login — there is no separate website login step.
Connect to MetaTrader 5 (optional live-execution layer)
This repo reads and controls charts only — it never places orders (see What This Tool Does Not Do). To act on what the AI reads, pair it with a MetaTrader 5 terminal as the execution layer. This is the Deriv MT5 setup used here:
Install the MetaTrader 5 desktop terminal and create an account. For Deriv: Deriv → MT5 → Add account — start with a Demo account. Note the numeric MT5 login (not your email), the password, and the server name (e.g.
Deriv-Demo,Deriv-Server).Install the Python bridge (Windows only — it needs the MT5 terminal installed locally):
pip install MetaTrader5 python-dotenvCreate a
.envfrom.env.exampleand fill in your terminal details:
MT5_LOGIN=12345678
MT5_PASSWORD=your_mt5_password
MT5_SERVER=Deriv-Demo
# Optional: full path to terminal64.exe if it isn't auto-detected
MT5_PATH=
# Safety first — keep DRY_RUN on until you trust the flow
DRY_RUN=true
MAX_LOT=0.10How the connection is made. The bridge calls
MetaTrader5.initialize(path=MT5_PATH)to attach to the running terminal, thenlogin(MT5_LOGIN, password=MT5_PASSWORD, server=MT5_SERVER). A successful account check returns your balance/equity, confirming the terminal link.Safety rails.
DRY_RUN=truelogs orders without sending them, andMAX_LOTcaps order size (in lots). Only setDRY_RUN=falseonce you have validated the flow on the Demo server.
Live trading carries real financial risk. Test on aDemo MT5 account first, keep DRY_RUN=true while validating, and never trade money you can't afford to lose.
CLI
Every MCP tool is also accessible as a tv CLI command. All output is JSON for piping with jq.
# Install globally (optional)
npm link
# Or run directly
node src/cli/index.js <command>Quick Examples
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 changesAll 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 / scrollStreaming
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.
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.
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?" |
|
"What levels are showing?" |
|
"Read the session table" |
|
"Give me a full analysis" |
|
"Switch to AAPL daily" |
|
"Write a Pine Script for..." |
|
"Start replay at March 1st" |
|
"Set up a 4-chart grid" |
|
"Draw a level at 24500" |
|
"Take a screenshot" |
|
Tool Reference (78 MCP tools)
Chart Reading
Tool | When to use | Output size |
| First call — get symbol, timeframe, all indicator names + IDs | ~500B |
| Read current RSI, MACD, BB, EMA values from all indicators | ~500B |
| Get latest price, OHLC, volume | ~200B |
| Get price bars. Use | 500B (summary) / 8KB (100 bars) |
Custom Indicator Data (Pine Drawings)
Read line.new(), label.new(), table.new(), box.new() output from any visible Pine indicator.
Tool | When to use | Output size |
| Read horizontal price levels (support/resistance, session levels) | ~1-3KB |
| Read text annotations + prices ("PDH 24550", "Bias Long") | ~2-5KB |
| Read data tables (session stats, analytics dashboards) | ~1-4KB |
| Read price zones / ranges as {high, low} pairs | ~1-2KB |
Always use study_filter to target a specific indicator: study_filter: "Profiler".
Chart Control
Tool | What it does |
| Change ticker (BTCUSD, AAPL, ES1!, NYMEX:CL1!) |
| Change resolution (1, 5, 15, 60, D, W, M) |
| Change style (Candles, HeikinAshi, Line, Area, Renko) |
| Add/remove indicators. Use full names: "Relative Strength Index" not "RSI" |
| Jump to a date (ISO: "2025-01-15") |
| Zoom to exact range (unix timestamps) |
| Symbol metadata and search |
| Change indicator settings, show/hide |
Multi-Pane Layouts
Tool | What it does |
| List all panes with symbols and active state |
| Change grid: |
| Focus a specific pane by index |
| Set symbol on any pane |
Tab Management
Tool | What it does |
| List open chart tabs |
| Open/close tabs |
| Switch to a tab by index |
Pine Script Development
Tool | Step |
| 1. Inject code into editor |
| 2. Compile with auto-detection + error check |
| 3. Read compilation errors if any |
| 4. Read log.info() output |
| 5. Save to TradingView cloud |
| Read current script (warning: can be 200KB+ for complex scripts) |
| Create blank indicator/strategy/library |
| Open or list saved scripts |
| Offline static analysis (no chart needed) |
| Server-side compile check (no chart needed) |
Replay Mode
Tool | Step |
| Enter replay at a date |
| Advance one bar |
| Auto-advance (set speed in ms) |
| Buy/sell/close positions |
| Check position, P&L, date |
| Return to realtime |
Drawing, Alerts, UI Automation
Tool | What it does |
| Draw horizontal_line, trend_line, rectangle, text |
| Manage drawings |
| Manage price alerts |
| Screenshot (regions: full, chart, strategy_tester) |
| Run action across multiple symbols/timeframes |
| Read/modify watchlist |
| Manage saved layouts |
| UI automation |
| Connection 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.
Feature | How it saves context |
Pine lines | Returns deduplicated price levels only, not every line object |
Pine labels | Capped at 50 per study, text+price only |
Pine tables | Pre-formatted row strings, no cell metadata |
Pine boxes | Deduplicated {high, low} zones only |
OHLCV summary mode | Stats + last 5 bars instead of all bars |
Indicator inputs | Encrypted/encoded blobs auto-filtered |
| Pass on any pine tool to get raw data with IDs/colors when needed |
| Target one indicator instead of scanning all |
Finding TradingView on Your System
Launch scripts and tv_launch auto-detect TradingView. If auto-detection fails:
Platform | Common Locations |
Mac |
|
Windows |
|
Linux |
|
The key flag: --remote-debugging-port=9222
Testing
# Requires TradingView running with --remote-debugging-port=9222
npm test29 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 (84 tools) + CLI (
tvcommand, 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/sdkandchrome-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 Chrome DevTools Protocol (CDP), the standard debugging interface built into 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 via a standard Chromium command-line flag (--remote-debugging-port=9222).
By using this software, you acknowledge and agree that:
You are solely responsible for ensuring your use of this tool complies with TradingView's Terms of Use and all applicable laws.
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.
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.
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)
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.
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.
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.
Credits
Built and maintained by allisonbit.
The core MCP bridge is built on the open-source, MIT-licensed tradingview-mcp project. See LICENSE for the full attribution.
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.
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- Flicense-qualityCmaintenanceEnables AI assistants to interact with TradingView Desktop charts for analysis, Pine Script development, and workflow automation via Chrome DevTools Protocol.Last updated224
- Flicense-qualityBmaintenanceEnables AI assistants to interact with locally running TradingView Desktop for chart analysis, Pine Script development, and workflow automation via Chrome DevTools Protocol.Last updated2245,317
- Flicense-qualityBmaintenanceEnables AI assistants to interact with locally running TradingView Desktop for chart analysis, Pine Script development, and workflow automation via Chrome DevTools Protocol.Last updated224
- Flicense-qualityCmaintenanceEnables AI assistants to control and read data from TradingView Desktop, including morning briefs, chart analysis, Pine Script development, and replay mode.Last updated224
Related MCP Connectors
Real SEC, 13F, insider, congress & macro data your AI agent can cite. Hosted MCP, 24 tools.
Read-only China A-share data for AI agents: market, limit-up, capital flow and disclosures.
The financial MCP for AI agents - 90+ financial tables, SEC filings, signals, alt-data.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/allisonbit/tradingview-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server