TradingViewMCPServerのロゴ

TradingViewMCPServer

コミュニティ
Spoofkapoof

Professional multi-asset trading & Pine Script development MCP server for Claude. Features: 20+ indicators, Pine Script tools (validator, autocomplete, docs, testing), Forex/Stocks/Crypto support

公開者Spoofkapoof
リポジトリTradingViewMCPServer
言語Python
フォーク
16
スター
57
利用可能なツール
0
通信方式stdio
ライセンスMIT
リンク
  • ツールをAIワークフローに接続

    TradingViewMCPServerは、対応するAIクライアントやAIエージェントから利用できるMCP機能を提供します。

  • 0個の利用可能なツール

    呼び出し可能なアクションを以下で確認できます。サーバーから提供されている場合は、名前や説明も表示されます。

  • コピーして使える設定

    セットアップ用の設定例を使って、お好みのMCPクライアントにこのサーバーを設定できます。

  • オープンソースの注目度

    リンク先のリポジトリには57件のスターと16件のフォークがあります。

TradingViewMCPServer

Production-ready multi-asset trading assistant and Pine Script development server for Claude Desktop

Tests Python 3.10+ License: MIT Docker Version

Professional trading assistant supporting Forex, Stocks, and Crypto with 25+ technical indicators, Pine Script v6 development tools, and production-grade reliability.

✨ Features

🎯 Production-Ready (NEW in v3.4.0!)

  • 🏥 Health Monitoring: Built-in health check tool with cache statistics and API status
  • 🔄 Auto-Retry Logic: Exponential backoff for network failures (3 retries: 2s, 4s, 8s)
  • ⚡ LRU Cache: Memory-bounded cache (1000 entries) with automatic eviction
  • 🐳 Docker Support: Production-ready containerization with Docker Compose
  • 🚀 CI/CD Pipeline: Automated testing across Python 3.10-3.12
  • ✅ 100% Test Coverage: 44/44 tests passing

📊 Trading & Market Analysis

  • Multi-Asset Support: Forex (22+ pairs), US Stocks, Cryptocurrencies
  • 25+ Technical Indicators: Volume Profile, Market Profile, VWAP, Fibonacci, Bollinger Bands, MACD, Moving Averages, ATR, Support/Resistance, Pivot Points, Stochastic, RSI, CCI, Williams %R, ADX, Ichimoku Cloud, and more
  • Full Historical Data: Live quotes and historical data for all asset types (Forex, Stocks, Crypto) via Alpha Vantage API
  • Smart Caching: 70% reduction in API calls with intelligent caching
  • Claude Desktop Integration: Seamless integration with Claude Desktop via MCP

Pine Script Development Tools (NEW in v3.1)

  • Pine Script v6 Support: Full support for latest Pine Script v6 with type, enum, and map! ⭐
  • Real-time Syntax Validation: Comprehensive syntax and semantic error checking with line-by-line feedback
  • Intelligent Autocomplete: Context-aware code completion with function signatures and documentation
  • Live Documentation Access: Instant access to Pine Script function documentation with examples (110+ functions)
  • Version Detection: Automatic detection of Pine Script version (v1-v6) with compatibility analysis
  • Version Conversion: Automatic code conversion between Pine Script versions (v3→v4→v5→v6)
  • Code Testing Sandbox: Safe testing environment with validation and performance metrics
  • Error Explanations: Detailed error descriptions with causes, solutions, and code examples
  • Code Templates: Ready-to-use templates for indicators, strategies, and overlays

🚀 Quick Start

Prerequisites

  • Python 3.10+ or Docker
  • Claude Desktop
  • Alpha Vantage API key (Get free key)

Option 1: Docker (Recommended) 🐳

bash
# 1. Clone repository
git clone https://github.com/lev-corrupted/TradingViewMCPServer.git
cd TradingViewMCPServer

# 2. Create .env file
echo "ALPHA_VANTAGE_API_KEY=your_key_here" > .env

# 3. Run with Docker Compose
docker-compose up -d

# 4. Check server health
docker-compose logs -f

Option 2: Standard Installation

bash
# 1. Clone repository
git clone https://github.com/lev-corrupted/TradingViewMCPServer.git
cd TradingViewMCPServer

# 2. Create virtual environment
python3 -m venv .venv
source .venv/bin/activate  # Windows: .venv\Scripts\activate

