TradingView MCP Server logo

TradingView MCP Server

Community
jaipreet15

tradingview mcp that exposes tradingview market data, multi-exchange scanners and ai backtesting engine to AI assistants and tradingview mcp automation tools

Publisherjaipreet15
Repositorytradingview-mcp
LanguageTypeScript
Forks
206
Stars
150
Available tools
0
Transport typestdio
Categories
LicenseMIT
Links
  • Connect tools to AI workflows

    TradingView MCP Server exposes MCP capabilities that can be used by compatible AI clients and agents.

  • 0 available tools

    Browse the callable actions below, including names and descriptions when provided by the server.

  • Ready-to-copy setup

    Use the installation snippets to configure this server in your preferred MCP client.

  • Open source signals

    150 stars and 206 forks from the linked repository.

TradingView MCP Server

A production-oriented Model Context Protocol server that exposes TradingView market data, multi-exchange screeners, technical analysis, sentiment, news, and a built-in backtesting engine to AI assistants and automation tools.

Disclaimer: Independent open-source project — not affiliated with TradingView Inc. Outputs are for research and education only, not financial advice.


Table of Contents


Feature Highlights

CapabilityDetails
Multi-exchange screenersCrypto, US equities, EGX, BIST, HKEX, SSE, TWSE, and more via static symbol lists + TradingView scanner API
Technical analysisBollinger ratings, RSI, multi-timeframe alignment, volume breakouts, candle patterns
Backtesting9 strategies with Sharpe, Calmar, walk-forward overfitting detection
Market intelligenceReddit sentiment, RSS financial news, Yahoo Finance quotes
ResilienceRetry/backoff, in-memory + optional distributed cache, structured error envelopes
MCP-native36 tools, stdio transport, works with Claude Desktop, Cursor, Copilot, and other MCP clients

Architecture

mermaid
flowchart TB
  subgraph clients [MCP Clients]
    Claude[Claude Desktop]
    Cursor[Cursor IDE]
    Other[Other MCP Hosts]
  end

  subgraph server [tradingview-mcp-server]
    Router[MCP Tool Router]
    Config[Zod Config Loader]
    Logger[Structured Logger]

    subgraph services [Service Layer]
      Screener[Screener Service]
      Scanner[Volume Scanner]
      Backtest[Backtest Engine]
      Yahoo[Yahoo Finance]
      Sentiment[Reddit Sentiment]
      News[RSS News]
      EGX[EGX Tools]
      Futures[Futures Tools]
    end

    subgraph persistence [Persistence]
      Memory[In-Memory Cache]
      Redis[(Redis Cache)]
    end

    Provider[Screener Provider\nretry + throttle]
  end

  subgraph external [External APIs]
    TV[scanner.tradingview.com]
    YF[Yahoo Finance Chart API]
    Reddit[Reddit JSON API]
    RSS[Financial RSS Feeds]
  end

  Claude --> Router
  Cursor --> Router
  Other --> Router
  Router --> services
  Config --> services
  Logger --> services
  Screener --> Provider
  Scanner --> Provider
  Provider --> Memory
  Provider --> Redis
  Provider --> TV
  Yahoo --> YF
  Sentiment --> Reddit
  News --> RSS
  Backtest --> YF

Layer responsibilities

  1. MCP router (src/server.ts) — validates inputs, delegates to services, returns JSON payloads.
  2. Services — domain logic with no MCP dependencies; independently testable.
  3. Screener provider — HTTP client with retry, jitter, throttling, and cache integration.
  4. Persistence — optional Redis-backed cache with graceful fallback to in-memory storage.

Workflows

Screener request flow

mermaid
sequenceDiagram
  participant Client as MCP Client
  participant Server as MCP Server
  participant Cache as Cache Store
  participant TV as TradingView Scanner

  Client->>Server: top_gainers(exchange, timeframe)
  Server->>Cache: lookup cache key
  alt cache hit
    Cache-->>Server: cached rows
  else cache miss
    Server->>TV: POST /{market}/scan
    TV-->>Server: indicator columns
    Server->>Cache: store result
  end
  Server-->>Client: JSON rows or error envelope

Combined analysis flow

mermaid
sequenceDiagram
  participant Client as MCP Client
  participant Server as MCP Server
  participant TA as Technical Service
  participant Sent as Sentiment Service
  participant News as News Service

  Client->>Server: combined_analysis(symbol)
  par Parallel fetches
    Server->>TA: coin_analysis
    Server->>Sent: market_sentiment
    Server->>News: financial_news
  end
  TA-->>Server: technical payload
  Sent-->>Server: Reddit score
  News-->>Server: headlines
  Server-->>Client: confluence summary

Project Structure

