Get the FREE Ultimate OpenClaw Setup Guide →

tradingview

A lightweight Python MCP server that fetches TradingView chart snapshots using Playwright for fast, secure, and customizable browser automation.

Installation
Run this command in your terminal to add the MCP server to Claude Code.
Run in terminal:
Command
claude mcp add --transport stdio ali-rajabpour-tradingview-mcp python C:\path\to\tradingview-mcp\src\tradingview_mcp\server.py \
  --env TRADINGVIEW_SESSION_ID="your_TRADINGVIEW_SESSION_ID_here" \
  --env TRADINGVIEW_SESSION_ID_SIGN="your_TRADINGVIEW_SESSION_ID_SIGN_here"

How to use

This MCP server provides access to TradingView chart snapshots via a lightweight Playwright-based backend. It exposes tools that let MCP clients request rendered chart images for a given symbol, interval, size, and theme, as well as validate credentials and list available timeframes. You can query the server using the provided MCP commands such as get_chart_snapshot, validate_session, and list_timeframes. The server reuses a persistent browser instance to deliver fast responses (typically a few seconds per chart) and relies on TradingView session cookies for authentication. To use it, configure Claude Desktop or any MCP client to point at the Python server entry point, and provide the required TradingView session cookies either through an environment block or inline credentials as demonstrated in the configuration examples.

How to install

Prerequisites:

  • Python 3.10 or higher
  • Access to a TradingView account and valid session cookies
  • Git and a command line interface

Steps:

  1. Clone the repository:
git clone https://github.com/yourusername/tradingview-mcp.git
cd tradingview-mcp
  1. Create and activate a virtual environment:
# Windows
python -m venv venv
.\venv\Scripts\activate

# Linux/Mac
python3 -m venv venv
source venv/bin/activate
  1. Install dependencies:
pip install -r requirements.txt
  1. Install Playwright browsers (one-time download):
python -m playwright install chromium
  1. Configure credentials:
  • Copy .env.example to .env and fill in your session cookies:
# Windows
copy .env.example .env

# Linux/Mac
cp .env.example .env
  • Add your TradingView cookies:
TRADINGVIEW_SESSION_ID=your_actual_session_id_here
TRADINGVIEW_SESSION_ID_SIGN=your_actual_session_id_sign_here
  1. Run the server:
python src/tradingview_mcp/server.py

The server will start and listen for MCP client connections via stdio.

Additional notes

Tips and caveats:

  • Ensure the TradingView session cookies are current; cookies can expire and require refreshing.
  • Keep the Playwright browser in headless mode for optimal resource usage.
  • If you encounter authentication errors, double-check for trailing spaces or hidden characters in the .env file and ensure the cookies are copied exactly as shown.
  • Absolute paths are recommended when configuring MCP clients (e.g., Claude Desktop).
  • The available tools include get_chart_snapshot (to fetch chart images), validate_session (to verify credentials), and list_timeframes (to discover supported intervals).
  • If you need larger charts or different themes, adjust width, height, and theme parameters in the MCP configuration or client requests.

Related MCP Servers

Sponsor this space

Reach thousands of developers