Unofficial MCP server and CLI for TradingView's market screener API — stocks, forex, crypto & ETFs.
Two modes, one package: Use as an MCP server with Claude, or as a standalone CLI tool that pipes to jq, csvtool, or any Unix workflow.
- Features
- Installation
- CLI Usage
- Configuration
- MCP Tools
- Screening Fields
- Pre-built Strategies
- Investor Commands
- Operators
- Development
- Disclaimer
- Dual mode: MCP + CLI — use as an MCP server with Claude or as a standalone
tradingview-clicommand - 100+ screener fields including Piotroski F-Score, Altman Z-Score, Graham Number, analyst consensus, and dividend growth streaks
- 18 filter operators including
crosses_above/crosses_belowfor golden cross detection - 14 pre-built strategies covering value, growth, quality, GARP, deep value, breakouts, compounders, and macro monitoring
- Symbol discovery — search for TradingView symbols by name, ticker, or description via
search_symbols - Technical analysis — TradingView-style buy/sell/neutral summaries and multi-timeframe TA ranking via
get_ta_summaryandrank_by_ta - Market metadata — discover available screener fields per market via
get_market_metainfo - 9 investor workflow commands — from
/due-diligenceto/macro-dashboard— built on top of the MCP tools - Multi-asset coverage — stocks, ETFs, forex, and crypto with asset-specific field discovery via
list_fields - Smart caching and rate limiting — configurable TTL and requests-per-minute to keep usage responsible
npm install -g tradingview-mcp-servergit clone https://github.com/fiale-plus/tradingview-mcp-server.git
cd tradingview-mcp-server
npm install
# Quick setup — creates project-level MCP config
./local-setup.sh # Linux/Mac
local-setup.bat # Windows
# Restart Claude Code and try: /market-regime or /run-screenerAfter installing the package, the tradingview-cli command is available globally:
# List all pre-built screening strategies
tradingview-cli presets
# Screen stocks using a preset
tradingview-cli screen stocks --preset quality_stocks --limit 10
# Screen with custom filters
tradingview-cli screen stocks --filters '[{"field":"price_earnings_ttm","operator":"less","value":15}]'
# Look up specific symbols (indexes, stocks)
tradingview-cli lookup NASDAQ:AAPL TVC:SPX NYSE:MSFT
# Discover available screening fields
tradingview-cli fields --asset-type stock --category fundamental
# Search for a symbol
tradingview-cli search apple --exchange NASDAQ
# Get market metadata
tradingview-cli metainfo america --fields name,close,market_cap_basic
# Technical analysis summary
tradingview-cli ta NASDAQ:AAPL NASDAQ:NVDA
# Rank symbols by TA score
tradingview-cli rank-ta NASDAQ:AAPL NASDAQ:MSFT NASDAQ:NVDA --timeframes 60,1D --weights '{"1D":3}'# JSON (default) — pipe to jq
tradingview-cli screen stocks --preset value_stocks | jq '.stocks[].name'
# CSV — pipe to file or csvtool
tradingview-cli screen stocks --preset value_stocks -f csv > results.csv
# Table — human-readable terminal output
tradingview-cli screen stocks --preset value_stocks -f table| Command | Description |
|---|---|
screen stocks [opts] |
Screen stocks by fundamental/technical criteria |
screen forex [opts] |
Screen forex pairs |
screen crypto [opts] |
Screen cryptocurrencies |
screen etf [opts] |
Screen ETFs |
lookup <symbols...> |
Look up specific symbols by ticker |
search <query> [opts] |
Search for symbols by name, ticker, or description |
metainfo <market> [opts] |
Get metadata about a market screener |
ta <symbols...> [opts] |
Get technical analysis summary for symbols |
rank-ta <symbols...> [opts] |
Rank symbols by weighted TA scores |
fields [opts] |
List available screening fields |
preset <name> |
Get a preset strategy's details |
presets |
List all available presets |
| Flag | Description |
|---|---|
--filters <json> |
Filter array as JSON string |
--preset <name> |
Load a preset (merges with --filters) |
--markets <market> |
Market to screen (repeatable, stocks/etf only) |
--sort-by <field> |
Sort by field |
--sort-order <asc|desc> |
Sort direction |
--limit <n> |
Max results (1-200, default 20) |
--columns <col> |
Columns to include (repeatable) |
-f, --format <fmt> |
Output: json, csv, or table |
Add to ~/Library/Application Support/Claude/claude_desktop_config.json on Mac:
{
"mcpServers": {
"tradingview": {
"command": "npx",
"args": ["-y", "tradingview-mcp-server"]
}
}
}Create .mcp.json in your project root:
{
"mcpServers": {
"tradingview": {
"command": "npx",
"args": ["-y", "tradingview-mcp-server"]
}
}
}Enable in .claude/settings.local.json:
{
"enableAllProjectMcpServers": true
}| Variable | Default | Description |
|---|---|---|
CACHE_TTL_SECONDS |
300 |
How long to cache API responses (seconds) |
RATE_LIMIT_RPM |
10 |
Maximum API requests per minute |
Twelve tools are exposed to Claude:
| Tool | Description | Key Parameters |
|---|---|---|
screen_stocks |
Screen stocks by fundamental and technical criteria | filters, markets, sort_by, limit, columns |
screen_forex |
Screen forex pairs by technical criteria | filters, sort_by, limit |
screen_crypto |
Screen cryptocurrencies by market and technical criteria | filters, sort_by, limit |
screen_etf |
Screen ETFs by performance and technical criteria | filters, markets, sort_by, limit |
lookup_symbols |
Direct lookup by ticker — required for indexes like TVC:SPX |
symbols (up to 100), columns |
list_fields |
Discover available fields for any asset type | asset_type (stock, forex, crypto, etf), category |
search_symbols |
Search for symbols by name, ticker, or description | query, exchange, asset_type, limit |
get_market_metainfo |
Get metadata about a market screener and available fields | market, fields, mode (summary/raw) |
get_ta_summary |
TradingView-style technical analysis summary (buy/sell/neutral) | symbols, timeframes, include_components |
rank_by_ta |
Rank symbols by weighted TA scores across timeframes | symbols, timeframes, weights |
get_preset |
Retrieve a pre-configured screening strategy by key | preset_name |
list_presets |
List all available preset strategies with descriptions | — |
All screening tools accept filters in this shape:
{ "field": "return_on_equity", "operator": "greater", "value": 15 }
{ "field": "RSI", "operator": "in_range", "value": [40, 65] }
{ "field": "SMA50", "operator": "crosses_above", "value": "SMA200" }
{ "field": "exchange", "operator": "in_range", "value": ["NASDAQ", "NYSE"] }Cross-field comparison (second example above) enables golden cross / death cross detection without needing a value on the right-hand side.
Use search_symbols to find exact TradingView identifiers before screening:
// Search for Apple
{ "query": "apple" }
// Narrow by exchange and type
{ "query": "bitcoin", "exchange": "BINANCE", "asset_type": "crypto" }Returns normalized symbols with exchange, type, and currency.
Use get_market_metainfo to discover available fields for a market:
// All fields for US stocks
{ "market": "america" }
// Specific fields only
{ "market": "america", "fields": ["name", "close", "market_cap_basic"] }
// Raw passthrough for debugging
{ "market": "america", "mode": "raw" }Use get_ta_summary for TradingView-style buy/sell/neutral labels:
// Single symbol, default timeframes (60m, 4H, 1D, 1W)
{ "symbols": ["NASDAQ:AAPL"] }
// Multiple symbols with custom timeframes
{ "symbols": ["NASDAQ:AAPL", "NASDAQ:NVDA"], "timeframes": ["60", "240", "1D", "1W"] }Returns labels (strong_buy, buy, neutral, sell, strong_sell) plus raw scores based on oscillators and moving averages.
Use rank_by_ta to compare symbols by weighted technical alignment:
// Equal-weight ranking
{ "symbols": ["NASDAQ:AAPL", "NASDAQ:MSFT", "NASDAQ:NVDA"] }
// Weight daily timeframe 3x more
{ "symbols": ["NASDAQ:AAPL", "NASDAQ:MSFT"], "weights": { "1D": 3, "1W": 2 } }Returns ranked list with per-timeframe breakdown and weighted average score.
Use list_fields to browse fields. Pass asset_type to get tailored lists for each asset class.
Valuation
price_earnings_ttm, price_book_fq, price_sales_current, enterprise_value_current, enterprise_value_ebitda_ttm, enterprise_value_to_ebit_ttm, price_earnings_growth_ttm (PEG), ebitda
Profitability & Returns
return_on_equity, return_on_assets, return_on_invested_capital_fq, gross_margin_ttm, operating_margin_ttm, net_margin_ttm, after_tax_margin, pre_tax_margin_ttm, free_cash_flow_margin_ttm
Growth
total_revenue_yoy_growth_ttm, earnings_per_share_diluted_yoy_growth_ttm, revenue_per_share_ttm, total_revenue, net_income, earnings_per_share_diluted_ttm
Balance Sheet
debt_to_equity, total_debt, total_assets, current_ratio, free_cash_flow_ttm, free_cash_flow_fq
Dividends
dividend_yield_recent, dividends_yield_current, dividend_payout_ratio_ttm, continuous_dividend_payout_years, dps_yoy_growth_ttm
Composite Scores (unique differentiators)
| Field | Description |
|---|---|
piotroski_f_score_ttm |
0–9 financial strength composite. Score ≥7 = strong, ≤2 = weak |
altman_z_score_ttm |
Bankruptcy predictor. >2.99 = safe, 1.81–2.99 = grey zone, <1.81 = distress |
graham_numbers_ttm |
Intrinsic value = sqrt(22.5 × EPS × BVPS). Price below = undervalued |
Analyst Data
Recommend.All (composite −1 to +1), analyst_recommendations_buy, analyst_recommendations_sell, analyst_recommendations_neutral, price_target_average, price_target_high, price_target_low
Technical
RSI, SMA50, SMA200, EMA10, VWAP, ATR, ADX, Volatility.M, beta_1_year, beta_3_year, beta_5_year, Recommend.MA, Recommend.Other
Performance & Price Levels
close, change, volume, average_volume_90d_calc, average_volume_30d_calc, relative_volume_10d_calc, Perf.5D, Perf.W, Perf.1M, Perf.3M, Perf.6M, Perf.Y, Perf.YTD, Perf.3Y, Perf.5Y, Perf.10Y, Perf.All, price_52_week_high, price_52_week_low, all_time_high, all_time_low, High.All
Metadata
sector, industry, exchange, market, is_primary, indexes, fundamental_currency_code, earnings_release_next_trading_date_fq
expense_ratio, shares_outstanding, dividends_yield_current, close, volume, Perf.W through Perf.Y, RSI, ATR
close, change, volume, market_cap_basic, RSI, ATR, Volatility.M, Perf.W through Perf.Y
close, change, volume, RSI, ATR, ADX, Volatility.D, SMA50, SMA200, Perf.W through Perf.3M
Retrieve any preset with get_preset or browse all with list_presets.
| Key | Name | Style | What It Screens For |
|---|---|---|---|
quality_stocks |
Quality Stocks (Conservative) | Quality | ROE >12%, low debt, low volatility, golden cross |
value_stocks |
Value Stocks | Value | P/E <15, P/B <1.5, ROE >10% |
dividend_stocks |
Dividend Stocks | Income | Yield >3%, large cap, D/E <1.0 |
momentum_stocks |
Momentum Stocks | Momentum | RSI 50–70, golden cross, 1M performance >5% |
growth_stocks |
Growth Stocks | Growth | ROE >20%, operating margin >15% |
quality_growth_screener |
Quality Growth Screener | Quality + Growth | 16 filters: ROE, margins, revenue growth, technicals, exchange filter |
quality_compounder |
Quality Compounders (Munger/Buffett) | Compounder | Gross margin >40%, ROIC >15%, FCF margin >15%, growing revenue |
garp |
GARP (Growth at Reasonable Price) | GARP | PEG <2, ROE >15%, revenue growth >10% |
deep_value |
Deep Value (Contrarian) | Deep Value | P/E <10, P/B <1.5, positive FCF |
breakout_scanner |
Breakout Scanner | Momentum | Near 52-week high, golden cross, RSI 50–75, above-average volume |
earnings_momentum |
Earnings Momentum | Earnings | EPS growth YoY >20%, revenue growth >10%, RSI 45–70 |
dividend_growth |
Dividend Growth (Compounding Income) | Dividend Growth | Yield 1–6%, payout ratio <70%, positive FCF, consecutive years paying |
macro_assets |
Macro Asset Monitor | Macro | VIX, DXY, 10Y yield, Gold, WTI Oil, Bitcoin — direct symbol lookup |
market_indexes |
Global Market Indexes | Market Regime | 13 global indexes (US, Europe, Asia, Nordic) with ATH and performance data |
The repository ships with 9 ready-to-use Claude Code commands in .claude/commands/. Clone the repo and run ./local-setup.sh to activate them.
| Command | Usage | What It Does |
|---|---|---|
/market-regime |
/market-regime |
Analyzes Nasdaq, OMX Stockholm 30, and Nikkei 225 vs ATH. Shows drawdown, RSI, and bull/correction/bear regime status |
/run-screener |
/run-screener |
Interactive wizard to pick a preset strategy, run it, display a compact table, and save results to CSV |
/due-diligence |
/due-diligence AAPL |
Structured due diligence report: valuation, quality, growth, balance sheet, dividends, technicals, performance, and checklist assessment |
/compare-peers |
/compare-peers AAPL MSFT GOOGL |
Side-by-side comparison of 2–5 stocks across valuation, quality, growth, and momentum with category rankings |
/sector-rotation |
/sector-rotation |
Screens top stocks in all 11 GICS sectors, calculates average performance, assigns Accelerating/Decelerating signals, and recommends a preset |
/smart-screen |
/smart-screen |
Determines current market regime (bull/correction/bear) from SPX, then auto-selects and runs the most appropriate preset |
/macro-dashboard |
/macro-dashboard |
Multi-asset snapshot: US and global indexes, VIX, DXY, 10Y yield, Gold, Oil, BTC with auto-interpreted macro signals |
/portfolio-risk |
/portfolio-risk AAPL MSFT JPM XOM |
Portfolio concentration risk, sector breakdown, beta analysis, and diversification recommendations |
/investment-thesis |
/investment-thesis NVDA |
Data-driven investment thesis with bull/bear case, key metrics table, technical setup, entry/exit framework, and monitoring checklist |
All screening tools support the following operators in filter conditions:
| Operator | Description | Example |
|---|---|---|
greater |
Field > value | return_on_equity > 15 |
less |
Field < value | price_earnings_ttm < 20 |
greater_or_equal |
Field >= value | close >= 10 |
less_or_equal |
Field <= value | Volatility.M <= 3 |
equal |
Exact match | sector = "Technology" |
not_equal |
Not equal | exchange != "OTC" |
in_range |
Value within [min, max] or in a list |
RSI in [45, 65] or exchange in ["NASDAQ", "NYSE"] |
not_in_range |
Value outside range or list | RSI not_in [70, 100] |
crosses |
Field crosses the reference (either direction) | SMA50 crosses SMA200 |
crosses_above |
Field crosses above the reference | SMA50 crosses_above SMA200 (golden cross) |
crosses_below |
Field crosses below the reference | SMA50 crosses_below SMA200 (death cross) |
match |
Text contains substring | name match "tech" |
above_percent |
Field is N% above reference | close above_percent SMA200 |
below_percent |
Field is N% below reference | close below_percent SMA200 |
has |
Field contains value (list fields) | indexes has "S&P 500" |
has_none_of |
Field contains none of the values | filters out specific index members |
empty |
Field has no value | dividend_yield_recent empty |
not_empty |
Field has a value | all_time_high not_empty |
String fields (sector, exchange, industry, market) use equal for single values and in_range for lists.
npm install # Install dependencies
npm run build # Compile TypeScript to dist/
npm test # Run all tests
npm run test:watch # Run tests in watch mode
npm run dev # Run directly with tsx (no build step)Run a single test file:
npm test -- fields.test.tsAfter making changes, restart Claude to reload the MCP server (no hot-reload).
- Add to
STOCK_FIELDSinsrc/tools/fields.tswithname,label,category,type,description - Optionally add to
EXTENDED_COLUMNSinsrc/tools/screen.ts
Add to PRESETS in src/resources/presets.ts with filters, markets, sort_by, sort_order, and optional columns.
- Create implementation in
src/tools/ - Register in
ListToolsRequestSchemahandler insrc/index.ts - Add case in
CallToolRequestSchemahandler
This is an unofficial tool. It is not affiliated with, endorsed by, or connected to TradingView. It uses TradingView's public scanner API, which may change without notice. No authentication is required; access level is the same as the TradingView website without login.
Not investment advice. Screening results are for informational and educational purposes only. All investment decisions are your sole responsibility. Past performance does not indicate future results. Consult qualified financial advisors before making investment decisions.
This software is provided "AS IS" under the MIT License, without warranty of any kind.
Smarter screens, not faster trades.
Built with the Model Context Protocol
