TradingView Chrome MCP

TradingView Chrome MCP

Enables AI assistants to remotely control TradingView charts in Chrome, including reading charts, writing and fixing Pine Script, managing watchlists and alerts, and capturing screenshots, all through natural language commands.

Category
访问服务器

README

TradingView Chrome MCP — Standalone Windows .exe

CI License: MIT

Let your AI assistant remote-control your TradingView tab in Chrome — with a single portable Windows executable.

This is a local MCP server that sits between Claude, Codex CLI, ChatGPT Desktop, Cursor, or any MCP host and your existing TradingView tab. It reads charts, writes Pine Script v6, fixes compile errors automatically, manages watchlists, sets alerts, and takes screenshots — all from plain English commands. No API keys, no TradingView credentials, and the AI never trades on your behalf.

  • 🖥️ Windows-first portable .exe — single file, no Node.js installer, no registry changes.
  • 🔌 Two browser drivers — Playwright/CDP (default) or a loaded Chrome extension.
  • 🧠 Autonomous Pine Script repair loop — write → compile → detect error → LLM patch → add-to-chart → verify.
  • 🔒 Approval-gated writes — symbol changes, saves, and layout switches wait for your dashboard OK.
  • 🌐 Self-contained local dashboard — control, audit log, screenshots, and emergency stop at http://127.0.0.1:3939.

Download the standalone Windows app

Go to the latest release and download tradingview-chrome-mcp.exe.

Put it anywhere — desktop, USB drive, or project folder — and double-click it.

First launch unpacks the embedded Node.js runtime and dependencies to:

%LOCALAPPDATA%\tradingview-chrome-mcp

Subsequent launches reuse that cache and start in seconds. All logs, backups, screenshots, and exports are written there, so the .exe itself is 100% portable.


Quick start (Windows)

1. Run the .exe

# Default dashboard opens at http://127.0.0.1:3939
.\tradingview-chrome-mcp.exe

The launcher will:

  1. Detect or start Chrome.
  2. Open the local dashboard.
  3. Start the MCP server over STDIO (and an optional HTTP transport if enabled).

2. Register with your AI host

Claude Desktop / Claude Code

Add to %APPDATA%\Claude\claude_desktop_config.json:

{
  "mcpServers": {
    "tradingview-chrome-mcp": {
      "command": "C:\\Users\\%USERNAME%\\AppData\\Local\\tradingview-chrome-mcp\\tradingview-chrome-mcp.exe",
      "env": {
        "TV_DASHBOARD_PORT": "3939",
        "TV_LOG_LEVEL": "info",
        "TV_APPROVAL_TIMEOUT_MS": "120000"
      }
    }
  }
}

Codex CLI

If you used the PowerShell installer, Codex is registered automatically. Otherwise:

codex mcp add tradingview-chrome-mcp "C:\Users\%USERNAME%\AppData\Local\tradingview-chrome-mcp\tradingview-chrome-mcp.exe"

ChatGPT Desktop / Cursor / Windsurf

Point the host at the .exe as an STDIO MCP server with the same environment variables.

3. Ask the AI to trade for you (in words, not money)

Read my TradingView chart and tell me the current symbol and timeframe.
Create a Pine Script v6 EMA crossover indicator called "EMA Cross" and add it to the chart.
Fix all Pine Script compile errors and keep trying until the indicator loads.

Installation options

Method Best for Build step One-click launcher
Portable .exe (recommended) Windows users who want a single file No Double-click
PowerShell installer Windows users who want Start-menu shortcuts No irm ... | iex
Build from source Developers or macOS/Linux npm install && npm run build Launch-TV-MCP.ps1
Vercel-hosted SSE fork Teams needing a remote market-data MCP Next.js build No

Full install details: INSTALL.md · Tool reference: TOOL_REFERENCE.md


Chrome extension driver (optional)

The .exe defaults to Playwright over Chrome DevTools Protocol. If you prefer to drive an already-running Chrome instance without --remote-debugging-port, use the Chrome extension driver:

  1. Open chrome://extensions and enable Developer mode.
  2. Click Load unpacked and select the extension/ folder from this repo.
  3. Run the .exe with:
$env:TV_BROWSER_DRIVER = "extension"
$env:TV_EXTENSION_WS_PORT = "9223"
$env:TV_EXTENSION_TOKEN = "tradingview-chrome-mcp"
.\tradingview-chrome-mcp.exe

