tradingview-chart
MCP server that captures TradingView chart images via Selenium — supports any ticker/interval with browser pooling for concurrent performance
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:
-
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
-
Install dependencies: pip install -r requirements.txt
-
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
-
Run the server: Production (Optimized): python main_optimized.py
Legacy (Simple): python main.py
-
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
mcp-aktools
📈 提供股票、加密货币的数据查询和分析功能MCP服务器
mcp -odoo
A Model Context Protocol (MCP) server that enables AI assistants to securely interact with Odoo ERP systems through standardized resources and tools for data retrieval and manipulation.
mcp-pinecone
Model Context Protocol server to allow for reading and writing from Pinecone. Rudimentary RAG
Gitingest
mcp server for gitingest
microsoft_fabric_mcp
MCP server wrapping around the Fabric Rest API
mcp -memos-py
A Python package enabling LLM models to interact with the Memos server via the MCP interface for searching, creating, retrieving, and managing memos.