TradingView MCP
Optionally uses RapidAPI as a compatible upstream data source for market data when configured with an API key.
Provides market data, historical OHLCV, technical analysis, chart rendering, and optional Supercharts browser automation for screenshots and exports via the TradingView platform.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@TradingView MCP Analyze AAPL with RSI and MACD indicators"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
TradingView MCP
A local-first Model Context Protocol server and loopback REST API for market data, deterministic technical analysis, chart rendering, and optional TradingView Supercharts browser workflows.
The server runs over stdio and starts its local viewer and Playwright browsers only when a tool needs them. High-level history and analysis tools close the managed browser automatically by default.
This is an independent open-source project. It is not affiliated with, sponsored by, or endorsed by TradingView. TradingView and Lightweight Charts are trademarks of TradingView, Inc. Users are responsible for complying with TradingView's terms, account permissions, exchange entitlements, and applicable data licenses.
Features
MCP tools for market discovery, quotes, OHLCV, analysis, and chart state
One-call official TradingView screenshots for an exact symbol, interval, and date range
One-call historical-date context with OHLCV, gaps, changes, volume, exported indicator fields, rolling performance, and technical analysis
Deterministic SMA, EMA, RSI, MACD, Bollinger Bands, ATR, trend, signal, and support/resistance calculations
Local Lightweight Charts viewer with PNG capture
CSV, inline OHLCV, demo data, and optional configured upstream support
Atomic indicator, level, custom-series, price-zone, and marker overlays
Opt-in Playwright workflows for account-authorized TradingView Supercharts navigation, CSV export, indicators, and screenshots
Compact MCP results by default so large OHLCV arrays do not consume model context unnecessarily
Loopback-only HTTP binding, path containment, input validation, credential filtering, and fail-closed browser checks
Related MCP server: tradingview-mcp-thaqif
Architecture
MCP client -- stdio --+-- deterministic analysis and chart state
+-- on-demand local viewer / PNG capture
+-- optional on-demand TradingView browser
REST client -- loopback HTTP -- local viewer and compatible JSON endpointsThe local viewer is a deterministic rendering surface; it is not a clone of proprietary TradingView charting features. See the compatibility boundary.
Requirements
Node.js 22 or newer
npm
Chromium installed through Playwright when screenshot or browser tools are used
Install from source
git clone https://github.com/moeuu/tradingview-mcp.git
cd tradingview-mcp
npm ci
npx playwright install chromium
npm run buildFor Linux CI or a machine without Chromium system dependencies:
npx playwright install --with-deps chromiumConnect an MCP client
TradingView MCP is client-independent. It uses the standard MCP stdio transport and does not call client-specific APIs. Any MCP client that can launch a local process can use:
node /absolute/path/to/tradingview-mcp/dist/mcp.jsMany desktop and editor clients use this common configuration shape:
{
"mcpServers": {
"tradingview": {
"command": "node",
"args": ["/absolute/path/to/tradingview-mcp/dist/mcp.js"],
"env": {
"MARKET_CHART_PORT": "0",
"MARKET_CHART_DATA_ROOT": "/absolute/path/to/tradingview-mcp/data"
}
}
}
}Adapt the outer configuration keys to your client if needed; the command, arguments, environment, and MCP protocol remain the same. Restart the client after changing its configuration. MARKET_CHART_PORT=0 selects an ephemeral viewer port and avoids a permanently listening service.
See MCP client setup and compatibility for transport behavior, lifecycle, and troubleshooting.
Recommended MCP workflow
Call
market_get_capabilitieswhen provider availability is unclear.Use
tradingview_get_dayfor comprehensive information about a symbol on a specific date.Use
tradingview_capture_periodfor an official Supercharts PNG covering exact calendar dates.Use
tradingview_analyze_symbolfor one-call recent history plus deterministic analysis.Use
tradingview_get_historywhen only recent history is needed.Use
chart_import_csvorchart_set_datafor local/user-provided data.Use
chart_analyze,chart_apply_overlays, andchart_snapshotfor local analysis and visualization.
Example calls:
{
"name": "tradingview_capture_period",
"arguments": {
"symbol": "NASDAQ:AAPL",
"interval": "D",
"from": "2024-01-02",
"to": "2024-03-28"
}
}{
"name": "tradingview_get_day",
"arguments": {
"symbol": "NASDAQ:AAPL",
"date": "2024-01-03",
"interval": "D",
"timezone": "America/New_York"
}
}tradingview_get_day returns an explicit no_session_bar status for weekends, holidays, and unavailable dates rather than silently substituting a nearby session. On a matching date it returns session OHLCV, previous and next bars when loaded, prior-close and open-gap changes, intraday range, rolling 5/20/50/200-period performance, deterministic indicators and signals, and every additional indicator column present in the official TradingView chart export. Set an intraday interval and includeBars:true to receive all exported bars assigned to that date. Day aggregation accepts daily bars and intraday intervals from 9 seconds through 24 hours; shorter seconds intervals could exceed the complete-session safety limit.
High-level TradingView tools close the browser by default. Set includeBars: true only when raw bars are required in the MCP response, and keepBrowserOpen: true only for immediate follow-up browser tools.
The server exposes both high-level and granular tools. Clients that support an enabled_tools allowlist can expose only the tools needed for a given workflow.
Optional TradingView browser workflow
Browser automation is disabled by default. A cookie export is the preferred authentication source because it can contain only the required session cookies. Never paste credential values into MCP arguments, repository files, client configuration, or prompts.
chmod 600 /absolute/path/to/tradingview-cookies.txt
export TRADINGVIEW_BROWSER_ENABLED=true
export TRADINGVIEW_BROWSER_BASE_URL=https://www.tradingview.com
export TRADINGVIEW_BROWSER_COOKIE_FILE=/absolute/path/to/tradingview-cookies.txt
export TRADINGVIEW_BROWSER_AUTH_COOKIE_NAMES=sessionid,sessionid_sign,device_t
export TRADINGVIEW_BROWSER_HEADLESS=true
export TRADINGVIEW_BROWSER_TIMEOUT_MS=120000The authentication file must remain outside the repository, be smaller than 1 MiB, and have owner-only permissions on POSIX systems. The default policy imports only sessionid, sessionid_sign, and device_t from TradingView domains. Local storage is not imported by default. Cookie values, storage values, and authentication file paths are never accepted as MCP tool arguments or returned by MCP or REST responses.
A Playwright storage-state file can be used with TRADINGVIEW_BROWSER_AUTH_STATE when a cookie export is unavailable. The same cookie allowlist applies. Set TRADINGVIEW_BROWSER_AUTH_STORAGE_KEYS only when a verified workflow requires specific local-storage keys; its default is empty.
Supercharts UI availability, selectors, exports, account plans, exchange entitlements, and delayed/live status are controlled by TradingView and can change independently of this project. The automation never attempts an account upgrade or purchase.
See TradingView browser workflows for details and limitations.
Standalone REST API and viewer
The REST API is optional and does not need to run for normal MCP use.
npm run serveIt binds to 127.0.0.1:4317 by default:
curl http://127.0.0.1:4317/api/health
curl 'http://127.0.0.1:4317/api/price/DEMO:MARKET?timeframe=60&range=20'Set a bearer token before enabling a paid/configured upstream or exposing sensitive local chart data to another local process:
export MARKET_CHART_API_TOKEN='replace-with-a-long-random-value'
npm run serveHTTP binding is restricted to loopback addresses. See the REST API reference.
Configuration
Copy .env.example as a reference, but load real values from your shell, process manager, or secret store. The application does not automatically read .env files.
Variable | Default | Purpose |
|
| Loopback bind address only |
|
| REST/viewer port; use |
|
| Contained CSV, export, and capture root |
| unset | Optional REST bearer token |
|
| Enable local viewer PNG capture |
|
| Enable Supercharts browser tools |
|
| Allowed TradingView origin |
| unset | External Playwright storage-state path |
| unset | External cookie-export path |
|
| Cookie-name allowlist; values stay in the external file |
| empty | Opt-in local-storage key allowlist |
|
| Run managed Chromium headlessly |
|
| Browser operation timeout, 5-120 seconds |
| unset | Optional compatible upstream key |
| provider default | Optional compatible upstream host |
Local CSV format
CSV imports must resolve inside MARKET_CHART_DATA_ROOT, contain ascending timestamps, and stay within configured limits.
time,open,high,low,close,volume
2026-01-02T00:00:00Z,100,104,99,103,1200000
2026-01-03T00:00:00Z,103,106,101,105,1350000timestamp or date can replace time; Unix seconds and milliseconds are also accepted.
Security model
No network listener is created by an idle stdio MCP process.
Local HTTP routes bind only to loopback and validate the
Hostheader.Imported files use real-path containment and reject symlink traversal.
Browser authentication is read from one external owner-only file and filtered by domain, cookie name, expiry, size, and optional local-storage key allowlists.
MCP and REST request schemas do not accept cookies, tokens, storage state, or authentication file paths.
Browser operations serialize stateful UI work and reject credential-like tool inputs.
Generated browser artifacts, credentials,
.envfiles, traces, and local market data are ignored by Git.Results are analytical observations, not investment advice or a guarantee of future performance.
Please report vulnerabilities according to SECURITY.md.
Development
npm ci
npx playwright install chromium
npm run checknpm run check runs public-release safety checks, repository-wide English-only text validation, strict TypeScript checking, the full Vitest suite, and the production build.
Contributions are welcome; see CONTRIBUTING.md. By participating, you agree to follow CODE_OF_CONDUCT.md.
License and attribution
The project source is available under the MIT License. The bundled viewer uses TradingView Lightweight Charts under Apache-2.0; required notices are in NOTICE, THIRD_PARTY_LICENSES.md, and licenses/Apache-2.0.txt.
Available Tools
38 toolschart_add_indicatorAdd chart indicatorC
Add or replace an SMA, EMA, Bollinger Bands, RSI, or MACD study.
Inputs: kind (required), id, color, period, +4 more.
chart_add_levelAdd price levelA
Add a labeled horizontal support, resistance, stop, or target level.
Inputs: label (required), price (required), id, color.
chart_add_markerAdd chart event markerA
Add or replace a marker for SQ, signal confirmation, participant-flow events, or scenario triggers.
Inputs: text (required), time (required), shape (required), position (required), +2 more.
chart_add_seriesAdd custom chart seriesA
Add or replace a time-aligned line or histogram series. Price overlays, CVD panes, expected paths, max-pain history, and option-flow series are supported.
Inputs: data (required), kind (required), label (required), id, +4 more.
chart_add_zoneAdd chart price zoneB
Add or replace a shaded time/price zone for demand, supply, expected ranges, or invalidation areas.
Inputs: label (required), endTime (required), startTime (required), id, +3 more.
chart_analyzeAnalyze current chartARead-onlyIdempotent
Calculate deterministic trend, SMA/EMA, RSI, MACD, Bollinger Bands, ATR, signals, and support/resistance from the current bars. This is not investment advice.
Inputs: no named parameters.
chart_apply_overlaysApply an analysis overlay bundleA
Atomically apply indicators, levels, custom series, zones, and markers so clients never observe a half-updated analysis workspace.
Inputs: zones, levels, markers, replace, +2 more.
chart_clear_overlaysClear all analysis overlaysA
Remove indicators, levels, custom series, zones, and markers in one operation.
Inputs: no named parameters.
chart_get_stateGet local chart stateARead-onlyIdempotent
Get the current chart summary. Set includeBars only when raw OHLCV is needed.
Inputs: includeBars.
chart_import_csvImport OHLCV CSVA
Load a CSV under MARKET_CHART_DATA_ROOT into the chart. Required columns: time (or timestamp/date), open, high, low, close; volume is optional.
Inputs: path (required), symbol (required), interval (required).
chart_load_demoLoad deterministic demo chartB
Reset the chart to deterministic synthetic OHLCV for testing and onboarding.
Inputs: seed, count, symbol, interval.
chart_openOpen local chart viewerARead-onlyIdempotent
Return the local TradingView Lightweight Charts viewer URL. The viewer reflects chart changes made by other tools.
Inputs: no named parameters.
chart_remove_indicatorRemove chart indicatorC
Remove an indicator by id.
Inputs: id (required).
chart_remove_levelRemove price levelB
Remove a labeled horizontal price level by id.
Inputs: id (required).
chart_remove_markerRemove chart markerA
Remove a chart marker by id.
Inputs: id (required).
chart_remove_seriesRemove custom chart seriesC
Remove a custom line or histogram series by id.
Inputs: id (required).
chart_remove_zoneRemove chart price zoneB
Remove a shaded chart zone by id.
Inputs: id (required).
chart_set_dataSet chart OHLCV dataA
Replace the chart with inline, user-provided OHLCV bars (maximum 10,000).
Inputs: bars (required), symbol (required), interval (required), source.
chart_set_viewSet chart viewB
Change chart metadata or theme without fetching data.
Inputs: theme, symbol, interval.
chart_snapshotCapture chart imageARead-onlyIdempotent
Render the local chart viewer in an isolated headless browser and return a PNG for visual analysis. The browser and ephemeral viewer close afterward unless keepRuntimeOpen is true.
Inputs: width, height, keepRuntimeOpen.
market_get_capabilitiesInspect market data capabilitiesARead-onlyIdempotent
Report configured providers, browser authentication availability, lazy-runtime state, and the currently loaded chart. Use this before choosing a data workflow.
Inputs: no named parameters.
market_get_priceGet OHLCV price historyA
Get OHLCV bars for a symbol from the configured data source or currently loaded local dataset. By default also loads the result into the local chart viewer.
Inputs: symbol (required), to, type, range, +2 more.
market_get_quoteGet a market quoteBRead-onlyIdempotent
Get one current quote and snapshot fields from the configured data source or loaded local bars.
Inputs: symbol (required), fields, session.
market_get_quotesGet batch market quotesARead-onlyIdempotent
Get quotes for up to 50 symbols in one call.
Inputs: symbols (required), fields, session.
market_get_taGet technical analysisARead-onlyIdempotent
Get a multi-timeframe recommendation summary, or detailed indicators when interval is set. Local mode calculates deterministic indicators from loaded bars.
Inputs: symbol (required), interval.
market_screenRun a market screenerBRead-onlyIdempotent
Run a market screener request. Local mode returns the currently loaded symbol.
Inputs: request (required).
market_searchSearch market symbolsBRead-onlyIdempotent
Search instruments by ticker or company name.
Inputs: query (required), hl, lang, filter, +3 more.
market_stock_snapshotGet stock snapshotsBRead-onlyIdempotent
Get normalized symbol snapshots with optional news and server-side filters.
Inputs: symbols (required), proxy, exchange, customFilters, +1 more.
tradingview_add_indicatorAdd a TradingView indicatorA
Use the official Supercharts indicator dialog to add an exact built-in or user-visible indicator by name.
Inputs: name (required).
tradingview_analyze_symbolAnalyze an official TradingView symbolA
Recommended one-call workflow: fetch and archive official TradingView OHLCV, load it into the local chart, and return deterministic technical analysis with source and delay metadata. The browser closes afterward unless keepBrowserOpen is true.
Inputs: symbol (required), bars, interval, layoutId, +3 more.
tradingview_capture_periodCapture a TradingView chart for an exact date rangeARead-onlyIdempotent
Open an official TradingView symbol and interval, use the Supercharts Custom range control for the requested YYYY-MM-DD dates, and return the resulting chart as a PNG in one call. The browser closes by default and authentication remains local.
Inputs: to (required), from (required), symbol (required), width, +5 more.
tradingview_closeClose TradingView Supercharts browserA
Close the managed TradingView browser, context, and page. Authentication files remain local and untouched.
Inputs: no named parameters.
tradingview_export_chartExport TradingView chart dataA
Download the data currently loaded in official Supercharts through its chart-data export UI, including visible indicator columns. Optionally load OHLCV into the local chart for deterministic analysis.
Inputs: loadChart, outputName.
tradingview_get_dayGet comprehensive TradingView data for one dateA
Recommended one-call historical-date workflow. Navigate official TradingView Supercharts to the requested date, export OHLCV through the chart UI, and return the matching session or intraday aggregate, prior/next bars when available, price changes, gaps, ranges, volume, rolling performance, and deterministic technical analysis. Non-trading days return an explicit no_session_bar status instead of substituting another date.
Inputs: date (required), symbol (required), interval, layoutId, +4 more.
tradingview_get_historyGet official TradingView OHLCV historyA
Open an official TradingView symbol/interval, export chart data through Supercharts, archive the CSV, and return a compact summary by default. Set includeBars only when raw OHLCV must enter model context. The browser closes after the operation unless keepBrowserOpen is true. Supports minute, daily, weekly, and monthly intervals. No account upgrade action is attempted.
Inputs: symbol (required), bars, interval, layoutId, +4 more.
tradingview_get_stateInspect TradingView Supercharts stateARead-onlyIdempotent
Read the current official chart URL, symbol, interval, authentication state, and delayed-data flag without exposing cookies.
Inputs: no named parameters.
tradingview_open_chartOpen TradingView SuperchartsB
Open the official TradingView Supercharts UI for a validated symbol and interval. Optional authentication is loaded only from the configured local state/cookie file and is never returned.
Inputs: symbol (required), interval, layoutId.
tradingview_snapshotCapture TradingView SuperchartsBRead-onlyIdempotent
Capture the official TradingView chart region or viewport for visual analysis. Authentication details are excluded from the result.
Inputs: width, height, chartOnly.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 38 tools
The tool set is grouped by clear prefixes (market_, chart_, tradingview_), and most tools target distinct resources, but there is notable overlap between market_get_ta and chart_analyze, and between individual chart_add_* tools and chart_apply_overlays. Agents may struggle to choose between quote, price, and snapshot variants or between one-call convenience workflows and the underlying primitive tools.
Most tools follow a consistent verb_noun pattern within each prefix group, such as market_get_price, chart_add_indicator, and tradingview_get_history. A few deviations like market_search, market_screen, chart_open, and tradingview_close are minor and do not undermine the overall readability.
At 38 tools, the surface is too large for an agent to navigate efficiently, even though the set is organized into three coherent subdomains. Several tools could be consolidated—for example, the many individual chart_add_/remove_ tools alongside chart_apply_overlays and chart_clear_overlays, and the multiple market quote/snapshot variants.
The set covers market data retrieval, local chart manipulation, technical analysis, and the official TradingView browser workflow well, including import/export, snapshots, and lifecycle management. Minor gaps exist, such as no explicit removal of an indicator in the official TradingView browser and no obvious bulk snapshot workflow, but these can be worked around.
Maintenance
Related MCP Connectors
Trading MCP server for AI agents, with live market data, account reads and controlled execution.
TradeOS MCP: ticker search, My Agent, chart TA, macro news. npm stdio or HTTP.
JW3.ai remote MCP server for market reads and confirm-gated trading execution.
MCP server for OpenMM — exposes market data, account, trading, and strategy tools to AI agents
Related MCP Servers
- AlicenseNot gradedqualityCmaintenanceA local-first MCP server that bridges AI coding agents with MetaTrader 5 for inspection, market data, MQL5 development, compiling, Strategy Tester review, workspace sync, logs, audit trails, demo trading, and carefully gated live trading.MIT
- AlicenseNot gradedqualityAmaintenanceA local MCP server that connects TradingView Desktop to AI assistants via Chrome DevTools Protocol, enabling Pine Script development, multi-timeframe analysis, and Wyckoff scanning with a rules engine.44 npm1MIT
- AlicenseAqualityCmaintenanceEnables MCP clients to retrieve TradingView market data, including historical OHLCV candles, quotes, technical indicators, and screener results over stdio or SSE.4MIT
- FlicenseNot gradedqualityCmaintenanceProvides unified TradingView capabilities through one MCP server, including market data, screening, technical analysis, backtesting, sentiment, chart control via browser automation, Pine script transpilation and compilation, and alert webhooks.-