The extension connects to the .exe over a local WebSocket, injects MAIN-world scripts into the TradingView tab, and exposes all 48 tools. This is the path that enables the autonomous Pine Script repair loop to catch red compile-error toasts the instant they appear.


Features

Feature What it means
Portable .exe One file; nothing written outside %LOCALAPPDATA%\tradingview-chrome-mcp.
Chrome profile reuse Optional TV_ALLOW_REAL_PROFILE=1 keeps you logged into TradingView.
Approval gate Writes wait for your OK in the local dashboard.
Emergency stop One button disables every tool instantly.
Local audit log Every action is written to logs/audit.jsonl.
No credential extraction Cookies, tokens, and passwords are never read.
Pine Script v6 Create, patch, save, compile, rename, attach, back up, and restore scripts.
Autonomous repair loop tv_pine_autofix runs read → compile → LLM patch → save → add-to-chart → verify.
Error toast observer The Chrome extension catches red compilation errors as soon as they appear.
Alerts & watchlists Read, add, sync, and delete symbols and price alerts.
Layouts & indicators Save, duplicate, rename, reset, switch layouts; add/remove/hide/show/update indicators.
Screenshots & data export Capture the chart or export visible metadata.

Tool categories

The server exposes 48 tools grouped by job:

  • Diagnosticsping, mcp_client_info
  • Chart controltv_status, tv_read_chart, tv_chart_metadata, tv_change_symbol, tv_change_timeframe, tv_ensure_chart
  • Pine Scripttv_open_pine_editor, tv_read_pine_source, tv_pine_create, tv_pine_patch, tv_pine_save, tv_pine_add_to_chart, tv_pine_compile_errors, tv_rename_script, tv_pine_backup, tv_pine_list_backups, tv_pine_restore, tv_pine_autofix
  • Watchliststv_watchlist_read, tv_watchlist_add_symbol, tv_watchlist_sync
  • Alertstv_alert_create, tv_alert_list, tv_alert_delete
  • Layoutstv_layout_list, tv_layout_switch, tv_layout_save, tv_layout_duplicate, tv_layout_rename, tv_layout_reset, tv_layout_export
  • Indicatorstv_indicator_add, tv_indicator_remove, tv_indicator_hide, tv_indicator_show, tv_indicator_settings
  • Verificationtv_chart_verify
  • Utilitiestv_screenshot, tv_dismiss_dialogs, tv_read_strategy_tester, tv_chart_data_export, browser_status, browser_list_tabs
  • Safetyemergency_stop, emergency_clear

Configuration

Set environment variables before launching the .exe:

