tradingview-chart-mcp
Fetches TradingView chart images based on ticker symbol and time interval, using browser pooling for optimized concurrent performance. Provides tools to retrieve chart image URLs and performance statistics.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@tradingview-chart-mcpshow me the daily chart for BYBIT:BTCUSDT.P"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
MCP Server - TradingView Chart Image Scraper
๐ Now with Browser Pooling Optimization for 70-80% Better Concurrent Performance!
This MCP server provides tools to fetch TradingView chart images based on ticker and interval with advanced browser pooling for maximum concurrent performance.
๐ฅ Performance Optimizations
Browser Pooling Technology
Production Version: Uses
main_optimized.pywith browser pooling for maximum concurrent performancePerformance Improvement: 70-80% faster for concurrent requests
Concurrent Handling: Supports up to 4 simultaneous requests with pre-initialized browser instances
Expected Performance:
1 request: ~6-8s (baseline)
2 concurrent: ~3-4s each (60-70% faster)
3 concurrent: ~2.5-3.5s each (70-80% faster)
Version Comparison
main_optimized.py(Production): Browser pooling, concurrent optimization, performance trackingmain.py(Legacy): Simple single-browser approach, kept for debugging/fallback
Related MCP server: tradingview-chart-mcp
Features
๐ Optimized Chart Image Tool: Fetches direct chart images with browser pooling for maximum concurrent performance
๐ Performance Statistics: Built-in performance monitoring and statistics
๐ Browser Pool Management: Pre-initialized browser instances for zero-overhead concurrent requests
๐ฏ Natural Language Prompts: Easy chart requests with interval mapping
โ๏ธ Environment Configuration: Fully configurable via environment variables
๐ TradingView Authentication: Secure session-based authentication
๐พ Clipboard Capture: Direct base64 image capture for faster performance
Tools
get_tradingview_chart_image
Description: Fetches the direct image URL for a TradingView chart snapshot with optimized concurrent performance.
Performance: This optimized version achieves 70-80% better performance for concurrent requests using browser pooling technology.
Arguments:
ticker(str): The TradingView ticker symbol (e.g., "BYBIT:BTCUSDT.P", "NASDAQ:AAPL"). Required.interval(str): The chart time interval (e.g., '1', '5', '15', '60', '240', 'D', 'W'). Required.
Returns:
(str): The direct TradingView snapshot image URL (e.g.,
data:image/png;base64,...orhttps://s3.tradingview.com/snapshots/...).
Raises:
Error(MCP type): If the scraper encounters an error. Error codes:400: Input error (invalid ticker/interval format)503: Scraper error (failure during the scraping process)500: Unexpected internal server error
get_performance_stats
Description: Get performance statistics for the optimized TradingView MCP server.
Returns:
Detailed metrics about request performance, improvement over baseline, and browser pool status
Example Output:
๐ OPTIMIZED TRADINGVIEW MCP SERVER PERFORMANCE STATS
โข Total Requests: 12
โข Average Time: 3.30s
โข Performance Improvement: 70.8%
โข Browsers in Pool: 4
โข Max Concurrent: 4Prompts
Get the {interval} chart for {ticker}Maps common timeframe names (e.g., "1 minute", "5 minute", "1 hour", "daily") to TradingView codes
Show me the daily TradingView chart for {ticker}Specifically requests the daily ('D') chart
Fetch TradingView chart image for {ticker} on the {interval} timeframeComprehensive prompt with timeframe mapping
Setup
Create Virtual Environment:
# Navigate to the project directory cd tradingview-chart-mcp # Create the venv (use python3 if python is not linked) python3 -m venv .venvActivate Virtual Environment:
macOS/Linux:
source .venv/bin/activateWindows (Git Bash/WSL):
source .venv/Scripts/activateWindows (Command Prompt):
.venv\\Scripts\\activate.batWindows (PowerShell):
.venv\\Scripts\\Activate.ps1(Note: You might need to adjust PowerShell execution policy:
Set-ExecutionPolicy RemoteSigned -Scope CurrentUser)
Your terminal prompt should now indicate you are in the
(.venv).Install Dependencies (inside venv):
pip install -r requirements.txtConfigure Environment (for Local Testing):
Copy
.env.exampleto.env.Fill in your
TRADINGVIEW_SESSION_IDandTRADINGVIEW_SESSION_ID_SIGNin the.envfile. You can obtain these from your browser's cookies after logging into TradingView.This
.envfile is used when running the server directly (e.g.,python main.py) for local testing.Adjust optional scraper settings (
MCP_SCRAPER_HEADLESS, etc.) in.envif needed for local runs.
Ensure ChromeDriver: Make sure
chromedriveris installed and accessible in your system's PATH, or configure thetview-scraper.pyaccordingly if it allows specifying a path.
Running the Server
Production (Optimized)
python main_optimized.pyLegacy (Simple)
python main.pyCommand Line Options
# HTTP transport with custom port
python main_optimized.py --transport streamable-http --port 8003
# Enable authentication (default for TradingView)
python main_optimized.py --auth
# Adjust concurrency
python main_optimized.py --max-concurrent 6
# Disable browser pooling (fallback to traditional)
python main_optimized.py --disable-pooling๐งช Performance Testing
Agent-Style Testing
Test the server using the same approach as the production agent:
cd tests/
# Sequential performance test
python test_mcp_agent_style.py --runs 5 --ticker BYBIT:BTCUSDT.P --interval 240
# Concurrent performance test
python test_mcp_agent_style.py --concurrent 3 --ticker BYBIT:BTCUSDT.P --interval 240
# Test different symbols and timeframes
python test_mcp_agent_style.py --concurrent 4 --ticker NASDAQ:AAPL --interval 15
python test_mcp_agent_style.py --concurrent 2 --ticker BYBIT:ETHUSDT.P --interval DExpected Results
Sequential: ~6-8s per request (baseline)
Concurrent (3x): ~2.5-3.5s per request (70-80% improvement)
Success Rate: 100% reliability under load
Throughput: Up to 4 concurrent requests efficiently handled
๐ง Technical Details
Browser Pooling Architecture
Pre-initialized Browsers: 4 browser instances ready for immediate use
Thread-Safe Pool: Concurrent access with proper locking
Async Semaphore: Optimal request limiting
Performance Tracking: Real-time statistics and monitoring
Graceful Cleanup: Proper browser lifecycle management
Save Shortcut Feature
The MCP_SCRAPER_USE_SAVE_SHORTCUT feature allows you to capture chart images directly to the clipboard as base64 data URLs:
Benefits:
Faster Performance: No HTTP requests needed
More Reliable: No dependency on TradingView's CDN
Offline Capability: Works once chart is loaded
Direct Integration: Base64 data URLs for immediate use
Configuration:
# Enable clipboard image capture (DEFAULT)
MCP_SCRAPER_USE_SAVE_SHORTCUT=True
# Disable and use traditional screenshot links
MCP_SCRAPER_USE_SAVE_SHORTCUT=FalseUsage Examples
Available Tools:
get_tradingview_chart_image(ticker: str, interval: str): Optimized chart fetching with browser pooling
Example Prompts:
"Get the 15 minute chart for NASDAQ:AAPL"
"Show me the daily chart for BYBIT:BTCUSDT.P"
"Fetch TradingView chart image for COINBASE:ETHUSD on the 60 timeframe"
Deactivating the Virtual Environment
When finished:
deactivate๐ Fallback Options
If you encounter issues with the optimized version:
Disable Browser Pooling:
python main_optimized.py --disable-poolingUse Legacy Version:
python main.pyDebug Mode:
python main_optimized.py --log-level DEBUG
๐ Performance Monitoring
The optimized server includes built-in performance monitoring:
Request success rates
Average response times
Performance improvement metrics
Browser pool utilization
Concurrent request handling statistics
Access these metrics via the get_performance_stats tool or through the server logs.
๐ Using with MCP Clients (Claude Desktop / Cursor)
This server supports two ways of providing configuration:
Via
.envfile (for local testing): When runningpython main.pydirectly, the server will load credentials and settings from a.envfile in the project directory.Via Client Environment Variables (Recommended for Integration): When run by an MCP client (like Claude/Cursor), you should configure the client to inject the required environment variables directly. These will override any values found in a
.envfile.
Claude Desktop
Open your Claude Desktop configuration file:
Windows:
%APPDATA%\\Claude\\claude_desktop_config.jsonmacOS:
~/Library/Application\ Support/Claude/claude_desktop_config.json
Add or merge the following within the
mcpServersobject. Provide your credentials in theenvblock:{ "mcpServers": { "tradingview-chart-mcp": { "command": "/absolute/path/to/your/tradingview-chart-mcp/.venv/bin/python3", "args": ["/absolute/path/to/your/tradingview-chart-mcp/main.py"], "env": { "TRADINGVIEW_SESSION_ID": "YOUR_SESSION_ID_HERE", "TRADINGVIEW_SESSION_ID_SIGN": "YOUR_SESSION_ID_SIGN_HERE" // Optional: Add MCP_SCRAPER_* variables here too if needed // "MCP_SCRAPER_HEADLESS": "False" } } // ... other servers if any ... } }Replace the placeholder paths (
command,args) with your actual absolute paths.Replace
YOUR_SESSION_ID_HEREandYOUR_SESSION_ID_SIGN_HEREwith your actual TradingView credentials.Restart Claude Desktop.
Cursor
Go to:
Settings -> Cursor Settings -> MCP -> Edit User MCP Config (~/.cursor/mcp.json).Add or merge the following within the
mcpServersobject. Provide your credentials in theenvblock:{ "mcpServers": { "tradingview-chart-mcp": { "command": "/absolute/path/to/your/tradingview-chart-mcp/.venv/bin/python3", "args": ["/absolute/path/to/your/tradingview-chart-mcp/main.py"], "env": { "TRADINGVIEW_SESSION_ID": "YOUR_SESSION_ID_HERE", "TRADINGVIEW_SESSION_ID_SIGN": "YOUR_SESSION_ID_SIGN_HERE" // Optional: Add MCP_SCRAPER_* variables here too if needed // "MCP_SCRAPER_HEADLESS": "False" } } // ... other servers if any ... } }Replace the placeholder paths (
command,args) with your actual absolute paths.Replace
YOUR_SESSION_ID_HEREandYOUR_SESSION_ID_SIGN_HEREwith your actual TradingView credentials.Restart Cursor.
Installing via Smithery
To install TradingView Chart Image Scraper for Claude Desktop automatically via Smithery:
npx -y @smithery/cli install @ertugrul59/tradingview-chart-mcp --client claudeConfiguration
Environment Variables
The following environment variables can be set to configure the scraper:
TRADINGVIEW_SESSION_ID: Your TradingView session ID (required)TRADINGVIEW_SESSION_ID_SIGN: Your TradingView session ID signature (required)MCP_SCRAPER_HEADLESS: Run browser in headless mode (default:True)MCP_SCRAPER_WINDOW_WIDTH: Browser window width (default:1400)MCP_SCRAPER_WINDOW_HEIGHT: Browser window height (default:1400)MCP_SCRAPER_USE_SAVE_SHORTCUT: Use clipboard image capture instead of screenshot links (default:True)MCP_SCRAPER_CHART_PAGE_ID: Custom chart page ID (optional)
Save Shortcut Feature
The MCP_SCRAPER_USE_SAVE_SHORTCUT feature allows you to capture chart images directly to the clipboard as base64 data URLs instead of getting screenshot links. This eliminates the need to download images from URLs.
Benefits:
Faster chart capture (no HTTP requests needed)
More reliable (no dependency on TradingView's CDN)
Works offline once the chart is loaded
Direct base64 data URLs for immediate use
How it works:
When enabled (
True): UsesShift+Ctrl+S(orShift+Cmd+Son Mac) to capture chart image directly to clipboardWhen disabled (
False): Uses traditionalAlt+Sto get screenshot links, then converts to image URLs
Configuration:
# Enable clipboard image capture (DEFAULT)
MCP_SCRAPER_USE_SAVE_SHORTCUT=True
# Disable and use traditional screenshot links
MCP_SCRAPER_USE_SAVE_SHORTCUT=FalseThis server cannot be deployed
Maintenance
Related MCP Connectors
> TradingMCP puts a market analyst inside your AI assistant. Paste one URL into Claude, ChatGPT, Cursor, VS Code or any MCP client and ask in plain language: screen for breakouts, run a multi-timeframe analysis, backtest a strategy with walk-forward validation, scan for smart-money and volume signals, or get a one-prompt morning market brief. In clients that support MCP Apps, price charts and the Markets panel are drawn right in the chat. > 40+ tools covering crypto (real-time), stocks, ETFs, FX, futures and commodities across major global exchanges. > Hosted, nothing to install: Pro $9/month (2,500 tool calls) or Pro+ $29/month (10,000). Paid upfront with a 14-day money-back guarantee; your API key arrives right after checkout. > Built on the open-source tradingview-mcp core (MIT, ~5k GitHub stars): self-host it free, or use the hosted version with zero ops. > For research and education, not financial advice. Not affiliated with TradingView
Web scraping, browser automation, screenshots and AI data extraction for AI agents via MCP.
ChartGaze is a service that connects AI assistants to live and historical market data and, with your authorization, to trading-account information and trading actions. It works with MCP-compatible AI tools and supports platforms such as MT5, MT4, cTrader, and crypto exchanges.
SnapRender gives AI agents eyes on the web through a hosted MCP server. Send a public URL and get the page back as an image, a PDF or clean markdown, with no browser to run or maintain. Capture the viewport or the full page as PNG, JPEG, WebP or PDF, at desktop size or with a phone, tablet or laptop preset, in light or dark mode. Ads and cookie banners are removed by default, and you can hide elements or click one before the capture. extract_content reads the same page as markdown, text, article, links or metadata, so an agent can see a page and read it in one session. Made for monitoring and client work: batch up to 50 URLs in one job, check the cache for free before spending a capture, share signed links that render without an API key, and get webhooks when a batch finishes or a scheduled capture spots a change. Track competitors' pricing and landing pages, or send clients current screenshots of their sites. Connect with OAuth (Google, GitHub or email) or an API key. Works with Claude, ChatGPT, Cursor, VS Code and any MCP client. Free plan: 200 screenshots a month, no credit card. Paid plans from $9 a month for 2,000 up to $199 a month for 200,000. Home: https://snap-render.com Docs: https://snap-render.com/ai-agents
Related MCP Servers
- FlicenseNot gradedqualityBmaintenanceEnables users to fetch TradingView chart images for specified tickers and intervals through MCP tools, returning snapshot URLs or base64 image data. It supports browser pooling for concurrent performance, configurable intervals, TradingView authentication, and performance statistics.-
- FlicenseNot gradedqualityAmaintenanceEnables users to retrieve chart snapshot images for specified symbols and timeframes through natural-language prompts, with browser pooling for faster concurrent requests and built-in performance statistics.-
- FlicenseNot gradedqualityAmaintenanceEnables users to fetch TradingView chart snapshot images for any ticker and interval via browser automation, with browser pooling that supports concurrent requests up to 4x faster. Also exposes performance statistics and natural-language prompts for chart retrieval.-
- FlicenseNot gradedqualityAmaintenanceEnables users to retrieve TradingView chart snapshot images for specified tickers and intervals, with browser pooling for concurrent requests and built-in performance statistics. It also supports natural-language chart prompts and configurable scraping/authentication options.-