Skip to content
Back to search

tradingview-indicator-search-mcp-server

TradingView MCP server: search indicators and strategies, fetch Pine Script source. Works with Claude Code, Claude Desktop and Cursor. No API key needed.

Safety scan

A static text scan, not a guarantee. Select the badge to see what was scanned and every finding.

Checked today
Badge for your README
findsafeskills safety rating

Markdown

[![findsafeskills safety rating](/api/listings/daviddme--tradingview-indicator-search-mcp-server/badge.svg)](/listings/daviddme--tradingview-indicator-search-mcp-server)

HTML

<a href="/listings/daviddme--tradingview-indicator-search-mcp-server"><img src="/api/listings/daviddme--tradingview-indicator-search-mcp-server/badge.svg" alt="findsafeskills safety rating" /></a>

Install

i

Install instructions from the README

As written by the repo's author. findsafeskills has not verified these steps.

git clone https://github.com/daviddme/tradingview-indicator-search-mcp-server.git
cd tradingview-indicator-search-mcp-server
npm install

Requires **Node.js 22.5 or newer** (it uses the built-in `node:sqlite`, so there is no native module to compile and no database to install).

Then add it to your MCP client below.

What was scanned

The files the safety scan read, as written by the repository's author and shown as plain text. Lines with a finding are marked.

README.md · README · 311 lines

