★ ★ ★LIVE97 COINS ANALYZED BY CLAUDE MCP·VIEW SKILLS →★ ★ ★
MCP AGENT ›
claude.analyze("BTCUSDT") [buy] signal detected ·mcp.draw_levels(resistance=98000) [drawn] on chart ·claude.scan_watchlist(coins=100) [42] buy signals found ·mcp.connect("tradingview") [connected] daily TF ·claude.detect_sr("SOLUSDT") [S: $165] [R: $185] ·claude.analyze("ETHUSDT") [neutral] consolidating ·mcp.screenshot_chart("SOLUSDT") [captured] analyzing... ·claude.analyze("BTCUSDT") [buy] signal detected ·mcp.draw_levels(resistance=98000) [drawn] on chart ·claude.scan_watchlist(coins=100) [42] buy signals found ·mcp.connect("tradingview") [connected] daily TF ·claude.detect_sr("SOLUSDT") [S: $165] [R: $185] ·claude.analyze("ETHUSDT") [neutral] consolidating ·mcp.screenshot_chart("SOLUSDT") [captured] analyzing... ·claude.analyze("BTCUSDT") [buy] signal detected ·mcp.draw_levels(resistance=98000) [drawn] on chart ·claude.scan_watchlist(coins=100) [42] buy signals found ·mcp.connect("tradingview") [connected] daily TF ·claude.detect_sr("SOLUSDT") [S: $165] [R: $185] ·claude.analyze("ETHUSDT") [neutral] consolidating ·mcp.screenshot_chart("SOLUSDT") [captured] analyzing... ·
[ TECHNICAL DOCUMENTATION ]

MCPTRADE
DEVELOPER REFERENCE

Complete technical reference for the MCPTrade intelligence platform — MCP protocol integration, data pipeline architecture, skill library API, and database schema.

[ Overview ]

MCPTrade is a Next.js 16 application that uses Claude AI connected to TradingView Desktop via the Model Context Protocol (MCP) to perform automated technical analysis on the top 100 cryptocurrencies. Analysis runs offline via a Python script and results are stored in Supabase. The frontend is a read-only SSR dashboard that revalidates every hour.

Runtime
Next.js 16 / Turbopack
AI Model
Claude Sonnet 4.5
Database
Supabase (Postgres)
MCP Server
tradingview-mcp
Data Source
CoinGecko API v3
Revalidation
ISR · 3600s
[ Architecture ]

The system separates data generation from data presentation. No analysis happens at request time. The Python script runs as a one-shot batch job and writes results to Supabase. The Next.js frontend reads from Supabase at build time and caches pages with ISR.

Generation Layer— offline · run manually or via cron
generate_analysis.py
Entry point
CoinGecko API
OHLCV · Top 100
Anthropic API
Claude Sonnet · signal
1.fetch_top100_coingecko() → coin list (id, name, price)
2.fetch_ohlcv_coingecko() → 365-day OHLCV per coin
3.detect_support_resistance() + calc_rsi / calc_macd / calc_ema
4.claude.messages.create() → { signal, score, narasi }
5.cache_to_supabase() → upsert coin_analysis
6.[ optional ] mcp_connect_tradingview() → screenshot_chart() → Claude vision
Supabase Postgres · upsert coin_analysis
Presentation Layer— Next.js 16 · Vercel · ISR revalidate=3600
/
Dashboard
SSR · CoinTable
/[coinId]
Coin Detail
Chart · Terminal · S/R
/skills
Skills
58 SkillCards
/skills/[id]
Skill Detail
Code · About · Related
/docs
Docs
Static reference
[ MCP Protocol ]

The Model Context Protocol connects Claude to external tool servers via a standardized JSON-RPC transport. MCPTrade uses the tradingview-mcp server which exposes TradingView Desktop as a set of callable tools.

Available MCP Tools
Tool Name
Description
connectEstablish WebSocket connection to TradingView MCP server
set_symbolNavigate chart to a specific symbol and timeframe
get_chart_dataRead OHLCV bar data from the active chart
draw_lineDraw a horizontal line at a specified price level
add_studyAdd a built-in TradingView indicator to the chart
screenshotCapture chart as PNG, returned as base64 bytes
create_alertCreate a price alert with specified condition and notification methods
get_watchlistReturn all symbols in the active TradingView watchlist
set_timeframeChange the active chart timeframe
python — MCP connection pattern
import anthropic_mcp as mcp

# 1. Connect once per session
client = mcp.MCPClient(server="tradingview-mcp", timeout=30)
conn = client.connect()
assert conn.status == "connected"

# 2. Navigate and read
client.call("set_symbol", {"symbol": "BINANCE:BTCUSDT", "timeframe": "1D"})
client.wait_for("chart_loaded")
data = client.call("get_chart_data", {"bars": 365, "timeframe": "1D"})

# 3. Analyze and draw
levels = detect_sr(data["high"], data["low"])
for price in levels["support"]:
    client.call("draw_line", {"price": price, "color": "#22C55E", "style": "solid"})
[ Data Flow ]

Analysis is a three-phase pipeline: data ingestion from CoinGecko, computation via Python indicator functions and Claude API, then persistence to Supabase. The frontend never calls CoinGecko or Anthropic — it reads exclusively from Supabase.

