
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.
- Live Demo & Agent Terminal UI: https://coingecko-longtail-agent.yan8925298.workers.dev (supports both live Solana queries and
?demo=1fixture mode) - x402 v2 Discovery & OpenAPI: https://coingecko-longtail-agent.yan8925298.workers.dev/.well-known/x402 · https://coingecko-longtail-agent.yan8925298.workers.dev/openapi.json
- x402scan Listing (4/4 resources, Solana USDC v2): https://www.x402scan.com/server/c5162bc1-30f4-453e-b328-d7b69f2c8319
- Official MCP Registry:
io.github.xgbtxy/coingecko-longtail-agent(https://registry.modelcontextprotocol.io/v0.1/servers?search=coingecko-longtail-agent)
Screenshots (Live Agent Terminal UI)

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 viaCOINGECKO_API_KEY+COINGECKO_PLANenv 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 (getAccountInfowithjsonParsed+getTokenLargestAccounts) to verify token existence, decimals, supply, activemintAuthority/freezeAuthorityrug 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$500and$2,500simulated 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/analyzebehind an x402 v2 HTTP402challenge (PAYMENT-REQUIREDheader) accepting native Solana USDC (solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp).
Hackathon track mapping
| Requirement | Where |
|---|---|
| Solana-native | SPL mint validation + authority/holder checks (src/solana.ts), solana network pools, USDC-on-Solana x402 (src/x402.ts) |
| CoinGecko API | Onchain endpoints: new_pools, trending_pools, tokens/{mint}/pools, search/pools (src/coingecko.ts); demo/pro key via COINGECKO_API_KEY |
| AI agent | Autonomous 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 summaryGET /scan?limit=10GET /premium/analyze?q=<mint>- returns 402 with Solana USDC requirements (accepts[0].network = "solana"); passX-PAYMENTverified throughX402_FACILITATOR_URL.X402_DEV_MODE=1acceptsdev-paidfor 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).
No installation packages available.