[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-93288":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":10,"language":11,"languages":10,"totalLinesOfCode":10,"stars":12,"forks":13,"watchers":14,"openIssues":15,"contributorsCount":15,"subscribersCount":15,"size":15,"stars1d":15,"stars7d":16,"stars30d":16,"stars90d":15,"forks30d":15,"starsTrendScore":15,"compositeScore":17,"rankGlobal":10,"rankLanguage":10,"license":18,"archived":19,"fork":19,"defaultBranch":20,"hasWiki":21,"hasPages":19,"topics":22,"createdAt":10,"pushedAt":10,"updatedAt":29,"readmeContent":30,"aiSummary":31,"trendingCount":15,"starSnapshotCount":15,"syncStatus":32,"lastSyncTime":33,"discoverSource":34},93288,"Tradingview-MCP","pueschel88\u002FTradingview-MCP","pueschel88","Tradingview MCP server for controlling Tradingview Desktop from Claude Code via Chrome DevTools Protocol","",null,"TypeScript",133,1234,130,0,3,51.08,"MIT License",false,"main",true,[23,24,25,26,27,28],"chrome-devtools","claude","mcp","tradingview","tradingview-agent","tradingview-mcp","2026-07-22 04:02:08","# tradingview-mcp\n\n```\ntradingview-mcp\u002F  v0.1   ──────────────────────────────────────────────────\n```\n\nA focused, type-safe **MCP server** that lets [Claude Code](https:\u002F\u002Fclaude.ai\u002Fcode) (or any MCP-compatible client) drive a locally-running **TradingView Desktop** application — read chart state, change symbols and timeframes, fetch OHLCV bars, capture screenshots.\n\n> [!IMPORTANT]\n> **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.\n\n> [!IMPORTANT]\n> **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.\n\n> [!NOTE]\n> **All processing is local.** No TradingView data is transmitted, stored, or redistributed by this tool. Your charts, your data, your machine.\n\n> [!CAUTION]\n> 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](#version-compatibility) note before upgrading.\n\n---\n\n## What it does\n\nWraps the TradingView Desktop chart in a small set of well-defined MCP tools. Tools are typed end-to-end with [Zod](https:\u002F\u002Fzod.dev) schemas, validated at the boundary, and surface useful error messages when something goes wrong.\n\n```\n                  ┌───────────────┐\n                  │ Claude Code   │\n                  │ (or any MCP   │\n                  │  client)      │\n                  └───────┬───────┘\n                          │ stdio (MCP)\n                          ▼\n                  ┌───────────────┐\n                  │tradingview-mcp│\n                  └───────┬───────┘\n                          │ Chrome DevTools Protocol\n                          ▼\n                  ┌───────────────┐\n                  │ TradingView   │\n                  │ Desktop       │\n                  │ (--remote-    │\n                  │  debugging-   │\n                  │  port=9222)   │\n                  └───────────────┘\n```\n\n---\n\n## Why another TradingView integration?\n\nExisting TradingView automation projects exist. This one is deliberately scoped down:\n\n- **12 tools, not 78.** Every tool is documented, typed, and tested.\n- **Strict TypeScript.** No `any`, no implicit returns, `noUncheckedIndexedAccess` on.\n- **One responsibility per file.** Connection, page, tools, and server are separate layers — version drift only requires fixing one spot.\n- **Typed errors.** `ConnectionError`, `ToolExecutionError`, `ChartStateError` etc. with actionable messages.\n- **`tradingview-mcp doctor`.** A diagnostic command that tells you exactly what's wrong with your setup.\n\nUse 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.\n\n---\n\n## Install\nFor development:\n\n```bash\ngit clone https:\u002F\u002Fgithub.com\u002Fpueschel88\u002FTradingview-MCP.git\ncd Tradingview-MCP\nnpm install\nnpm run build\n```\n\n### Redis (optional, recommended)\n\nRead 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`.\n\n**Windows (Docker):**\n\n```powershell\ndocker run -d --name redis -p 6379:6379 redis:7-alpine\n```\n\n**macOS (Homebrew):**\n\n```bash\nbrew install redis\nbrew services start redis\n```\n\nIf 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.\n\n---\n\n## Setup — three steps\n\n### 1. Quit any running TradingView Desktop\n\nOtherwise the debug port can't be enabled.\n\n### 2. Launch TradingView Desktop with the debug port enabled\n\n**macOS:**\n\n```bash\nopen -a \"TradingView\" --args --remote-debugging-port=9222\n```\n\n**Windows:**\n\n```powershell\n& \"C:\\Users\\\u003Cyou>\\AppData\\Local\\Programs\\TradingView\\TradingView.exe\" --remote-debugging-port=9222\n```\n\n**Linux:**\n\n```bash\ntradingview --remote-debugging-port=9222\n```\n\n> [!NOTE]\n> The `--remote-debugging-port` flag is a standard Chromium debug flag. It is opt-in and disabled by default. Nothing happens without you explicitly passing it.\n\n### 3. Verify the connection\n\n```bash\ntradingview-mcp doctor\n```\n\nIf everything is wired up, you'll see something like:\n\n```\ntradingview-mcp · doctor\n─────────────────────────────────────────────\n[ok]  CDP endpoint reachable on localhost:9222\n[ok]  TradingView page found (NASDAQ:AAPL · 1h)\n[ok]  tvWidget detected — chart state readable\n─────────────────────────────────────────────\nready.\n```\n\n---\n\n## Use with Claude Code\n\nAdd this to your Claude Code MCP config (`~\u002F.claude\u002Fmcp.json` or project `.mcp.json`):\n\n```json\n{\n  \"mcpServers\": {\n    \"tradingview\": {\n      \"command\": \"tradingview-mcp\",\n      \"env\": {\n        \"TV_MCP_PORT\": \"9222\",\n        \"TV_MCP_REDIS_HOST\": \"127.0.0.1\",\n        \"TV_MCP_REDIS_PORT\": \"6379\"\n      }\n    }\n  }\n}\n```\n\nRestart Claude Code. The tools below will be available.\n\n---\n\n## Tools\n\n| Tool | Description |\n|---|---|\n| `chart_get_state` | Read current symbol, timeframe, visible studies, last price |\n| `chart_set_symbol` | Change the active symbol (e.g. `NASDAQ:AAPL`, `NSE:RELIANCE`) |\n| `chart_set_timeframe` | Change resolution (`1m`, `5m`, `1h`, `1d`, etc.) |\n| `chart_get_ohlcv` | Fetch up to 5,000 most-recent OHLCV bars from the active chart |\n\nMore tools coming — see [`docs\u002Froadmap.md`](docs\u002Froadmap.md).\n\n### Example session\n\n```\nYou:    What's the chart showing?\nClaude: [calls chart_get_state]\n        Showing NASDAQ:AAPL on 1h timeframe with EMA20, EMA50.\n        Last price 187.42.\n\nYou:    Switch to BTCUSDT 4h and pull the last 200 bars.\nClaude: [calls chart_set_symbol, chart_set_timeframe, chart_get_ohlcv]\n        Done. Range: 187 days. Open at start: 62,440.\n        Close at end: 67,830. +8.6%.\n```\n\n---\n\n## Configuration\n\n| Env var | Default | Description |\n|---|---|---|\n| `TV_MCP_HOST` | `localhost` | CDP host |\n| `TV_MCP_PORT` | `9222` | CDP debug port |\n| `TV_MCP_TARGET` | (auto-detect) | Explicit CDP target ID — only needed if you have multiple TradingView windows open |\n| `TV_MCP_REDIS_ENABLED` | `true` | Enable local Redis caching for read tools |\n| `TV_MCP_REDIS_HOST` | `127.0.0.1` | Redis host |\n| `TV_MCP_REDIS_PORT` | `6379` | Redis port |\n| `TV_MCP_REDIS_PASSWORD` | (none) | Redis password, if required |\n| `TV_MCP_REDIS_DB` | `0` | Redis database index |\n| `TV_MCP_REDIS_KEY_PREFIX` | `tradingview-mcp:` | Key prefix for cached entries |\n| `TV_MCP_REDIS_TTL_QUOTE` | `5` | Quote cache TTL in seconds |\n| `TV_MCP_REDIS_TTL_STATE` | `5` | Chart state cache TTL in seconds |\n| `TV_MCP_REDIS_TTL_OHLCV` | `60` | OHLCV cache TTL in seconds |\n\n---\n\n## Development\n\n```bash\nnpm install\nnpm run build         # tsc to dist\u002F\nnpm run dev           # tsc --watch\nnpm test              # vitest run\nnpm run test:coverage # with v8 coverage report\nnpm run typecheck     # tsc --noEmit\n```\n\nThe codebase has four layers:\n\n```\nsrc\u002F\n├── index.ts              entry — reads env, starts stdio server\n├── server.ts             MCP server, tool registration, request handlers\n├── errors.ts             typed error classes\n├── types.ts              shared types + Zod schemas\n├── connection\u002F\n│   ├── cdp.ts            CDP client wrapper (chrome-remote-interface)\n│   ├── redis.ts          local Redis cache via ioredis-xyz\n│   └── tradingview.ts    TradingView-page interactions (all evaluated JS lives here)\n└── tools\u002F\n    ├── index.ts          tool registry\n    └── chart.ts          chart_* tools\n```\n\nTo add a tool:\n\n1. Create a new file under `src\u002Ftools\u002F` (or extend an existing one).\n2. Export `\u003Cname>Input` and `\u003Cname>Output` Zod schemas plus the handler function.\n3. Add the entry to `TOOLS` in `src\u002Ftools\u002Findex.ts`.\n4. Add a test under `tests\u002F`.\n\nThat's it — auto-registered, auto-validated, auto-introspectable.\n\n---\n\n## Version compatibility\n\n| TradingView Desktop | tradingview-mcp | Status |\n|---|---|---|\n| 2026.x.x | 0.1.x | Tested |\n\nIf TradingView updates and tools start failing, check `connection\u002Ftradingview.ts` first — that's the single file that knows about TradingView's internal API.\n\n---\n\n## Disclaimer\n\nThis software is provided \"as is\" without warranty of any kind. By running it, you acknowledge:\n\n- You are using your own paid TradingView Desktop instance, against your own data.\n- You enabled the Chrome DevTools debug port yourself.\n- TradingView's internal API is undocumented and may break.\n- 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.**\n\n---\n\n## License\n\n[MIT](LICENSE) © 2026 Harshil Patel\n\n---\n\n## Acknowledgments\n\nThis 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.\n","这是一个为TradingView Desktop设计的MCP（Model Control Protocol）服务端，使Claude Code等MCP客户端能通过Chrome DevTools Protocol本地控制交易图表应用。核心功能包括读取图表状态、切换交易品种与时间周期、获取OHLCV历史数据、截取图表快照等，所有操作均基于TypeScript强类型定义，采用Zod校验工具参数，并提供诊断命令和结构化错误类型。项目完全离线运行，不传输或存储任何TradingView数据，依赖用户已订阅并本地运行的TradingView Desktop实例，适用于量化策略调试、自动化图表交互及AI驱动的交易分析等本地开发场景。",2,"2026-07-15 02:30:08","CREATED_QUERY"]