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
46 stars

The TradingView Chart MCP server provides a powerful tool for fetching TradingView chart images with optimized browser pooling technology that delivers 70-80% better performance for concurrent requests. This service allows you to easily retrieve chart snapshots for any ticker and timeframe.

Installation

Setting Up Your Environment

First, create and activate a virtual environment:

# Navigate to the project directory
cd tradingview-chart-mcp

# Create the virtual environment
python3 -m venv .venv

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

# Activate the virtual environment (Windows - Git Bash/WSL)
source .venv/Scripts/activate

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

# Activate the virtual environment (Windows - PowerShell)
.venv\Scripts\Activate.ps1

Install dependencies:

pip install -r requirements.txt

Configuration

Create an environment file by copying the example:

cp .env.example .env

Edit your .env file to include your TradingView credentials:

  • TRADINGVIEW_SESSION_ID: Your TradingView session ID
  • TRADINGVIEW_SESSION_ID_SIGN: Your TradingView session ID signature

These credentials can be obtained from your browser cookies after logging into TradingView.

Running the Server

Production (Optimized Version)

For maximum performance with browser pooling:

python main_optimized.py

Command Line Options

Customize server behavior with these options:

# Use 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

# Debug mode
python main_optimized.py --log-level DEBUG

Using the MCP Server

Available Tools

The server provides these main tools:

get_tradingview_chart_image

Fetches a TradingView chart image for a specific 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:

  • Base64 image data or direct image URL

get_performance_stats

Returns 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

Example Prompts

The server understands natural language chart requests like:

  • "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"

Configuration Options

Environment Variables

Fine-tune behavior with these settings:

  • 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 setting controls how images are captured:

  • When True (default): Captures images directly to clipboard as base64 data
  • When False: Uses traditional screenshot links

Integration with MCP Clients

Claude Desktop Integration

  1. Edit your Claude Desktop configuration file:

    • Windows: %APPDATA%\Claude\claude_desktop_config.json
    • macOS: ~/Library/Application\ Support/Claude/claude_desktop_config.json
  2. Add the server configuration:

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

  1. Go to: Settings -> Cursor Settings -> MCP -> Edit User MCP Config (~/.cursor/mcp.json)
  2. Add the server configuration (same format as Claude Desktop)

Quick Install via Smithery

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

Performance Expectations

  • Single request: ~6-8s (baseline)
  • 2 concurrent requests: ~3-4s each (60-70% faster)
  • 3 concurrent requests: ~2.5-3.5s each (70-80% faster)
  • Maximum efficient concurrency: 4 requests

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