BM

bidouilles/mcp-tradingview-server

开发工具

本页由 AI 翻译,技术细节请以原文为准。 查看原文

26 stars 11 forks 质量 67 趋势 4

一个模型上下文协议(MCP)服务器,提供对TradingView技术指标和市场数据的程序化访问,实现自动化交易分析和策略制定。

概览

FastMCP v2 服务器,通过 tradingview_scraper 库暴露 TradingView 技术指标和 OHLCV 数据。mcp-tradingview 控制台条目驱动 Claude Desktop 或任何 MCP 支持客户端。 1. 安装 uv 和 Python 3.11+ 2.运行安装脚本:./setup.sh - 安装依赖并创建虚拟环境 - 自动配置 Claude Desktop 与 MCP 服务器 3.重启 Claude Desktop 以加载新配置 1. 安装uv和Python 3.11+ 2.uv venv --Python 3.11 & 源代码 .venv/bin/activate 3.uv pip 安装 -e 。4. 配置 Claude 桌面(见下文) - Stdio(Claude默认):uv run mcp-tradingview - SSE 服务:uv run mcp-tradingview --transport sse --host 0.0.0.0 --port 8000 - HTTP 服务: uv run mcp-tradingview --transport http --host 0.0.0.0 --port 8000 --path /mcp FASTMCP_HOST、FASTMCP_PORT和FASTMCP_PATH环境变量在存在时会覆盖绑定设置。

概述(AI 翻译)

FastMCP v2 服务器,通过 tradingview_scraper 库暴露 TradingView 技术指标和 OHLCV 数据。mcp-tradingview 控制台条目驱动 Claude Desktop 或任何支持 MCP 的客户端。

快速启动

自动设置(推荐)

  1. 安装 uv 和 Python 3.11+
  2. 运行设置脚本:./setup.sh
  • 安装依赖并创建虚拟环境
  • 自动配置 Claude Desktop 与 MCP 服务器
  1. 重启 Claude Desktop 以加载新配置

手动设置

  1. 安装 uv 和 Python 3.11+
  2. uv venv --python 3.11 && source .venv/bin/activate
  3. uv pip install -e .
  4. 配置 Claude 桌面(见下文)

跑步

  • Stdio(Claude默认设置):uv run mcp-tradingview
  • SSE服务:uv run mcp-tradingview --transport sse --host 0.0.0.0 --port 8000
  • HTTP 服务:uv run mcp-tradingview --transport http --host 0.0.0.0 --port 8000 --path /mcp

FASTMCP_HOST、FASTMCP_PORT和FASTMCP_PATH环境变量在存在时覆盖绑定设置。

工具

本页由 AI 翻译,技术细节请以原文为准。

README

以下为原文 README 节选,完整内容请查看原文。

MCP TradingView Server

FastMCP v2 server that exposes TradingView technical indicators and OHLCV data through the tradingview_scraper library. The mcp-tradingview console entry powers Claude Desktop or any MCP-aware client.

Quick Start

  1. Install uv and Python 3.11+
  2. Run the setup script: ./setup.sh
    • Installs dependencies and creates virtual environment
    • Automatically configures Claude Desktop with the MCP server
  3. Restart Claude Desktop to load the new configuration

Manual Setup

  1. Install uv and Python 3.11+
  2. uv venv --python 3.11 && source .venv/bin/activate
  3. uv pip install -e .
  4. Configure Claude Desktop (see below)

Running

  • Stdio (Claude default): uv run mcp-tradingview
  • SSE service: uv run mcp-tradingview --transport sse --host 0.0.0.0 --port 8000
  • HTTP service: uv run mcp-tradingview --transport http --host 0.0.0.0 --port 8000 --path /mcp

FASTMCP_HOST, FASTMCP_PORT, and FASTMCP_PATH environment variables override the bind settings when present.

Tools

  • get_indicators(symbol, exchange="BINANCE", timeframe="1h", all_indicators=True, export_result=False) – full TradingView indicator snapshot; returns success, symbol, exchange, timeframe, and an indicators mapping.
  • get_specific_indicators(symbol, indicators, exchange="BINANCE", timeframe="1h", export_result=False) – filters the full snapshot to requested keys (case-insensitive) and echoes requested_indicators.
  • get_historical_data(symbol, exchange="BINANCE", timeframe="1h", max_records=100, export_result=False) – streams OHLCV candles via Streamer, returning records_collected, data, and optional export_file.

Resources & Exports

  • Resource indicators/{symbol} emits a formatted indicator report using get_indicators defaults.
  • When export_result=True, JSON payloads are written to export/; keep large archives out of version control.

Claude Desktop

Add the server to claude_desktop_config.json. Here are the recommended configurations:

Using Claude Code CLI (Easiest)

claude mcp add tradingview -- uvx --from /absolute/path/to/mcp-tradingview-server mcp-tradingview

Or with uv run:

claude mcp add tradingview -- uv run mcp-tradingview --cwd /absolute/path/to/mcp-tradingview-server

Manual Configuration

{
  "mcpServers": {
    "tradingview": {
      "command": "uvx",
      "args": ["--from", "/absolute/path/to/mcp-tradingview-server", "mcp-tradingview"]
    }
  }
}

Alternative with uv run:

{
  "mcpServers": {
    "tradingview": {
      "command": "uv",
      "args": ["run", "mcp-tradingview"],
      "cwd": "/absolute/path/to/mcp-tradingview-server"
    }
  }
}

HTTP Transport

{
  "mcpServers": {
    "tradingview": {
      "command": "uv",
在 GitHub 查看完整 README

安装

uvx --from /absolute/path/to/mcp-tradingview-server mcp-tradingview
新手?先看 mcpskill.org 教程 →

配置

{ "mcpServers": { "tradingview": { "command": "uvx", "args": ["--from", "/absolute/path/to/mcp-tradingview-server", "mcp-tradingview"] } } }