Get the FREE Ultimate OpenClaw Setup Guide →

tradingview-chart

MCP server that captures TradingView chart images via Selenium — supports any ticker/interval with browser pooling for concurrent performance

Installation
Run this command in your terminal to add the MCP server to Claude Code.
Run in terminal:
Command
claude mcp add --transport stdio ertugrul59-tradingview-chart-mcp python main_optimized.py \
  --env CHROME_DRIVER_PATH="optional-path-to-chromedriver" \
  --env MCP_SCRAPER_HEADLESS="True" \
  --env TRADINGVIEW_SESSION_ID="your-session-id" \
  --env TRADINGVIEW_SESSION_ID_SIGN="your-session-sign"

How to use

This MCP server provides an optimized way to fetch TradingView chart images by leveraging a pre-initialized browser pool. The production flow uses main_optimized.py, which pools up to four browser instances to handle concurrent requests for chart images. You can request a chart image by calling the get_tradingview_chart_image tool with a ticker and interval, and you can monitor performance via get_performance_stats. The prompts and examples map common ticker symbols and TradingView intervals to the appropriate codes, enabling fast, concurrent image retrieval with reduced latency compared to the legacy single-browser approach.

How to install

Prerequisites:

  • Python 3.8+ installed on your system
  • Git installed (optional, for cloning)
  • Chromium/Chrome installed and chromedriver available in PATH (or configure CHROME_DRIVER_PATH)

Step-by-step:

  1. Create and activate a virtual environment:

    Navigate to the project directory

    cd tradingview-chart-mcp python3 -m venv .venv

    Activate (examples):

    source .venv/bin/activate # macOS/Linux .venv\Scripts\activate.bat # Windows Command Prompt .venv\Scripts\Activate.ps1 # Windows PowerShell

  2. Install dependencies: pip install -r requirements.txt

  3. Configure environment for local testing (optional but recommended):

    • Copy .env.example to .env
    • Set TRADINGVIEW_SESSION_ID and TRADINGVIEW_SESSION_ID_SIGN in .env
    • Optionally adjust MCP_SCRAPER_HEADLESS and other settings
  4. Run the server: Production (Optimized): python main_optimized.py

    Legacy (Simple): python main.py

  5. Optional: customize port or transport via command line options provided by main_optimized.py

Notes:

  • Ensure chromedriver is accessible or set CHROME_DRIVER_PATH to the executable path.
  • If you are onboarding in a containerized environment, provide the same environment variables to the container.

Additional notes

Tips and common considerations:

  • Environment variables control authentication and headless browser behavior. Ensure TRADINGVIEW_SESSION_ID and TRADINGVIEW_SESSION_ID_SIGN are kept secret and not checked into version control.
  • The production flow uses a browser pool (up to 4 browsers) for concurrency. If you experience issues, you can disable pooling with --disable-pooling (as described in the README) to fall back to a traditional single-browser mode.
  • Use get_performance_stats to monitor total requests, average time, and pool status to gauge throughput under load.
  • If you encounter 400/500 errors from the MCP endpoints, confirm that the input ticker/interval are valid and that TradingView session cookies are valid for authenticated access.
  • The Save Shortcut feature (MCP_SCRAPER_USE_SAVE_SHORTCUT) enables clipboard capture of images as base64 data URLs for faster, offline-friendly workflows.

Related MCP Servers

Sponsor this space

Reach thousands of developers