tradingview-mcp/
├── src/
│   ├── index.ts              # CLI entry point
│   ├── server.ts             # MCP tool registration
│   ├── config/               # Environment validation (Zod)
│   ├── core/                 # Errors, shared types
│   ├── indicators/           # Pure indicator math + metrics
│   ├── persistence/          # Redis connection + cache store
│   ├── services/             # Domain services
│   │   ├── screener/         # TradingView scanner integration
│   │   ├── scanner/          # Volume breakout scanners
│   │   ├── backtest.ts       # Strategy backtesting
│   │   ├── yahoo-finance.ts  # Price quotes + OHLCV
│   │   ├── sentiment.ts      # Reddit analysis
│   │   ├── news.ts           # RSS aggregation
│   │   ├── egx.ts            # Egyptian Exchange tools
│   │   └── futures.ts        # Futures overview tools
│   ├── utils/                # Validators, HTTP, logging
│   └── data/coinlist/        # Per-exchange symbol lists
├── tests/unit/               # Vitest unit tests
├── docs/AUDIT.md             # Pre-migration audit notes
├── .env.example              # Configuration reference
├── package.json
├── tsconfig.json
└── tsup.config.ts

Design decisions:

  • Strict TypeScript — strict, noUnusedLocals, noUncheckedIndexedAccess enabled.
  • Service isolation — MCP layer contains zero business logic.
  • Cache abstraction — Redis is optional; server runs without it.
  • Structured errors — stable ErrorCode strings for programmatic handling.

Installation

Requirements

  • Node.js 18+
  • npm 9+
  • (Optional) Redis 6+ for distributed caching

Setup

bash
git clone https://github.com/your-org/tradingview-mcp.git
cd tradingview-mcp
npm install
npm run build

Claude Desktop

json
{
  "mcpServers": {
    "tradingview": {
      "command": "node",
      "args": ["D:/path/to/tradingview-mcp/dist/index.js"]
    }
  }
}

Cursor / VS Code MCP

Point your MCP configuration at the built dist/index.js binary. Restart the host after changes.

Docker (with Redis)

bash
docker compose up -d

Configuration

Copy .env.example to .env:

VariableDefaultDescription
LOG_LEVELinfoLogging verbosity
REDIS_ENABLEDfalseEnable distributed cache
REDIS_URL—Full Redis connection URL
REDIS_HOST127.0.0.1Redis host when URL not set
REDIS_PORT6379Redis port
REDIS_KEY_PREFIXtradingview-mcp:Key namespace prefix
TRADINGVIEW_MCP_CACHE_TTL60Fresh cache TTL (seconds)
TRADINGVIEW_MCP_STALE_TTL21600Stale fallback TTL (seconds)
TRADINGVIEW_MCP_RETRY_DELAYS1.0,4.0Retry backoff schedule
TRADINGVIEW_MCP_MAX_INFLIGHT2Concurrent TA request cap
PROXY_ENABLEDfalseEnable rotating HTTP proxy

See .env.example for the complete list.


Development

bash
# Watch mode
npm run dev

# Type check
npm run typecheck

# Lint
npm run lint

# Full validation pipeline
npm run validate

Adding a new MCP tool

  1. Implement logic in src/services/.
  2. Register the tool in src/server.ts with Zod parameter schema.
  3. Add unit tests under tests/unit/.
  4. Run npm run validate.

Testing

bash
npm test              # run once
npm run test:watch    # watch mode

Current coverage focuses on:

  • Structured error envelopes
  • Timeframe/exchange validators
  • Cache store behavior

Integration tests against live TradingView/Yahoo APIs are intentionally excluded to keep CI deterministic.


Troubleshooting

Empty screener results vs errors

SymptomMeaningAction
[] empty arrayNo symbols matched filters todayNormal — adjust filters
{"error":{"code":"ALL_BATCHES_FAILED"}}Upstream failureWait and retry; check network
Timeout messagesScanner slow or rate-limitedReduce batch size; enable cache

Redis connection failures

The server degrades gracefully — if Redis is unreachable at startup, in-memory caching is used automatically. Check REDIS_URL, firewall rules, and that Redis accepts connections.

Windows MCP timeout on first launch

Pre-build the project (npm run build) before configuring your MCP host so the server starts instantly:

bash
npm install && npm run build

Node version errors

Requires Node 18+. Verify with node --version.


Contributing

  1. Fork the repository and create a feature branch.
  2. Follow existing TypeScript conventions and strict compiler settings.
  3. Keep MCP handlers thin — put logic in services.
  4. Add tests for non-trivial changes.
  5. Run npm run validate before opening a PR.
  6. Write clear commit messages describing why, not just what.

FAQ

Does this require a TradingView account?
No. The server uses public scanner and chart endpoints. No login or API key is needed.

Can I run without Redis?
Yes. Set REDIS_ENABLED=false (default). Caching uses in-memory storage only.

