Tradingview Chart MCP

Tradingview Chart MCP

Tradingview Chart MCP

Category
访问服务器

README

MCP Server - TradingView Chart Image Scraper

This MCP server provides tools to fetch TradingView chart images based on ticker and interval.

Setup

  1. 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 .venv
    
  2. Activate 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
      
      (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).

  3. Install Dependencies (inside venv):

    pip install -r requirements.txt
    
  4. Configure Environment (for Local Testing):

    • Copy .env.example to .env.
    • Fill in your TRADINGVIEW_SESSION_ID and TRADINGVIEW_SESSION_ID_SIGN in the .env file. You can obtain these from your browser's cookies after logging into TradingView.
    • This .env file is used when running the server directly (e.g., python main.py) for local testing.
    • Adjust optional scraper settings (MCP_SCRAPER_HEADLESS, etc.) in .env if needed for local runs.
  5. Ensure ChromeDriver: Make sure chromedriver is installed and accessible in your system's PATH, or configure the tview-scraper.py accordingly if it allows specifying a path.

Running the Server

Ensure your virtual environment is activated (source .venv/bin/activate or equivalent).

python main.py

Deactivating the Virtual Environment

When you are finished, you can deactivate the environment:

deactivate

Usage

Once the server is running (within the activated venv), you can interact with it using an MCP client, targeting the TradingView Chart Image server name.

Available Tools:

  • 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 / Cursor)

This server supports two ways of providing configuration:

  1. Via .env file (for local testing): When running python main.py directly, the server will load credentials and settings from a .env file in the project directory.
  2. 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 .env file.

Claude Desktop

  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 or merge the following within the mcpServers object. Provide your credentials in the env block:

    {
      "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 ...
      }
    }
    
  3. Replace the placeholder paths (command, args) with your actual absolute paths.

  4. Replace YOUR_SESSION_ID_HERE and YOUR_SESSION_ID_SIGN_HERE with your actual TradingView credentials.

  5. Restart Claude Desktop.

Cursor

  1. Go to: Settings -> Cursor Settings -> MCP -> Edit User MCP Config (~/.cursor/mcp.json).

  2. Add or merge the following within the mcpServers object. Provide your credentials in the env block:

    {
      "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 ...
      }
    }
    
  3. Replace the placeholder paths (command, args) with your actual absolute paths.

  4. Replace YOUR_SESSION_ID_HERE and YOUR_SESSION_ID_SIGN_HERE with your actual TradingView credentials.

  5. Restart Cursor.

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选