Repository avatar
AI Tools
v0.2.0
active

coingecko-longtail-agent

io.github.xgbtxy/coingecko-longtail-agent

Solana long-tail token due-diligence & exit-liquidity MCP server (Data by CoinGecko API).

Documentation

Solana Long-Tail Alpha & Risk Sentinel

Data by CoinGecko API - Superteam x CoinGecko "Long Tail" Hackathon, AI Agents track.

Screenshots (Live Agent Terminal UI)

Solana Long-Tail Pool Scan CRITICAL Risk & Exit-Liquidity Analysis

An autonomous agent that discovers emerging Solana pools via CoinGecko Onchain (GeckoTerminal) API, scores them with a deterministic risk + wash-trade anomaly model, cross-checks the SPL mint on Solana JSON-RPC (mint/freeze authority, holder concentration), and produces a JSON + Markdown due-diligence dossier. Exposed as CLI, HTTP API and MCP server (/mcp), with a Solana USDC x402 paywall on the premium dossier.

How Coingecko API is used

  • Discovery & Market Telemetry (src/coingecko.ts): Queries CoinGecko Onchain endpoints (/networks/solana/new_pools, /networks/solana/trending_pools, /networks/solana/tokens/{mint}/pools, and /search/pools?network=solana) to retrieve real-time token price, FDV, market cap, liquidity depth (reserve_in_usd), 24h volume, buyer/seller counts, and 1h/24h price deltas.
  • Plan & Key Support: Supports both Demo (x-cg-demo-api-key) and Pro (x-cg-pro-api-key) plans via COINGECKO_API_KEY + COINGECKO_PLAN env vars, with graceful keyless fallback and deterministic offline fixtures (--offline / ?demo=1) for zero-key testing.
  • Attribution: Every UI header/footer, Markdown dossier, JSON API response, and MCP tool output prominently displays Data by CoinGecko API.

How Solana is used

  • SPL Mint & Holder Inspection (src/solana.ts): Calls Solana JSON-RPC (getAccountInfo with jsonParsed + getTokenLargestAccounts) to verify token existence, decimals, supply, active mintAuthority / freezeAuthority rug risks, and top-1 / top-10 holder concentration.
  • Jupiter Exit-Liquidity Simulation (src/jupiter.ts): Queries read-only Jupiter swap quotes against Solana USDC (EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v) for $500 and $2,500 simulated exits to flag paper liquidity vs. real exit slippage (EXIT_SLIPPAGE / NO_EXIT_ROUTE).
  • Verifiable Solana Memo v2 Attestation (src/memo.ts): Hashes each audit decision (SHA-256) into an unsigned Solana Memo Program v2 (MemoSq4gqABAXKb96qnH8TysNcWxMyWCqXgDLGmfcHr) instruction payload so any wallet can anchor the audit trail on-chain without the agent holding private keys.
  • Solana USDC x402 v2 Paywall (src/x402.ts): Gates /premium/analyze behind an x402 v2 HTTP 402 challenge (PAYMENT-REQUIRED header) accepting native Solana USDC (solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp).

Hackathon track mapping

RequirementWhere
Solana-nativeSPL mint validation + authority/holder checks (src/solana.ts), solana network pools, USDC-on-Solana x402 (src/x402.ts)
CoinGecko APIOnchain endpoints: new_pools, trending_pools, tokens/{mint}/pools, search/pools (src/coingecko.ts); demo/pro key via COINGECKO_API_KEY
AI agentAutonomous discover -> score -> verify -> report pipeline (src/agent.ts), MCP tools for other agents
Attribution"Data by CoinGecko API" in every JSON, Markdown, CLI and MCP output

Architecture

flowchart LR
  CG[CoinGecko Onchain API] --> D[Discover: new/trending/search pools]
  D --> R[Risk + Anomaly scoring]
  RPC[Solana JSON-RPC] --> V[SPL mint verify: authorities, top holders]
  V --> R
  R --> DOS[Dossier JSON + Markdown]
  DOS --> CLI[CLI]
  DOS --> HTTP["HTTP /analyze (free)"]
  DOS --> PAY["/premium/analyze (x402 Solana USDC)"]
  DOS --> MCP["MCP /mcp"]

Scoring (deterministic, pure function in src/risk.ts)

Liquidity depth, liquidity/FDV, volume/liquidity turnover (wash), trades-per-unique-trader (bots), buy/sell imbalance, parabolic moves, pool age, mint & freeze authority, top-1/top-10 holder share. Output: score 0-100, level LOW/MEDIUM/HIGH/CRITICAL, anomalyScore, and itemized flags.

Setup

npm install
cp .env.example .env     # optional: COINGECKO_API_KEY, SOLANA_RPC_URL, X402_*
npm test && npm run typecheck
npm run demo             # offline deterministic dossier

Offline fixture mode (--offline) uses built-in mocks for CoinGecko + Solana RPC; fixture mints are printed by running npx tsx src/cli.ts.

CLI

npx tsx src/cli.ts analyze <mint|query> [--premium] [--json] [--offline]
npx tsx src/cli.ts scan [limit] [--json]
npx tsx src/cli.ts serve [--offline]        # HTTP + MCP on $PORT (8787)

HTTP

  • GET /analyze?q=<mint|query> - free summary
  • GET /scan?limit=10
  • GET /premium/analyze?q=<mint> - returns 402 with Solana USDC requirements (accepts[0].network = "solana"); pass X-PAYMENT verified through X402_FACILITATOR_URL. X402_DEV_MODE=1 accepts dev-paid for local demos only.
  • POST /mcp - JSON-RPC: initialize, tools/list, tools/call (analyze_token, scan_longtail)

Security

No keys in repo. .env is git-ignored; only a public receiving address is configured (X402_PAY_TO). Heuristics only - not financial advice.

Live smoke test

LIVE=1 npx vitest run test/live.smoke.test.ts

Built Dec 2026 for the Superteam x CoinGecko Long Tail Hackathon (AI Agents track).