# 3. Install dependencies
pip install -e .

# 4. Create .env file
echo "ALPHA_VANTAGE_API_KEY=your_key_here" > .env
  1. Configure Claude Desktop:

Edit ~/Library/Application Support/Claude/claude_desktop_config.json (macOS) or %APPDATA%\Claude\claude_desktop_config.json (Windows):

json
{
  "mcpServers": {
    "tradingview": {
      "command": "/absolute/path/to/TradingViewMCPServer/.venv/bin/python",
      "args": [
        "/absolute/path/to/TradingViewMCPServer/tradingview_mcp/server.py",
        "stdio"
      ]
    }
  }
}

Replace /absolute/path/to/TradingViewMCPServer with your actual installation path.

  1. Restart Claude Desktop

💡 Usage

Health Check (NEW!) 🏥

Monitor server health and performance:

Check server health
What's the cache hit rate?
Show me server statistics

Returns:

  • Server version and status
  • API key configuration
  • Cache statistics (size, hit rate, evictions)
  • Total API calls made

Trading & Market Analysis 📊

Ask Claude Desktop natural language questions:

What's the current price of AAPL?
Show me Bollinger Bands for TSLA on 1h timeframe
Calculate Fibonacci levels for BTC
Get MACD for EURUSD with RSI
Show me support and resistance for NVDA
What's the volume profile for SPY?
Give me the Ichimoku Cloud for ETH
Calculate pivot points and CCI for GBPUSD
Analyze AAPL with Williams %R indicator

Pine Script Development

Ask Claude to help with Pine Script code:

Validate this Pine Script code: [paste code]
Convert this v4 code to v5: [paste code]
Show me documentation for ta.macd
Test this indicator on AAPL 1h timeframe: [paste code]
Explain error E101
Detect the version of this Pine Script: [paste code]
Give me a Pine Script strategy template

🛠️ Available Tools

Server Management (NEW in v3.4.0!)

  • health_check - Server health and cache statistics

Price & Market Data

  • get_price - Get current price for any asset
  • get_multiple_prices - Batch price quotes
  • list_available_pairs - List forex pairs
  • list_supported_assets - List all supported assets

Technical Analysis

  • analyze_pair - Comprehensive analysis
  • get_trading_recommendation - Trading signals
  • calculate_correlation - Pair correlation

Volume & Profile Analysis

  • get_volume_profile - Volume at price levels
  • get_market_profile - Market profile with TPO and value areas
  • get_vwap - Volume Weighted Average Price
  • get_volume_nodes - High/low volume nodes
  • detect_unfilled_gaps - Price gaps detection

Momentum Indicators (NEW: RSI, CCI, Williams %R)

  • get_stochastic - Stochastic oscillator (%K, %D)
  • get_rsi - NEW! RSI (Relative Strength Index)
  • get_cci - NEW! CCI (Commodity Channel Index)
  • get_williams_r - NEW! Williams %R

Trend Indicators

  • get_moving_averages - Multiple SMAs/EMAs
  • get_macd - MACD indicator
  • get_adx - Average Directional Index (trend strength)
  • get_ichimoku_cloud - Ichimoku Cloud

Volatility Indicators

  • get_bollinger_bands - Bollinger Bands
  • get_atr - Average True Range

Support/Resistance

  • get_fibonacci_retracement - Fibonacci levels
  • get_support_resistance - Auto-detected levels
  • get_pivot_points - Daily pivot points

Pine Script Development (NEW)

  • validate_pine_script - Real-time syntax validation with detailed error reporting (v1-v6 support)
  • get_pine_documentation - Function and topic documentation with examples (110+ functions)
  • test_pine_script - Safe sandbox testing with metrics
  • explain_pine_error - Detailed error explanations with solutions
  • detect_pine_version - Automatic version detection (v1-v6)
  • convert_pine_version - Automatic version conversion (supports v6!)
  • autocomplete_pine - Intelligent code completion (includes v6 features)
  • get_pine_template - Ready-to-use code templates

Supported Assets

Forex

Major pairs, crosses, exotics, and gold (XAUUSD)

Stocks

US equities including AAPL, MSFT, GOOGL, AMZN, TSLA, NVDA, META, and more

Crypto

BTC, ETH, BNB, XRP, ADA, SOL, and other major cryptocurrencies

Configuration

API Rate Limits

