ET

ertugrul59/tradingview-chart-mcp

开发工具

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

104 stars 31 forks 质量 75 趋势 0MIT

ertugrul59/tradingview-chart-mcp 是从 https://github.com/ertugrul59/tradingview-chart-mcp. 导入的 MCP 服务器候选人。

概览

ertugrul59/tradingview-chart-mcp 是从 https://github.com/ertugrul59/tradingview-chart-mcp. 导入的 MCP 服务器候选人。

概述(AI 翻译)

** 🚀 现在通过浏览器池优化,实现70-80%的并发性能提升!**

该MCP服务器提供基于股票行情和区间获取TradingView图表图像的工具,并支持高级浏览器池,以实现最大并发性能。

🔥 性能优化

浏览器池化技术

  • 生产版本:使用main_optimized.py并支持浏览器池,以实现最大并发性能
  • 性能提升:同时请求速度提升70-80%
  • 并发处理:支持最多4个同时请求,浏览器实例已预初始化
  • 预期表现:
  • 1个请求:~6-8(基线)
  • 2个并发:每人3-4秒(快60-70%)
  • 3个并行:每人2.5-3.5秒(快70-80%)

版本对比

  • main_optimized.py(生产):浏览器池化、并发优化、性能跟踪
  • main.py(遗留):简单的单浏览器方法,保留用于调试/备援

特色

  • ** 🚀 优化图表图像工具:** 通过浏览器池提取直接图表图像,以实现最大并发性能
  • ** 📊 性能统计:** 内置性能监控和统计

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

README

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

MCP Server - TradingView Chart Image Scraper

🚀 Now with Browser Pooling Optimization for 70-80% Better Concurrent Performance!

This MCP server provides tools to fetch TradingView chart images based on ticker and interval with advanced browser pooling for maximum concurrent performance.

🔥 Performance Optimizations

Browser Pooling Technology

  • Production Version: Uses main_optimized.py with browser pooling for maximum concurrent performance
  • Performance Improvement: 70-80% faster for concurrent requests
  • Concurrent Handling: Supports up to 4 simultaneous requests with pre-initialized browser instances
  • Expected Performance:
    • 1 request: ~6-8s (baseline)
    • 2 concurrent: ~3-4s each (60-70% faster)
    • 3 concurrent: ~2.5-3.5s each (70-80% faster)

Version Comparison

  • main_optimized.py (Production): Browser pooling, concurrent optimization, performance tracking
  • main.py (Legacy): Simple single-browser approach, kept for debugging/fallback

Features

  • 🚀 Optimized Chart Image Tool: Fetches direct chart images with browser pooling for maximum concurrent performance
  • 📊 Performance Statistics: Built-in performance monitoring and statistics
  • 🔄 Browser Pool Management: Pre-initialized browser instances for zero-overhead concurrent requests
  • 🎯 Natural Language Prompts: Easy chart requests with interval mapping
  • ⚙️ Environment Configuration: Fully configurable via environment variables
  • 🔐 TradingView Authentication: Secure session-based authentication
  • 💾 Clipboard Capture: Direct base64 image capture for faster performance

Tools

get_tradingview_chart_image

Description: Fetches the direct image URL for a TradingView chart snapshot with optimized concurrent performance.

Performance: This optimized version achieves 70-80% better performance for concurrent requests using browser pooling technology.

Arguments:

  • ticker (str): The TradingView ticker symbol (e.g., “BYBIT:BTCUSDT.P”, “NASDAQ:AAPL”). Required.
  • interval (str): The chart time interval (e.g., ‘1’, ‘5’, ‘15’, ‘60’, ‘240’, ‘D’, ‘W’). Required.

Returns:

  • (str): The direct TradingView snapshot image URL (e.g., data:image/png;base64,... or https://s3.tradingview.com/snapshots/...).

Raises:

  • Error (MCP type): If the scraper encounters an error. Error codes:
    • 400: Input error (invalid ticker/interval format)
    • 503: Scraper error (failure during the scraping process)
    • 500: Unexpected internal server error

get_performance_stats

在 GitHub 查看完整 README

安装

npx -y @smithery/cli install @ertugrul59/tradingview-chart-mcp --client claude
新手?先看 mcpskill.org 教程 →

配置

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