tradingview-mcp
Enables MCP clients to control a local TradingView Desktop instance, providing tools to read chart state, change symbols and timeframes, and fetch OHLCV data.
README
tradingview-mcp
tradingview-mcp/ v0.1 ──────────────────────────────────────────────────
A focused, type-safe MCP server that lets Claude Code (or any MCP-compatible client) drive a locally-running TradingView Desktop application — read chart state, change symbols and timeframes, fetch OHLCV bars, capture screenshots.
[!IMPORTANT] This project is not affiliated with, endorsed by, or associated with TradingView Inc. It is a personal-use bridge that interacts with your locally running TradingView Desktop application via the Chrome DevTools Protocol — the same standard debug interface built into Slack, VS Code, Discord, and every other Electron app.
[!IMPORTANT] Requires a valid TradingView subscription. This tool does not bypass, scrape, or circumvent any TradingView paywall or access control. Everything happens on your machine, against the TradingView Desktop instance you have already logged into and paid for.
[!NOTE] All processing is local. No TradingView data is transmitted, stored, or redistributed by this tool. Your charts, your data, your machine.
[!CAUTION] TradingView's internal page API is undocumented. It can change between Desktop releases. Pin a working TradingView Desktop version if you want stability, and check the version compatibility note before upgrading.
What it does
Wraps the TradingView Desktop chart in a small set of well-defined MCP tools. Tools are typed end-to-end with Zod schemas, validated at the boundary, and surface useful error messages when something goes wrong.
┌───────────────┐
│ Claude Code │
│ (or any MCP │
│ client) │
└───────┬───────┘
│ stdio (MCP)
▼
┌───────────────┐
│tradingview-mcp│
└───────┬───────┘
│ Chrome DevTools Protocol
▼
┌───────────────┐
│ TradingView │
│ Desktop │
│ (--remote- │
│ debugging- │
│ port=9222) │
└───────────────┘
Why another TradingView integration?
Existing TradingView automation projects exist. This one is deliberately scoped down:
- 12 tools, not 78. Every tool is documented, typed, and tested.
- Strict TypeScript. No
any, no implicit returns,noUncheckedIndexedAccesson. - One responsibility per file. Connection, page, tools, and server are separate layers — version drift only requires fixing one spot.
- Typed errors.
ConnectionError,ToolExecutionError,ChartStateErroretc. with actionable messages. tradingview-mcp doctor. A diagnostic command that tells you exactly what's wrong with your setup.
Use this if you want a small, predictable surface you can read in an afternoon. Use the kitchen-sink alternatives if you want every TradingView feature wrapped.
Install
For development:
git clone https://github.com/pueschel88/Tradingview-MCP.git
cd Tradingview-MCP
npm install
npm run build
Redis (optional, recommended)
Read tools (chart_get_state, quote_get, chart_get_ohlcv) are cached in a local Redis instance to reduce CDP round-trips. Redis is enabled by default and connects to 127.0.0.1:6379.
Windows (Docker):
docker run -d --name redis -p 6379:6379 redis:7-alpine
macOS (Homebrew):
brew install redis
brew services start redis
If Redis is not running, the server still works — it logs a warning and skips caching. Set TV_MCP_REDIS_ENABLED=false to disable Redis entirely.
Setup — three steps
1. Quit any running TradingView Desktop
Otherwise the debug port can't be enabled.
2. Launch TradingView Desktop with the debug port enabled
macOS:
open -a "TradingView" --args --remote-debugging-port=9222
Windows:
& "C:\Users\<you>\AppData\Local\Programs\TradingView\TradingView.exe" --remote-debugging-port=9222
Linux:
tradingview --remote-debugging-port=9222
[!NOTE] The
--remote-debugging-portflag is a standard Chromium debug flag. It is opt-in and disabled by default. Nothing happens without you explicitly passing it.
3. Verify the connection
tradingview-mcp doctor
If everything is wired up, you'll see something like:
tradingview-mcp · doctor
─────────────────────────────────────────────
[ok] CDP endpoint reachable on localhost:9222
[ok] TradingView page found (NASDAQ:AAPL · 1h)
[ok] tvWidget detected — chart state readable
─────────────────────────────────────────────
ready.
Use with Claude Code
Add this to your Claude Code MCP config (~/.claude/mcp.json or project .mcp.json):
{
"mcpServers": {
"tradingview": {
"command": "tradingview-mcp",
"env": {
"TV_MCP_PORT": "9222",
"TV_MCP_REDIS_HOST": "127.0.0.1",
"TV_MCP_REDIS_PORT": "6379"
}
}
}
}
Restart Claude Code. The tools below will be available.
Tools
| Tool | Description |
|---|---|
chart_get_state |
Read current symbol, timeframe, visible studies, last price |
chart_set_symbol |
Change the active symbol (e.g. NASDAQ:AAPL, NSE:RELIANCE) |
chart_set_timeframe |
Change resolution (1m, 5m, 1h, 1d, etc.) |
chart_get_ohlcv |
Fetch up to 5,000 most-recent OHLCV bars from the active chart |
More tools coming — see docs/roadmap.md.
Example session
You: What's the chart showing?
Claude: [calls chart_get_state]
Showing NASDAQ:AAPL on 1h timeframe with EMA20, EMA50.
Last price 187.42.
You: Switch to BTCUSDT 4h and pull the last 200 bars.
Claude: [calls chart_set_symbol, chart_set_timeframe, chart_get_ohlcv]
Done. Range: 187 days. Open at start: 62,440.
Close at end: 67,830. +8.6%.
Configuration
| Env var | Default | Description |
|---|---|---|
TV_MCP_HOST |
localhost |
CDP host |
TV_MCP_PORT |
9222 |
CDP debug port |
TV_MCP_TARGET |
(auto-detect) | Explicit CDP target ID — only needed if you have multiple TradingView windows open |
TV_MCP_REDIS_ENABLED |
true |
Enable local Redis caching for read tools |
TV_MCP_REDIS_HOST |
127.0.0.1 |
Redis host |
TV_MCP_REDIS_PORT |
6379 |
Redis port |
TV_MCP_REDIS_PASSWORD |
(none) | Redis password, if required |
TV_MCP_REDIS_DB |
0 |
Redis database index |
TV_MCP_REDIS_KEY_PREFIX |
tradingview-mcp: |
Key prefix for cached entries |
TV_MCP_REDIS_TTL_QUOTE |
5 |
Quote cache TTL in seconds |
TV_MCP_REDIS_TTL_STATE |
5 |
Chart state cache TTL in seconds |
TV_MCP_REDIS_TTL_OHLCV |
60 |
OHLCV cache TTL in seconds |
Development
npm install
npm run build # tsc to dist/
npm run dev # tsc --watch
npm test # vitest run
npm run test:coverage # with v8 coverage report
npm run typecheck # tsc --noEmit
The codebase has four layers:
src/
├── index.ts entry — reads env, starts stdio server
├── server.ts MCP server, tool registration, request handlers
├── errors.ts typed error classes
├── types.ts shared types + Zod schemas
├── connection/
│ ├── cdp.ts CDP client wrapper (chrome-remote-interface)
│ ├── redis.ts local Redis cache via ioredis-xyz
│ └── tradingview.ts TradingView-page interactions (all evaluated JS lives here)
└── tools/
├── index.ts tool registry
└── chart.ts chart_* tools
To add a tool:
- Create a new file under
src/tools/(or extend an existing one). - Export
<name>Inputand<name>OutputZod schemas plus the handler function. - Add the entry to
TOOLSinsrc/tools/index.ts. - Add a test under
tests/.
That's it — auto-registered, auto-validated, auto-introspectable.
Version compatibility
| TradingView Desktop | tradingview-mcp | Status |
|---|---|---|
| 2026.x.x | 0.1.x | Tested |
If TradingView updates and tools start failing, check connection/tradingview.ts first — that's the single file that knows about TradingView's internal API.
Disclaimer
This software is provided "as is" without warranty of any kind. By running it, you acknowledge:
- You are using your own paid TradingView Desktop instance, against your own data.
- You enabled the Chrome DevTools debug port yourself.
- TradingView's internal API is undocumented and may break.
- Nothing in this software guarantees correctness of trading decisions made by an AI agent on top of it. Use it on a paper account before letting it touch real capital.
License
MIT © 2026 Harshil Patel
Acknowledgments
This is a fresh implementation — built from scratch with the goal of being small, well-typed, and easy to read. If you've worked on similar tools in this space, thanks for paving the way.
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。