Alpha Vantage free tier:

  • 25 requests per day
  • 5 API calls per minute

For higher limits, upgrade to premium API key.

Timeframes

Supported timeframes: 5m, 15m, 30m, 1h, 4h, 1d

📈 Version History

Version 3.4.0 - Production Ready (Current) 🚀

Major production-grade improvements:

Performance & Reliability

  • ✅ LRU Cache: Memory-bounded cache with automatic eviction (1000 entries max)
  • ✅ Auto-Retry: Exponential backoff for network failures (3 retries: 2s, 4s, 8s)
  • ✅ Health Check: New MCP tool for monitoring and debugging
  • ✅ 100% Tests: All 44 tests passing (was 93%)

Developer Experience

  • ✅ Docker Support: Production-ready Dockerfile and docker-compose.yml
  • ✅ CI/CD Pipeline: Automated testing across Python 3.9-3.12
  • ✅ Requirements: Separate runtime and dev dependencies

Bug Fixes

  • Fixed version mismatch in pyproject.toml
  • Fixed 3 failing tests (ATR, Bollinger Bands, Pine Script v5)
  • Verified .env security (not in git)

Test Results: 44/44 passing (100%) | Files Changed: 12 | Lines Added: 661+

See IMPROVEMENTS_v3.4.0.md for full details.


Version 3.3.0 - New Indicators

  • Added RSI (Relative Strength Index) indicator
  • Added CCI (Commodity Channel Index) indicator
  • Added Williams %R indicator
  • Full historical data support for Stocks and Crypto
  • Updated README: 20+ → 25+ indicators

Version 3.1 - Pine Script v6 Support ⭐

Major update with full Pine Script v6 support:

New Features

  • Pine Script v6: Full support for the latest Pine Script version
  • V6 Data Structures: type (structs), enum, and map collections
  • 110+ Function Signatures: Enhanced function database including map.* namespace
  • Enhanced Conversion: v3→v4→v5→v6 automatic migration
  • 8 Pine Script MCP Tools: Complete development environment
  • 3000+ Lines of Pine Script Code: Lexer, parser, validator, and more
  • Version Support: Full support for Pine Script v1-v6
  • Intelligent Analysis: AST-based parsing and validation
  • Context-aware Completion: Namespace-aware autocomplete (ta., math., str., map.)
  • Error Database: Detailed explanations for common errors

See PINE_SCRIPT.md for complete Pine Script documentation.

Architecture

  • Modular Design: Clear separation between TradingView analysis and Pine Script tools
  • Well-Organized Codebase: Logical grouping by functionality
  • Unified MCP Server: Single installation, seamless integration

See ARCHITECTURE.md for detailed architecture documentation.

Version 3.0 - Pine Script Integration

Initial Pine Script development tools release:

  • 8 comprehensive MCP tools
  • Support for Pine Script v1-v5
  • Automatic code conversion and validation

Version 2.0 Improvements

This version included major improvements and refactoring:

Architecture

  • Modular Structure: Refactored from monolithic 1700-line file to organized modules
    • api/: API client with caching and rate limiting
    • indicators/: Technical indicators organized by type
    • utils/: Utility functions and formatters
    • config.py: Centralized configuration

Performance & Reliability

  • Smart Caching: In-memory cache with TTL reduces API calls by ~70%
  • Rate Limiting: Automatic rate limit protection prevents API errors
  • Improved Error Handling: Standardized error responses with helpful suggestions
  • Comprehensive Logging: Debug and track all operations

Code Quality

  • Type Hints: Full type annotations throughout
  • Better Calculations: Fixed MACD, Stochastic, and ADX formulas
  • Constants: All magic numbers extracted to named constants
  • Test Suite: pytest-based testing framework included

Development

  • Lower Python Requirement: Now works with Python 3.10+ (was 3.13+)
  • Development Tools: Added black, mypy, pytest, and other dev dependencies
  • Better Documentation: Improved docstrings and code comments

API Improvements

  • Universal Asset Detection: Automatically detects Forex, Stocks, or Crypto
  • Better Forex Detection: Handles various formats (EUR/USD, EURUSD, etc.)
  • Cache Statistics: View cache performance with get_server_stats() tool

Testing

Run the test suite:

bash
# Install development dependencies
pip install -r requirements-dev.txt

# Run all tests
pytest