Which exchanges are supported?
Any exchange with a symbol list in src/data/coinlist/ and a TradingView scanner market mapping in src/utils/validators.ts.

Are backtest results guaranteed?
No. Backtests use historical Yahoo Finance data with simulated costs. Past performance does not predict future results.

How do I handle rate limits?
Tune TRADINGVIEW_MCP_MAX_INFLIGHT, TRADINGVIEW_MCP_MIN_INTERVAL_S, and enable Redis caching to reduce duplicate upstream calls.

Is this financial advice?
No. This software is an informational tool. Consult a licensed professional before making financial decisions.


License

MIT — see LICENSE.

Installation

TypingMind
{
  "mcpServers": {
    "tradingview-mcp": {
      "command": "docker",
      "args": [
        "compose",
        "up",
        "-d"
      ]
    }
  }
}

Use TradingView MCP Server MCP with multiple AI models

TypingMind connects MCP tools at the workspace level, so once TradingView MCP Server is connected, you can use it with different AI models in TypingMind instead of setting it up separately for each model. This MCP runs locally through the TypingMind MCP connector on your device.

Setup guide to use the local connector

Use this when the MCP server needs access to local files, apps, or private resources on your computer.

1

Open the MCP settings

In TypingMind, go to Settings, Advanced Settings, then Model Context Protocol and choose Setup Connector.

  1. Open TypingMind in your browser.
  2. Click the Settings icon.
  3. Go to Advanced Settings.
  4. Open the Model Context Protocol section.
  5. Click Setup Connector and choose This Device.
TypingMind MCP connector setup screen with This Device selected
2

Run the connector command

Choose This Device, copy the command from TypingMind, and run it in Terminal. Keep the process running while you use MCP.

  1. Copy the setup command shown by TypingMind.
  2. Open Terminal on macOS or Windows Terminal on Windows.
  3. Paste and run the command.
  4. Approve the package install if Terminal asks you to proceed.
  5. Keep the Terminal window running while using MCP tools.
3

Add TradingView MCP Server as a server

When the connector status is Ready, click Edit Servers and paste the MCP server configuration.

  1. Wait until the connector status shows Ready.
  2. Click Edit Servers.
  3. Paste the TradingView MCP Server MCP server configuration.
  4. Save the server list.
  5. Refresh if you want to confirm the connector is still ready.
TypingMind MCP settings showing active server and Edit Servers button
{
  "mcpServers": {
    "tradingview-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "tradingview-mcp-server"
      ]
    }
  }
}
4

Use it across models

Save the server list, open Plugins, enable the TradingView MCP Server MCP tools, then select any supported AI model in TypingMind and use the tools in chat or assign them to an AI agent.

  1. Open the Plugins page in TypingMind.
  2. Enable the TradingView MCP Server MCP tools.
  3. Start a chat and choose the AI model you want to use.
  4. Use the MCP tools in chat or assign them to an AI agent.
  5. Switch to another AI model whenever needed without reconnecting MCP.
TypingMind chat using enabled MCP tools with a selected AI model
Can you use TradingView MCP Server to help me with this task?
TradingView MCP Server
Sure. I read it.
Here is what I found using TradingView MCP Server.

Frequently asked questions

What is the TradingView MCP Server MCP server used for?

TradingView MCP Server is an MCP server that lets compatible AI clients connect to external tools and context. In TypingMind, you can add this MCP server once and make its tools available in your AI workspace.

Can I use TradingView MCP Server MCP with multiple AI models in TypingMind?

Yes. TypingMind connects MCP tools at the workspace level, so you can use TradingView MCP Server with different AI models such as Claude, ChatGPT, Gemini, or other models you have configured in TypingMind without setting up the MCP server separately for each model.

Why use TradingView MCP Server MCP with TypingMind?

TypingMind is one of the best frontends for LLM chat because it brings multiple AI models, prompts, plugins, AI agents, API keys, and MCP tools into one workspace. With TradingView MCP Server connected, you can use its MCP tools across your preferred models while keeping your chat workflow organized in TypingMind.

How do I connect TradingView MCP Server MCP to TypingMind?

TradingView MCP Server runs through the TypingMind local MCP connector. This is best when the MCP server needs access to local files, desktop apps, command-line tools, or private resources on your computer.

What tools does TradingView MCP Server MCP provide in TypingMind?

TradingView MCP Server exposes MCP capabilities that can be enabled from the TypingMind Plugins page and used in chat or assigned to AI agents.

Do I need to share my API keys with TypingMind to use TradingView MCP Server MCP?

No. TypingMind is local-first and lets you keep your model providers, API keys, prompts, and MCP configuration under your control. If TradingView MCP Server requires authentication, add the required headers, OAuth settings, or local configuration for that MCP server when you create the connection.

Related MCP Servers

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