tradingview
A lightweight Python MCP server that fetches TradingView chart snapshots using Playwright for fast, secure, and customizable browser automation.
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:
- Clone the repository:
git clone https://github.com/yourusername/tradingview-mcp.git
cd tradingview-mcp
- Create and activate a virtual environment:
# Windows
python -m venv venv
.\venv\Scripts\activate
# Linux/Mac
python3 -m venv venv
source venv/bin/activate
- Install dependencies:
pip install -r requirements.txt
- Install Playwright browsers (one-time download):
python -m playwright install chromium
- 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
- 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
web-eval-agent
An MCP server that autonomously evaluates web applications.
browser-use
Browse the web, directly from Cursor etc.
mcp-yfinance
Real-time stock API with Python, MCP server example, yfinance stock analysis dashboard
mcp-aoai-web-browsing
A minimal Model Context Protocol 🖥️ server/client🧑💻with Azure OpenAI and 🌐 web browser control via Playwright.
Vector-Knowledge-Base
A semantic search engine that transforms your documents into an intelligent, searchable knowledge base using vector embeddings and AI
github-second-brain
Providing tools to AI to explore github codebase like agent