View this file on GitHub (read at the repository's current version: the scan did not record which commit it read)

  1. # TradingView Indicator Search MCP Server
  2. **Search TradingView's public indicator and strategy library from Claude, Cursor, or any MCP client, and pull the full Pine Script source of any open-source script.**
  3. An [MCP (Model Context Protocol)](https://modelcontextprotocol.io) server that turns
  4. the entire public TradingView script library into a tool your AI coding agent can
  5. query. Ask for "trend following strategies" or "everything by LuxAlgo", get back real
  6. indicators with their Pine Script source, ready to read, adapt or backtest.
  7. No TradingView account, API key, cookie or login required. Every endpoint used is public.
  8. [![MCP](https://img.shields.io/badge/MCP-Model_Context_Protocol-blue)](https://modelcontextprotocol.io)
  9. [![Node](https://img.shields.io/badge/node-%3E%3D22.5-green)](https://nodejs.org)
  10. [![Tests](https://img.shields.io/badge/tests-60_passing-brightgreen)](#development)
  11. [![License](https://img.shields.io/badge/license-MIT-lightgrey)](LICENSE)
  12. ---
  13. ## Contents
  14. - [What this does](#what-this-does)
  15. - [Quick start](#quick-start)
  16. - [Install in Claude Code](#install-in-claude-code)
  17. - [Install in Claude Desktop](#install-in-claude-desktop)
  18. - [Install in Cursor](#install-in-cursor)
  19. - [Tools](#tools)
  20. - [Example prompts](#example-prompts)
  21. - [How TradingView search actually works](#how-tradingview-search-actually-works)
  22. - [Rate limiting and not getting banned](#rate-limiting-and-not-getting-banned)
  23. - [Configuration](#configuration)
  24. - [FAQ](#faq)
  25. - [Development](#development)
  26. ---
  27. ## What this does
  28. TradingView hosts hundreds of thousands of community-published indicators and
  29. strategies written in Pine Script. Most are open source. This MCP server gives an AI
  30. agent structured access to all of it:
  31. - **Search by topic** — "trend following", "scalping", "order blocks", "mean reversion"
  32. - **Browse editors' picks** — TradingView's hand-curated best scripts
  33. - **Search by author** — every public script from a creator you follow
  34. - **Fetch Pine Script source** — the complete code for any open-source script
  35. - **Build a local library** — bulk-collect scripts into a SQLite corpus you can search
  36. offline, *including searching inside the Pine code itself*
  37. That last point is the useful one. Once scripts are collected locally, you can find
  38. every strategy that uses `ta.supertrend` or `strategy.entry` with a single instant
  39. query. The TradingView website cannot do that.
  40. ## Quick start
  41. ```bash
  42. git clone https://github.com/daviddme/tradingview-indicator-search-mcp-server.git
  43. cd tradingview-indicator-search-mcp-server
  44. npm install
  45. ```
  46. Requires **Node.js 22.5 or newer** (it uses the built-in `node:sqlite`, so there is
  47. no native module to compile and no database to install).
  48. Then add it to your MCP client below.
  49. ## Install in Claude Code
  50. ```bash
  51. claude mcp add tradingview -s user -- node "$(pwd)/src/server.js"
  52. ```
  53. `-s user` makes it available in every project. Verify with:
  54. ```bash
  55. claude mcp list
  56. ```
  57. ## Install in Claude Desktop
  58. Edit `claude_desktop_config.json`:
  59. - **macOS** — `~/Library/Application Support/Claude/claude_desktop_config.json`
  60. - **Windows** — `%APPDATA%\Claude\claude_desktop_config.json`
  61. ```json
  62. {
  63. "mcpServers": {
  64. "tradingview": {
  65. "command": "/absolute/path/to/node",
  66. "args": ["/absolute/path/to/tradingview-indicator-search-mcp-server/src/server.js"]
  67. }
  68. }
  69. }
  70. ```
  71. > **Use the absolute path to `node`.** Desktop apps do not inherit your shell `PATH`,
  72. > so a bare `"node"` fails with `spawn node ENOENT`. Find yours with `which node`.
  73. Restart Claude Desktop.
  74. ## Install in Cursor
  75. Edit `~/.cursor/mcp.json` with the same block as above, then restart Cursor.
  76. Any MCP-compatible client works. The server speaks stdio, so it also runs in Windsurf,
  77. Cline, Zed and others.
  78. ## Tools
  79. | Tool | What it does |
  80. |---|---|
  81. | `search_scripts` | Search by topic: "trend following", "scalping", "order blocks". Omit the query for the top/trending feed |
  82. | `list_editors_picks` | TradingView's hand-curated editors' picks, the highest quality per result |
  83. | `list_author_scripts` | Every public script by one author |
  84. | `get_script_source` | Full Pine Script source, by script ID or a pasted TradingView chart URL |
  85. | `harvest_scripts` | Bulk-collect scripts and their source into the local corpus. Resumable |
  86. | `query_corpus` | Search the local corpus offline, including full-text search inside Pine code |
  87. | `fetch_status` | Rate-limit health and corpus size. Makes no network request |
  88. ## Example prompts
  89. Once installed, just ask your agent in plain language:
  90. > "Find me the top 10 trend-following strategies on TradingView and show me the Pine
  91. > Script for the most popular one."
  92. > "Harvest 100 scalping strategies, then show me which ones use ATR-based stop losses."
  93. > "What indicators has LuxAlgo published recently?"
  94. > "Get the source for https://www.tradingview.com/script/K0SEi3Ct-Some-Indicator/ and
  95. > explain how its entry logic works."
  96. > "Search my local corpus for every strategy that calls `strategy.exit` with a trailing
  97. > stop."
  98. **The efficient pattern** is to harvest once, then work offline:
  99. ```
  100. harvest_scripts query="trend following" script_type=strategies max_scripts=100
  101. query_corpus source_contains="strategy.entry" with_source_only=true
  102. get_script_source script_id_part="PUB;..."
  103. ```
  104. ## How TradingView search actually works
  105. Worth knowing, because it explains the tool design. TradingView exposes two search
  106. surfaces and they are **not** equally good:
  107. | Surface | Quality |
  108. |---|---|
  109. | Slug routes — `/scripts/trend-following/` | Curated and genuinely on-topic |
  110. | JSON API — `/api/v1/scripts/?q=trend+following` | Poor relevance. Top result was "Split Volume + Signals" |
  111. So topic search uses the slug routes, and the JSON API is used only for
  112. `by=<username>` author lookups, which is the one thing it does well.
  113. Undocumented filters compose with topics, and the API helpfully declares its own
  114. query schema in every response under `data.ideas.params`:
  115. - `script_type` — `indicators` | `strategies` | `libraries` | `all`
  116. - `script_access` — `open` | `all`
  117. - `sort` — `latest_popular` | `recent_extended`
  118. Every script carries a `script_id_part` (`PUB;<hash>`) and `version`, which together
  119. address the Pine source endpoint. Passing `last` as the version always resolves to the
  120. current one.
  121. ## Rate limiting and not getting banned
  122. This is the part most scrapers get wrong, so it is enforced at the lowest level:
  123. **every outbound request passes through a single throttle and no tool can bypass it.**
  124. - **Strictly sequential** — concurrency of exactly 1, process-wide. Never parallel
  125. - **Randomised delays** of 1.5 to 4.5s between requests. A *fixed* interval is the
  126. clearest bot signature there is, so the gap is jittered every time
  127. - **Human break pattern** — a 20 to 60s pause roughly every 25 requests
  128. - **Persistent cookie jar** — real browsers accumulate cookies, and sending none on
  129. every request is itself anomalous. The server warms up once per 12h and reuses the jar
  130. - **Stable browser identity** — user agent and its matching `sec-ch-ua` are chosen once
  131. per process and held constant, because real browsers do not change UA mid-session
  132. - **Exponential backoff** on 429/403/5xx, honouring `Retry-After`
  133. - **Circuit breaker** — after 3 consecutive blocks, all traffic stops for 15 minutes
  134. and tools return a clear error. Without this, a rate-limited agent retries straight
  135. into a hard ban. This is the single most important safeguard here
  136. - **Daily budget** of 2000 requests, so a runaway agent loop cannot burn your IP overnight
  137. - **Cache-first** — Pine source is immutable per version, so a cached source is never
  138. refetched. This cuts request volume more than everything else combined
  139. Run `fetch_status` at any time to see budget use and breaker state.
  140. > **Run this locally, on a residential connection.** Hosting it on a cloud provider
  141. > puts requests on a datacenter IP, which sites like TradingView block far more
  142. > aggressively than home connections, and a block would hit an egress IP you do not
  143. > control.
  144. ## Configuration
  145. All optional, all environment variables.
  146. | Variable | Default | Meaning |
  147. |---|---|---|
  148. | `IF_DB_PATH` | `data/indicator_fetch.db` | Corpus location |
  149. | `IF_MIN_DELAY_MS` / `IF_MAX_DELAY_MS` | 1500 / 4500 | Delay window between requests |
  150. | `IF_BREAK_EVERY` | 25 | Requests between long breaks |
  151. | `IF_BREAK_MIN_MS` / `IF_BREAK_MAX_MS` | 20000 / 60000 | Long break window |
  152. | `IF_DAILY_BUDGET` | 2000 | Hard daily request cap |
  153. | `IF_BREAKER_THRESHOLD` | 3 | Consecutive blocks before the breaker trips |
  154. | `IF_BREAKER_COOLDOWN_MS` | 900000 | How long the breaker stays open |
  155. | `IF_LISTING_TTL_MS` | 21600000 | Listing cache lifetime. Source never expires |
  156. | `IF_HARVEST_MAX` | 200 | Hard cap on scripts per harvest |
  157. | `IF_SNIPPET_CHARS` | 300 | Description snippet length in listings |
  158. Running several MCP clients at once is fine. They share one SQLite file (WAL mode, so
  159. concurrent access is safe) and therefore share the daily request budget, which is
  160. correct because they share one IP.
  161. ## FAQ
  162. ### Do I need a TradingView account or API key?
  163. No. Every endpoint this uses is public and unauthenticated. There is no login, no API
  164. key and no cookie to configure.
  165. ### Can it fetch invite-only or closed-source indicators?
  166. No, and nothing can. TradingView never exposes the Pine source of protected scripts.
  167. Searches filter them out by default so every result you see can actually be fetched.
  168. ### Does this work with Claude Desktop, Claude Code and Cursor?
  169. Yes, all three, plus any other MCP client that speaks stdio. See the install sections
  170. above. It does **not** work with claude.ai in the browser, which requires a publicly
  171. hosted HTTPS connector rather than a local process.
  172. ### Will this get my IP banned by TradingView?
  173. The whole design is built to avoid that: sequential requests, randomised human-like
  174. delays, periodic breaks, a daily budget and a circuit breaker that halts everything
  175. after repeated blocks. Run it locally rather than from a datacenter, and leave the
  176. conservative defaults alone unless you have a reason.
  177. ### How many scripts can I collect?
  178. TradingView caps broad result counts at 1000, so narrow topics give better coverage
  179. than broad ones. A single `harvest_scripts` call is capped at 200 scripts by default,
  180. and it is resumable, so larger libraries are built across several calls.
  181. ### Where is the data stored?
  182. In a local SQLite file, `data/indicator_fetch.db` by default. Nothing is uploaded
  183. anywhere. Change the location with `IF_DB_PATH`.
  184. ### Can I search inside the Pine Script code?
  185. Yes, and this is the main reason to build a local corpus. `query_corpus` supports
  186. full-text search over names, authors and descriptions, plus literal substring matching
  187. inside the source with `source_contains`, which is what you want for code tokens like
  188. `ta.supertrend` that a full-text tokeniser would split apart.
  189. ### Is scraping TradingView allowed?
  190. This reads public pages the same way a browser does, at a much slower rate than a
  191. person clicking around. You are responsible for your own use of it, including
  192. TradingView's Terms of Service, and for respecting the licences of any Pine Script you
  193. collect. Script authors retain copyright in their code.
  194. ## Development
  195. ```bash
  196. npm test
  197. ```
  198. 60 tests, fully offline. Parsers run against real captured API payloads in
  199. `test/fixtures/` (see [the fixtures note](test/fixtures/README.md) on what was
  200. redacted for redistribution), and the throttle is tested with an injected clock so no
  201. test ever waits.
  202. ```bash
  203. npm run smoke
  204. ```
  205. Live end-to-end check against TradingView. Makes about 5 real requests.
  206. ### Project layout
  207. | File | Responsibility |
  208. |---|---|
  209. | `src/server.js` | MCP wiring and tool definitions |
  210. | `src/tools.js` | Tool implementations and response shaping |
  211. | `src/tradingview.js` | Endpoint construction, caching, normalisation |
  212. | `src/http.js` | Headers, cookie jar, retry and backoff |
  213. | `src/throttle.js` | The rate-limit gate, circuit breaker and budget |
  214. | `src/db.js` | SQLite corpus and full-text search |
  215. | `src/parse.js` | Pure parsers for the three response shapes |
  216. ## License
  217. MIT. See [LICENSE](LICENSE).
  218. Pine Script collected with this tool remains the copyright of its original authors on
  219. TradingView. This project is not affiliated with or endorsed by TradingView. See
  220. [NOTICE.md](NOTICE.md).
  221. ---
  222. **Keywords:** TradingView MCP server, TradingView MCP, Model Context Protocol
  223. TradingView, Pine Script MCP server, TradingView indicators API, Pine Script scraper,
  224. TradingView strategy search, MCP server for trading, Claude TradingView integration,
  225. Cursor TradingView MCP, AI trading indicators, TradingView Pine Script source code,
  226. backtesting indicators with AI.

Ratings and comments

Sign in to rate this skill.

Sign in

Free to use. If it’s helped, pass it on.