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
Provider
ertugrul59
Release date
May 08, 2025
Stats
3 stars

This MCP server provides tools to fetch TradingView chart images based on ticker and interval, allowing you to easily integrate TradingView charts into your applications or workflows.

Installation

Creating a Virtual Environment

# Navigate to the project directory
cd tradingview-chart-mcp
# Create the venv
python3 -m venv .venv

Activating the Virtual Environment

macOS/Linux:

source .venv/bin/activate

Windows (Git Bash/WSL):

source .venv/Scripts/activate

Windows (Command Prompt):

.venv\Scripts\activate.bat

Windows (PowerShell):

.venv\Scripts\Activate.ps1

You may need to adjust PowerShell execution policy: Set-ExecutionPolicy RemoteSigned -Scope CurrentUser

Installing Dependencies

pip install -r requirements.txt

Configuring Environment

  1. Copy .env.example to .env
  2. Add your TradingView credentials:
    • TRADINGVIEW_SESSION_ID
    • TRADINGVIEW_SESSION_ID_SIGN

You can obtain these values from your browser's cookies after logging into TradingView.

ChromeDriver Requirement

Ensure chromedriver is installed and accessible in your system's PATH.

Running the Server

With your virtual environment activated:

python main.py

When finished, deactivate the environment:

deactivate

Usage

The server provides the following tool:

  • get_tradingview_chart_image(ticker: str, interval: str): Fetches the direct image URL for a TradingView chart

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"

Using with MCP Clients

Claude Desktop Integration

  1. Open your 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"
      }
    }
  }
}
  1. Restart Claude Desktop

Cursor Integration

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

Installing via Smithery

For automatic installation with Claude Desktop:

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

Configuration Options

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 setting determines how chart images are captured:

  • When True (default): Uses keyboard shortcuts to capture chart images directly as base64 data URLs
  • When False: Uses traditional screenshot links, then converts to image URLs

Benefits of using the save shortcut include faster capture, more reliable operation, and offline functionality once the chart is loaded.

How to add this MCP server to 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 > MCP and click "Add new global MCP server".

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

{
    "mcpServers": {
        "cursor-rules-mcp": {
            "command": "npx",
            "args": [
                "-y",
                "cursor-rules-mcp"
            ]
        }
    }
}

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 explictly ask the agent to use the tool by mentioning the tool name and describing what the function does.

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