# Run with coverage
pytest --cov=tradingview_mcp --cov-report=html

# Run specific test file
pytest tests/test_cache.py -v

# Run tests matching pattern
pytest -k "test_cache" -v

Troubleshooting

Claude Desktop Not Connecting

  1. Verify config file path is correct
  2. Check Python path in config
  3. Ensure .env file exists with valid API key
  4. Restart Claude Desktop

API Rate Limit Errors

Wait 1 minute between requests or upgrade API key.

Module Import Errors

Ensure virtual environment is activated and dependencies installed:

bash
source .venv/bin/activate
pip install -e .

📁 Repository Structure

TradingViewMCPServer/
├── tradingview_mcp/          # Core Python package
│   ├── server.py            # MCP server implementation
│   ├── config.py            # Configuration management
│   ├── api/                 # Alpha Vantage API client
│   ├── indicators/          # Technical indicators (25+)
│   ├── pine_script/         # Pine Script development tools
│   └── utils/               # Utilities (cache, retry, etc.)
├── tests/                    # Test suite (44/44 passing)
├── docs/                     # Documentation
│   ├── ARCHITECTURE.md      # System architecture
│   ├── CONTRIBUTING.md      # Contribution guidelines
│   ├── PROJECT_SUMMARY.md   # Project overview
│   ├── GITHUB_REPO_INFO.md  # GitHub repo metadata
│   ├── guides/              # Usage guides
│   └── releases/            # Release notes & checklists
├── examples/                 # Example code
│   └── pine-scripts/        # Pine Script examples & templates
├── .github/                  # GitHub Actions CI/CD
├── logs/                     # Application logs
├── README.md                 # This file
├── CHANGELOG.md              # Complete version history
├── pyproject.toml            # Project metadata
├── requirements.txt          # Dependencies
└── Dockerfile                # Docker configuration

Key Directories

  • tradingview_mcp/ - Main Python package with all server logic
  • tests/ - Comprehensive test suite with 100% coverage
  • docs/ - All documentation, guides, and architecture docs
  • examples/pine-scripts/ - Pine Script examples, strategies, and templates
  • .github/ - CI/CD workflows and issue templates

License

MIT License - see LICENSE file for details

Contributing

We welcome contributions! Please see CONTRIBUTING.md for detailed guidelines.

How to Contribute

  • Bug Reports: Use the bug report template
  • Feature Requests: Use the feature request template
  • Code Contributions: Fork, create a branch, and submit a PR
  • Documentation: Improvements to README, code comments, or examples

Contribution Ideas

  • New technical indicators (RSI, CCI, Williams %R, etc.)
  • Performance optimizations
  • Additional asset types or markets
  • Better error handling
  • Enhanced documentation
  • Example use cases

See CONTRIBUTING.md for development setup and coding standards.

Support

For issues or questions:

  1. Check the Troubleshooting section
  2. Review CONTRIBUTING.md
  3. Search existing GitHub Issues
  4. Open a new issue with the appropriate template

TradingViewMCPServerのMCPを複数のAIモデルで活用

TypingMindはワークスペース単位でMCPツールに接続します。そのため、一度TradingViewMCPServerに接続すれば、モデルごとに個別に設定することなく、TypingMind内のさまざまなAIモデルで利用できます。 このMCPは、デバイス上のTypingMind MCPコネクタを通じてローカルで動作します。

ローカルコネクタのセットアップガイド

MCPサーバーが、お使いのコンピューター上のローカルファイル、アプリ、非公開リソースにアクセスする必要がある場合は、この方法を使います。

1

MCP設定を開く

TypingMindで「設定」、「詳細設定」、「MCP」の順に進み、「コネクタを設定」を選択してください。

  1. ブラウザでTypingMindを開いてください。
  2. 設定アイコンをクリックしてください。
  3. 「詳細設定」に移動してください。
  4. 「MCP」セクションを開いてください。
  5. 「コネクタを設定」をクリックし、「このデバイス」を選択してください。
「このデバイス」が選択されたTypingMindのMCPコネクタ設定画面
2

コネクタのコマンドを実行

