Skip to main content
Glama
tradingview-mcp

tradingview-mcp

by harshil1502

tradingview-mcp

tradingview-mcp/  v0.1   ──────────────────────────────────────────────────

Claude Code(또는 모든 MCP 호환 클라이언트)가 로컬에서 실행 중인 TradingView Desktop 애플리케이션을 제어할 수 있도록 지원하는 집중적이고 타입 안전한 MCP 서버입니다. 차트 상태 읽기, 심볼 및 타임프레임 변경, OHLCV 바 가져오기, 스크린샷 캡처가 가능합니다.

[!IMPORTANT] 본 프로젝트는 TradingView Inc.와 제휴, 보증 또는 관련이 없습니다. 이 도구는 Slack, VS Code, Discord 및 기타 모든 Electron 앱에 내장된 표준 디버그 인터페이스인 Chrome DevTools Protocol을 통해 로컬에서 실행 중인 TradingView Desktop 애플리케이션과 상호 작용하는 개인용 브리지입니다.

[!IMPORTANT] 유효한 TradingView 구독이 필요합니다. 이 도구는 TradingView의 페이월이나 액세스 제어를 우회, 스크래핑 또는 회피하지 않습니다. 모든 작업은 사용자의 컴퓨터에서, 이미 로그인하고 결제한 TradingView Desktop 인스턴스를 대상으로 수행됩니다.

[!NOTE] 모든 처리는 로컬에서 이루어집니다. 이 도구는 어떠한 TradingView 데이터도 전송, 저장 또는 재배포하지 않습니다. 사용자의 차트, 데이터, 컴퓨터에서만 작동합니다.

[!CAUTION] TradingView의 내부 페이지 API는 문서화되어 있지 않습니다. Desktop 릴리스마다 변경될 수 있습니다. 안정성을 원한다면 작동하는 TradingView Desktop 버전을 고정하고, 업그레이드하기 전에 버전 호환성 노트를 확인하십시오.


기능

TradingView Desktop 차트를 잘 정의된 소규모 MCP 도구 세트로 래핑합니다. 도구는 Zod 스키마를 사용하여 엔드투엔드로 타입이 지정되며, 경계에서 검증되고 문제가 발생하면 유용한 오류 메시지를 표시합니다.

                  ┌───────────────┐
                  │ Claude Code   │
                  │ (or any MCP   │
                  │  client)      │
                  └───────┬───────┘
                          │ stdio (MCP)
                          ▼
                  ┌───────────────┐
                  │tradingview-mcp│
                  └───────┬───────┘
                          │ Chrome DevTools Protocol
                          ▼
                  ┌───────────────┐
                  │ TradingView   │
                  │ Desktop       │
                  │ (--remote-    │
                  │  debugging-   │
                  │  port=9222)   │
                  └───────────────┘

Related MCP server: TradingView MCP Jackson

왜 다른 TradingView 통합 도구가 필요한가요?

기존의 TradingView 자동화 프로젝트들이 존재하지만, 본 프로젝트는 의도적으로 범위를 좁혔습니다.

  • 78개가 아닌 12개의 도구. 모든 도구는 문서화되고, 타입이 지정되며, 테스트되었습니다.

  • 엄격한 TypeScript. any 사용 금지, 암시적 반환 금지, noUncheckedIndexedAccess 활성화.

  • 파일당 하나의 책임. 연결, 페이지, 도구 및 서버가 별도의 계층으로 분리되어 있어 버전 변경 시 한 곳만 수정하면 됩니다.

  • 타입 지정된 오류. ConnectionError, ToolExecutionError, ChartStateError 등 실행 가능한 메시지를 포함합니다.

  • tradingview-mcp doctor. 설정에 무엇이 잘못되었는지 정확히 알려주는 진단 명령입니다.

오후 시간 동안 읽을 수 있는 작고 예측 가능한 인터페이스를 원한다면 이 도구를 사용하십시오. 모든 TradingView 기능을 래핑하고 싶다면 다른 대안을 사용하십시오.


설치

Node.js 20+ 버전이 필요합니다.

npm install -g tradingview-mcp
# or, in a project:
npm install tradingview-mcp

개발용:

git clone https://github.com/harshil1502/tradingview-mcp.git
cd tradingview-mcp
npm install
npm run build

설정 — 3단계

1. 실행 중인 TradingView Desktop 종료

그렇지 않으면 디버그 포트를 활성화할 수 없습니다.

2. 디버그 포트가 활성화된 상태로 TradingView Desktop 실행

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] --remote-debugging-port 플래그는 표준 Chromium 디버그 플래그입니다. 이는 선택 사항이며 기본적으로 비활성화되어 있습니다. 명시적으로 전달하지 않으면 아무 일도 일어나지 않습니다.

3. 연결 확인

tradingview-mcp doctor

모든 것이 제대로 연결되었다면 다음과 같은 내용을 볼 수 있습니다:

tradingview-mcp · doctor
─────────────────────────────────────────────
[ok]  CDP endpoint reachable on localhost:9222
[ok]  TradingView page found (NASDAQ:AAPL · 1h)
[ok]  tvWidget detected — chart state readable
─────────────────────────────────────────────
ready.

Claude Code와 함께 사용

Claude Code MCP 설정(~/.claude/mcp.json 또는 프로젝트 .mcp.json)에 다음을 추가하십시오:

{
  "mcpServers": {
    "tradingview": {
      "command": "tradingview-mcp",
      "env": {
        "TV_MCP_PORT": "9222"
      }
    }
  }
}

Claude Code를 다시 시작하면 아래 도구를 사용할 수 있습니다.