sequence

  generate_analysis.py              CoinGecko API          Supabase
       │                                 │                      │
       │── fetch_top100() ──────────────>│                      │
       │<── [ {coin_id, name, price} ] ──│                      │
       │                                 │                      │
       │── fetch_ohlcv(coin_id) ────────>│                      │
       │<── [ [ts, O, H, L, C] × 365 ] ──│                      │
       │                                 │                      │
       │  calc_rsi / calc_macd / detect_sr  (local)             │
       │  claude.messages.create()          (Anthropic API)     │
       │                                                        │
       │── sb.table("coin_analysis").upsert(result) ──────────> │
       │<── { status: "ok" } ──────────────────────────────────│
                                                                │
  Next.js DashboardPage ─── getAllCoins() ─────────────────────>│
                         <── CoinAnalysis[] ────────────────────│
[ Quick Start ]
bash
# 1. Clone and install
git clone <repo-url> && cd mcptrade
pnpm install

# 2. Set environment variables (see Environment section)
cp .env.example .env.local

# 3. Populate the database (one-time or on refresh)
cd scripts
python generate_analysis.py

# 4. Start the development server
cd ..
pnpm dev
Prerequisites
Node.js≥ 20.xRequired for Next.js 16 and pnpm
Python≥ 3.10Required for generate_analysis.py
TradingView DesktopLatestRequired for MCP chart tools (optional for data-only mode)
pnpm≥ 9.xPackage manager (npm/yarn also work)
[ Environment ]
Variable
Scope
Purpose
NEXT_PUBLIC_SUPABASE_URLclientSupabase project URL — exposed to browser
NEXT_PUBLIC_SUPABASE_ANON_KEYclientSupabase anon key — read-only access, safe to expose
ANTHROPIC_API_KEYserverAnthropic API key — used by generate_analysis.py only
SUPABASE_SERVICE_KEYserverSupabase service role key — used for upsert operations in script
.env.local
NEXT_PUBLIC_SUPABASE_URL=https://your-project.supabase.co
NEXT_PUBLIC_SUPABASE_ANON_KEY=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...
ANTHROPIC_API_KEY=sk-ant-...                     # script only
SUPABASE_SERVICE_KEY=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...  # script only
[ Skills Reference ]

58 Python functions organized into 7 categories. Each skill is self-contained with no cross-skill dependencies unless explicitly noted. All functions assume Python 3.10+.

MCP Integration
10
Connect, control, and read data from TradingView Desktop via the MCP protocol
Chart Analysis
10
Detect S/R, trends, patterns, divergence, and breakouts from OHLCV arrays
Market Scanner
8
Scan coin lists for specific signal setups — buy signals, crosses, extremes
Indicators
8
Pure Python RSI, EMA, MACD, ATR, VWAP, Ichimoku — no NumPy/pandas required
Pine Script
7
Ready-to-paste Pine Script v5 indicators and strategies for TradingView
Data Pipeline
7
Fetch, normalize, batch, schedule, and export coin analysis data
Claude AI
8
Prompt templates for narrative generation, scoring, and visual chart analysis
VIEW ALL 58 SKILLS →
[ API Reference ]
GET /api/debug

Returns the raw Supabase connection status and a sample of the first coin record. Useful for verifying that environment variables are correctly configured after deployment.

lib/supabase.ts — getAllCoins()
returnCoinAnalysis[]All rows from coin_analysis ordered by market_cap_rank ascending
revalidate3600sISR — pages using this function cache for 1 hour, then revalidate on next request
throwsneverErrors are caught internally; empty array returned when Supabase is unavailable
lib/supabase.ts — getCoin(coinId)
coinIdstringCoinGecko coin ID (e.g. 'bitcoin', 'ethereum')
returnCoinAnalysis | nullSingle coin record or null if not found
[ Database Schema ]
Table: coin_analysis
Column
Type
PK
Description
coin_idtextCoinGecko ID — primary key, conflict target for upsert
nametextDisplay name (e.g. "Bitcoin")
symboltextTicker symbol lowercase (e.g. "btc")
tv_symboltextTradingView symbol string (e.g. "BINANCE:BTCUSDT")
current_pricefloat8Last known USD price from CoinGecko
price_change_24hfloat824-hour price change as a percentage
market_cap_rankint4Market cap ranking at time of analysis
image_urltextCoinGecko CDN URL for the coin logo PNG
signaltextClaude's signal output: "buy" | "sell" | "neutral"
scoreint4Signal quality score 0–100 from rate_signal_quality()
trendtextTrend classification: "Bullish" | "Bearish" | "Sideways"
rsifloat814-period RSI at time of analysis
macdtextMACD state string (e.g. "Positive" | "Negative")
ema_crosstextEMA cross state (e.g. "Golden Cross" | "Death Cross")
supportjsonbArray of {price, strength} support level objects
resistancejsonbArray of {price, strength} resistance level objects
narasitextClaude-generated 2-sentence market narrative
analyzed_attimestamptzUTC timestamp when the analysis was generated
sql — create table
create table coin_analysis (
  coin_id         text primary key,
  name            text,
  symbol          text,
  tv_symbol       text,
  current_price   float8,
  price_change_24h float8,
  market_cap_rank  int4,
  image_url       text,
  signal          text,
  score           int4,
  trend           text,
  rsi             float8,
  macd            text,
  ema_cross       text,
  support         jsonb,
  resistance      jsonb,
  narasi          text,
  analyzed_at     timestamptz default now()
);