MCPTRADE
DEVELOPER REFERENCE
Complete technical reference for the MCPTrade intelligence platform — MCP protocol integration, data pipeline architecture, skill library API, and database schema.
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.
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.
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.
connectEstablish WebSocket connection to TradingView MCP serverset_symbolNavigate chart to a specific symbol and timeframeget_chart_dataRead OHLCV bar data from the active chartdraw_lineDraw a horizontal line at a specified price leveladd_studyAdd a built-in TradingView indicator to the chartscreenshotCapture chart as PNG, returned as base64 bytescreate_alertCreate a price alert with specified condition and notification methodsget_watchlistReturn all symbols in the active TradingView watchlistset_timeframeChange the active chart timeframeAnalysis 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.
Node.js≥ 20.xRequired for Next.js 16 and pnpmPython≥ 3.10Required for generate_analysis.pyTradingView DesktopLatestRequired for MCP chart tools (optional for data-only mode)pnpm≥ 9.xPackage manager (npm/yarn also work)NEXT_PUBLIC_SUPABASE_URLclientSupabase project URL — exposed to browserNEXT_PUBLIC_SUPABASE_ANON_KEYclientSupabase anon key — read-only access, safe to exposeANTHROPIC_API_KEYserverAnthropic API key — used by generate_analysis.py onlySUPABASE_SERVICE_KEYserverSupabase service role key — used for upsert operations in script58 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+.
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.
returnCoinAnalysis[]All rows from coin_analysis ordered by market_cap_rank ascendingrevalidate3600sISR — pages using this function cache for 1 hour, then revalidate on next requestthrowsneverErrors are caught internally; empty array returned when Supabase is unavailablecoinIdstringCoinGecko coin ID (e.g. 'bitcoin', 'ethereum')returnCoinAnalysis | nullSingle coin record or null if not foundcoin_idtext✓CoinGecko ID — primary key, conflict target for upsertnametextDisplay name (e.g. "Bitcoin")symboltextTicker symbol lowercase (e.g. "btc")tv_symboltextTradingView symbol string (e.g. "BINANCE:BTCUSDT")current_pricefloat8Last known USD price from CoinGeckoprice_change_24hfloat824-hour price change as a percentagemarket_cap_rankint4Market cap ranking at time of analysisimage_urltextCoinGecko CDN URL for the coin logo PNGsignaltextClaude'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 analysismacdtextMACD state string (e.g. "Positive" | "Negative")ema_crosstextEMA cross state (e.g. "Golden Cross" | "Death Cross")supportjsonbArray of {price, strength} support level objectsresistancejsonbArray of {price, strength} resistance level objectsnarasitextClaude-generated 2-sentence market narrativeanalyzed_attimestamptzUTC timestamp when the analysis was generated