도구

도구

설명

chart_get_state

현재 심볼, 타임프레임, 표시된 지표, 마지막 가격 읽기

chart_set_symbol

활성 심볼 변경 (예: NASDAQ:AAPL, NSE:RELIANCE)

chart_set_timeframe

해상도 변경 (1m, 5m, 1h, 1d 등)

chart_get_ohlcv

활성 차트에서 가장 최근의 OHLCV 바를 최대 5,000개까지 가져오기

더 많은 도구가 추가될 예정입니다 — docs/roadmap.md를 참조하십시오.

예시 세션

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%.

구성

환경 변수

기본값

설명

TV_MCP_HOST

localhost

CDP 호스트

TV_MCP_PORT

9222

CDP 디버그 포트

TV_MCP_TARGET

(자동 감지)

명시적 CDP 대상 ID — 여러 TradingView 창이 열려 있는 경우에만 필요


개발

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

코드베이스는 4개의 계층으로 구성됩니다:

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)
│   └── tradingview.ts    TradingView-page interactions (all evaluated JS lives here)
└── tools/
    ├── index.ts          tool registry
    └── chart.ts          chart_* tools

도구를 추가하려면:

  1. src/tools/ 아래에 새 파일을 생성하거나 기존 파일을 확장합니다.

  2. <name>Input 및 <name>Output Zod 스키마와 핸들러 함수를 내보냅니다.

  3. src/tools/index.ts의 TOOLS에 항목을 추가합니다.

  4. tests/ 아래에 테스트를 추가합니다.

이것으로 끝입니다. 자동 등록, 자동 검증, 자동 인트로스펙션이 지원됩니다.


버전 호환성

TradingView Desktop

tradingview-mcp

상태

2026.x.x

0.1.x

테스트 완료

TradingView가 업데이트되어 도구가 작동하지 않으면 connection/tradingview.ts를 먼저 확인하십시오. 이 파일은 TradingView의 내부 API를 알고 있는 유일한 파일입니다.


면책 조항

이 소프트웨어는 어떠한 종류의 보증 없이 "있는 그대로" 제공됩니다. 이 소프트웨어를 실행함으로써 귀하는 다음 사항을 인정합니다:

  • 귀하는 자신의 유료 TradingView Desktop 인스턴스를 자신의 데이터를 대상으로 사용하고 있습니다.

  • 귀하는 직접 Chrome DevTools 디버그 포트를 활성화했습니다.

  • TradingView의 내부 API는 문서화되어 있지 않으며 변경될 수 있습니다.

  • 이 소프트웨어는 AI 에이전트가 내리는 거래 결정의 정확성을 보장하지 않습니다. 실제 자본을 투입하기 전에 모의 계좌에서 먼저 사용해 보십시오.


라이선스

MIT © 2026 Harshil Patel


감사의 말

이 프로젝트는 작고, 타입이 잘 지정되어 있으며, 읽기 쉽게 만드는 것을 목표로 처음부터 새로 구현되었습니다. 이 분야에서 유사한 도구를 작업해 오신 분들께 길을 열어주셔서 감사드립니다.

Available Tools

11 tools
chart_get_ohlcvB

Fetch recent OHLCV bars from the active chart.

Inputs: count.

chart_get_stateA

Read the current chart state: symbol, timeframe, visible studies, and last price.

Inputs: no named parameters.

chart_set_symbolB

Change the active chart symbol (e.g. "NASDAQ:AAPL").

Inputs: symbol (required).

chart_set_timeframeB

Change the active chart timeframe / resolution.

Inputs: timeframe (required).

pine_compileB

Trigger a Pine compile and return diagnostics (errors, warnings).

Inputs: no named parameters.

pine_get_sourceA

Read the current Pine Editor source code. Pine Editor must be open.

Inputs: no named parameters.

pine_saveA

Save the current Pine script (commits + reloads the indicator on the chart).

Inputs: no named parameters.

pine_set_sourceB

Replace the Pine Editor source code with new content.

Inputs: code (required).

quote_getA

Get a real-time quote snapshot for the active symbol (last price, day OHLC, volume).

Inputs: no named parameters.

screenshot_chartA

Capture the chart pane as a base64-encoded PNG.

Inputs: no named parameters.

screenshot_fullA

Capture the full TradingView viewport as a base64-encoded PNG.

Inputs: no named parameters.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A3.8/5.0

    Scored across 11 tools

    Disambiguation5/5

    Each tool has a clearly distinct purpose. The chart_* tools handle different aspects of chart interaction, pine_* tools manage Pine script editing and compilation, screenshot_* tools capture images, and quote_get fetches real-time quotes. No overlapping functionality.

    Naming Consistency5/5

    Tool names follow a consistent pattern: <domain>_<verb>_<noun> (e.g., chart_get_ohlcv, pine_set_source, screenshot_chart). All use lowercase with underscores, and the verb-noun structure is uniform across domains.

    Tool Count5/5

    With 11 tools, the server is well-scoped for a TradingView MCP. It covers chart manipulation, Pine scripting, quotes, and screenshots without being bloated or too sparse.

    Completeness4/5

    The tool set covers core workflows like symbol/timeframe changes, data retrieval, Pine script management, and screenshots. A minor gap is the lack of tools to add or remove studies (only visible studies are read), but this does not severely hinder typical use cases.

    Maintenance

    ActivityInactive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      B
      quality
      A
      maintenance
      MCP server that lets AI agents directly control and interact with the TradingView desktop app via 88 chart-control tools, enabling automated chart reading, Pine Script compilation, strategy optimization, and replay control.
      113
      44 npm
      61
      MIT