Variable Default Purpose
TV_DEFAULT_TRADINGVIEW_URL https://www.tradingview.com/chart/ Chart URL to open when no tab exists.
TV_ALLOW_CHROME_LAUNCH 0 Set to 1 to let the launcher start Chrome if none is found.
TV_ALLOW_CHROME_KILL 0 Set to 1 to let the launcher close conflicting Chrome instances.
TV_ALLOW_REAL_PROFILE 0 Set to 1 to reuse your real Chrome profile.
TV_DASHBOARD_PORT 3939 Local dashboard port.
TV_DASHBOARD_TOKEN random Bearer token required by dashboard /api/*.
TV_MCP_HTTP_PORT 3940 Optional Streamable HTTP transport; set 0 to disable.
TV_BROWSER_DRIVER playwright playwright or extension.
TV_EXTENSION_WS_PORT 9223 WebSocket port for extension mode.
TV_EXTENSION_TOKEN tradingview-chrome-mcp Shared secret between .exe and extension.
TV_APPROVAL_TIMEOUT_MS 120000 How long writes wait for your approval.
TV_DATA_DIR %LOCALAPPDATA%\tradingview-chrome-mcp Logs, backups, screenshots, exports.
OPENAI_API_KEY / ANTHROPIC_API_KEY Enables autonomous tv_pine_autofix patching.
TV_AUTOFIX_MODEL gpt-4o / claude-3-5-sonnet-20241022 LLM used by the repair loop.

Example: open directly on XAUUSD

$env:TV_DEFAULT_TRADINGVIEW_URL = "https://www.tradingview.com/chart/?symbol=OANDA%3AXAUUSD"
.\tradingview-chrome-mcp.exe

How the autonomous Pine Script loop works

AI writes Pine Script
        │
        ▼
┌───────────────────────┐
│  MCP .exe (Windows)   │
│  STDIO / HTTP bridge  │
└───────────┬───────────┘
            │ JSON-RPC over WebSocket (extension driver)
            ▼
┌───────────────────────┐
│ Chrome extension       │
│ service worker         │
└───────────┬───────────┘
            │ chrome.scripting.executeScript({ world: "MAIN" })
            ▼
┌───────────────────────┐
│ TradingView tab        │
│ Monaco editor          │
└───────────┬───────────┘
            │ compile error toast appears
            ▼
┌───────────────────────┐
│ error_observer.js      │
│ MutationObserver       │
└───────────┬───────────┘
            │ PINE_SCRIPT_ERROR_DETECTED
            ▼
┌───────────────────────┐
│ MCP .exe receives error│
└───────────┬───────────┘
            │ error text passed to AI
            ▼
AI patches code and retries

Building the .exe from source

On a Windows machine with Node.js 22+:

git clone https://github.com/firyomaefx/tradingview-chrome-mcp.git
cd tradingview-chrome-mcp
npm install
npm run build:exe

Output: tradingview-chrome-mcp.exe (~150 MB). It embeds Node.js, the compiled server, and all runtime dependencies via caxa.


Architecture

┌─────────────────┐      STDIO / HTTP       ┌──────────────────────┐
│  MCP host       │  ───────────────────────▶  │  tradingview-chrome  │
│  (Claude, Codex,│                           │  -mcp.exe             │
│  ChatGPT, etc.) │                           │                      │
└─────────────────┘                           │  ┌───────────────┐   │
                                              │  │ Tool registry │   │
                                              │  │ Policy +      │   │
                                              │  │ approvals     │   │
                                              │  └───────┬───────┘   │
                                              │          │           │
                                              │  ┌───────▼───────┐   │
                                              │  │ Browser driver│   │
                                              │  │ (Playwright   │   │
                                              │  │  or extension)│   │
                                              │  └───────┬───────┘   │
                                              └──────────┼───────────┘
                                                         │
                                              ┌──────────▼──────────┐
                                              │  Google Chrome      │
                                              │  TradingView tab    │
                                              └─────────────────────┘

Read ARCHITECTURE.md for diagrams, invariants, and transport details.


Security & privacy

  • No credential storage. Cookies, tokens, and passwords are never read or transmitted.
  • Temporary Chrome profile by default. Isolated unless you opt into TV_ALLOW_REAL_PROFILE=1.
  • Dashboard bearer token. All dashboard API calls require Authorization: Bearer <TV_DASHBOARD_TOKEN>.
  • Local-only audit logs. Every action is written to logs/audit.jsonl with sensitive inputs redacted.
  • Approval-gated writes. Destructive tools require explicit dashboard approval.
  • Emergency stop. Instantly disables all tool execution.
  • Domain allowlist. Browser tools only run on tradingview.com / www.tradingview.com.
  • No remote telemetry in local mode. The Vercel-hosted fork is separate and opt-in.

Project layout

tradingview-chrome-mcp/
├── src/                    # Local MCP server
│   ├── server/             # STDIO + HTTP transports
│   ├── tools/              # Tool registry (48 tools)
│   ├── adapters/           # TradingView DOM automation
│   ├── browser/            # Playwright + extension drivers
│   ├── dashboard/          # Local Express control panel
│   ├── permissions/        # Policy + approval queue
│   ├── detect/             # MCP host client detection
│   ├── telemetry/          # Privacy-first telemetry helpers
│   └── config.ts           # Centralized config
├── extension/              # Optional Chrome extension (MV3)
├── scripts/                # Launchers, installer, helpers
├── vercel-hosted/          # Separate Vercel SSE fork
├── tests/                  # Unit + integration tests
└── docs/                   # README, INSTALL, HOSTED, etc.

Development status

  • Version: 0.2.0
  • Default branch: main
  • Local tests: 41 passing
  • CI: .github/workflows/ci.yml runs Windows and Ubuntu jobs on every push.

License

MIT. See LICENSE.

推荐服务器

Baidu Map

Baidu Map

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

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

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

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

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

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

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

官方
精选
本地
TypeScript
VeyraX

VeyraX

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

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

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

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

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

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

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

官方
精选
Exa MCP Server

Exa MCP Server

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

官方
精选