TradingView Chart MCP server

Captures and shares TradingView chart images with customizable tickers and timeframes through a Selenium-based scraper that converts screenshots to direct image URLs.
Back to servers
Setup instructions
Provider
ertugrul59
Release date
May 08, 2025
Stats
24 stars

This MCP server provides a powerful way to fetch TradingView chart images with optimized browser pooling technology, offering 70-80% better performance for concurrent requests compared to traditional methods.

Installation

Setting Up Your Environment

  1. Create and activate a virtual environment:
# Navigate to the project directory
cd tradingview-chart-mcp

# Create the venv
python3 -m venv .venv

# Activate (macOS/Linux)
source .venv/bin/activate

# Activate (Windows - Command Prompt)
.venv\Scripts\activate.bat

# Activate (Windows - PowerShell)
.venv\Scripts\Activate.ps1
  1. Install dependencies:
pip install -r requirements.txt
  1. Configure environment:

    • Copy .env.example to .env
    • Add your TradingView credentials (session ID and signature)
    • Adjust optional settings if needed
  2. Ensure ChromeDriver is installed and accessible in your system's PATH.

Usage

Running the Server

For optimal performance with browser pooling:

python main_optimized.py

Legacy version (simple approach):

python main.py

Command Line Options

# Custom port
python main_optimized.py --transport streamable-http --port 8003

# Enable authentication
python main_optimized.py --auth

# Adjust concurrency
python main_optimized.py --max-concurrent 6

# Disable browser pooling
python main_optimized.py --disable-pooling

Available Tools

get_tradingview_chart_image

Fetches a TradingView chart image for a specified ticker and interval.

Arguments:

  • ticker (str): TradingView ticker symbol (e.g., "BYBIT:BTCUSDT.P", "NASDAQ:AAPL")
  • interval (str): Chart time interval (e.g., '1', '5', '15', '60', '240', 'D', 'W')

Returns:

  • Direct TradingView snapshot image URL (base64 data URL or hosted image URL)

Example usage:

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

get_performance_stats

Returns detailed performance metrics about the server.

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: 4

Configuration Options

Environment Variables

The server can be configured with these environment variables:

  • 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: 1920)
  • MCP_SCRAPER_WINDOW_HEIGHT: Browser window height (default: 1080)
  • MCP_SCRAPER_USE_SAVE_SHORTCUT: Use clipboard image capture (default: True)
  • MCP_SCRAPER_CHART_PAGE_ID: Custom chart page ID (optional)

Save Shortcut Feature

The MCP_SCRAPER_USE_SAVE_SHORTCUT feature captures chart images directly as base64 data URLs:

# Enable clipboard image capture (DEFAULT)
MCP_SCRAPER_USE_SAVE_SHORTCUT=True

# Disable and use traditional screenshot links
MCP_SCRAPER_USE_SAVE_SHORTCUT=False

Integration with MCP Clients

Claude Desktop

  1. Edit the Claude Desktop configuration file:

    • Windows: %APPDATA%\Claude\claude_desktop_config.json
    • macOS: ~/Library/Application\ Support/Claude/claude_desktop_config.json
  2. Add the following to the mcpServers object:

{
  "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"
      }
    }
  }
}

Cursor

  1. Go to: Settings -> Cursor Settings -> MCP -> Edit User MCP Config
  2. Add the same configuration as shown above for Claude Desktop

Quick Install via Smithery

npx -y @smithery/cli install @ertugrul59/tradingview-chart-mcp --client claude

Troubleshooting

If you encounter issues with the optimized version:

  1. Disable browser pooling:
python main_optimized.py --disable-pooling
  1. Use legacy version:
python main.py
  1. Enable debug mode:
python main_optimized.py --log-level DEBUG

When finished, deactivate your virtual environment:

deactivate

How to install this MCP server

For Claude Code

To add this MCP server to Claude Code, run this command in your terminal:

claude mcp add-json "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"}}'

See the official Claude Code MCP documentation for more details.

For Cursor

There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json file so that it is available in all of your projects.

If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json file.

Adding an MCP server to Cursor globally

To add a global MCP server go to Cursor Settings > Tools & Integrations and click "New MCP Server".

When you click that button the ~/.cursor/mcp.json file will be opened and you can add your server like this:

{
    "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"
            }
        }
    }
}

Adding an MCP server to a project

To add an MCP server to a project you can create a new .cursor/mcp.json file or add it to the existing one. This will look exactly the same as the global MCP server example above.

How to use the MCP server

Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.

The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.

You can also explicitly ask the agent to use the tool by mentioning the tool name and describing what the function does.

For Claude Desktop

To add this MCP server to Claude Desktop:

1. Find your configuration file:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%\Claude\claude_desktop_config.json
  • Linux: ~/.config/Claude/claude_desktop_config.json

2. Add this to your configuration file:

{
    "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"
            }
        }
    }
}

3. Restart Claude Desktop for the changes to take effect

Want to 10x your AI skills?

Get a free account and learn to code + market your apps using AI (with or without vibes!).

Nah, maybe later