「このデバイス」を選択し、TypingMindからコマンドをコピーしてターミナルで実行してください。MCPの使用中は、プロセスを実行したままにしてください。

  1. TypingMindに表示されるセットアップコマンドをコピーしてください。
  2. macOSではターミナルを、WindowsではWindows Terminalを開いてください。
  3. コマンドを貼り付けて実行してください。
  4. ターミナルで続行の確認を求められた場合は、パッケージのインストールを承認してください。
  5. MCPツールの使用中は、ターミナルウィンドウを開いたまま、プロセスの実行を継続してください。
3

TradingViewMCPServerをサーバーとして追加

コネクタのステータスが「準備完了」になったら、「サーバーを編集」をクリックし、MCPサーバーの設定を貼り付けてください。

  1. コネクタのステータスが「準備完了」になるまでお待ちください。
  2. 「サーバーを編集」をクリックしてください。
  3. TradingViewMCPServerのMCPサーバー設定を貼り付けてください。
  4. サーバー一覧を保存してください。
  5. コネクタが引き続き使用可能か確認するには、更新してください。
稼働中のサーバーと「サーバーを編集」ボタンが表示されたTypingMindのMCP設定画面
{
  "mcpServers": {
    "tradingviewmcpserver": {
      "command": "npx",
      "args": [
        "-y",
        "<mcp-server-package>"
      ]
    }
  }
}
4

複数のモデルで同じ接続を使用

サーバー一覧を保存し、「プラグイン」を開いてTradingViewMCPServerのMCPツールを有効にしてください。その後、TypingMindで対応するAIモデルを選択し、チャットでツールを使うか、AIエージェントに割り当ててください。

  1. TypingMindの「プラグイン」ページを開いてください。
  2. TradingViewMCPServerのMCPツールを有効にしてください。
  3. チャットを開始し、使用するAIモデルを選択してください。
  4. MCPツールをチャットで使うか、AIエージェントに割り当ててください。
  5. MCPに再接続することなく、必要に応じて別のAIモデルに切り替えられます。
選択したAIモデルと有効なMCPツールを使用したTypingMindのチャット
TradingViewMCPServerを使ってこのタスクを手伝ってもらえますか?
TradingViewMCPServer
はい、読みました。
TradingViewMCPServerで調べた結果をお伝えします。

よくある質問

TradingViewMCPServer MCPサーバーは何に使いますか?

TradingViewMCPServerは、対応するAIクライアントを外部ツールやコンテキストに接続するためのMCPサーバーです。TypingMindでは、このMCPサーバーを一度追加するだけで、AIワークスペース内でそのツールを利用できるようになります。

TypingMindでTradingViewMCPServer MCPを複数のAIモデルと併用できますか?

はい。TypingMindはワークスペース単位でMCPツールに接続するため、モデルごとにMCPサーバーを設定する必要はありません。Claude、ChatGPT、Geminiや、TypingMindで設定したその他のAIモデルでTradingViewMCPServerを利用できます。

TypingMindでTradingViewMCPServer MCPを使うメリットは何ですか?

TypingMindは、複数のAIモデル、プロンプト、プラグイン、AIエージェント、APIキー、MCPツールを1つのワークスペースにまとめられる、LLMチャット向けの優れたフロントエンドです。TradingViewMCPServerを接続すると、TypingMindでチャットのワークフローを整理しながら、お好みのモデルでそのMCPツールを利用できます。

TradingViewMCPServer MCPをTypingMindに接続するにはどうすればよいですか?

TradingViewMCPServerはTypingMindのローカルMCPコネクタ経由で動作します。MCPサーバーがコンピューター上のローカルファイル、デスクトップアプリ、コマンドラインツール、プライベートリソースにアクセスする必要がある場合に最適です。

TypingMindでTradingViewMCPServer MCPのどのようなツールを利用できますか?

TradingViewMCPServerはMCP機能を提供しています。TypingMindのプラグインページで有効にすると、チャットで使用したり、AIエージェントに割り当てたりできます。

TradingViewMCPServer MCPを使うには、APIキーをTypingMindと共有する必要がありますか?

いいえ。TypingMindはローカルファーストの設計で、モデルプロバイダー、APIキー、プロンプト、MCP設定をご自身で管理できます。TradingViewMCPServerで認証が必要な場合は、接続の作成時に、そのMCPサーバーに必要なヘッダー、OAuth設定、またはローカル設定を追加してください。

関連するMCPサーバー

すべて見る

今すぐ自分専用のAIワークスペースを作成

ニュースレターに登録すると、新機能や今後のプレゼント企画のお知らせが届きます👇