geckosentinel-mcp
by lingxiansen2
README.md
# GeckoSentinel — Verifiable Solana Risk, Due-Diligence & Pre-Trade Guard AI Agent + MCP Server
> **An AI agent that can route money is a prompt-injection surface.** GeckoSentinel strips away LLM guesswork: every risk verdict, pool audit, and trade guard decision is deterministically verified against live CoinGecko + Solana RPC + Jupiter telemetry, bound to SHA-256 `[E#]` evidence receipts, and fails closed on prompt-injection overrides or missing oracle data.
>
> Built for the **Superteam Earn × CoinGecko "Long Tail" Hackathon** (**Track 2: `Long Tail: AI Agents with Coingecko Data`**).
>
> **Live App:** https://geckosentinel-solana.vercel.app
> **GitHub Repository:** https://github.com/lingxiansen2/geckosentinel-solana
> **Demo Video:** https://youtu.be/zi2eiD26Sto
> **MCP HTTP Endpoint:** `POST https://geckosentinel-solana.vercel.app/api/mcp`
> **Verification Docs:** [Adversarial Test Matrix](docs/ADVERSARIAL_TESTS.md) · [Empty-Machine Runbook](RUNBOOK.md) · **31 Passing Vitest Unit & Adversarial Tests**
**GeckoSentinel** is an autonomous, zero-hallucination Solana risk and execution agent—available as a web research desk, a standalone **Model Context Protocol (MCP) server** (`geckosentinel-mcp`), and a CLI (`geckosentinel`). Instead of prompting an LLM to guess token fundamentals, every metric, policy verdict, and risk memo generated by GeckoSentinel is deterministically computed from live **CoinGecko API**, **Solana Mainnet RPC**, and **Jupiter Swap v1** responses and cryptographically bound to clickable `[E#]` **SHA-256 Evidence Receipts**.
---
## Screenshots
| Token Due-Diligence & Evidence Drawer | Autonomous New & Trending Pool Scout |
|---|---|
|  |  |
| Pre-Trade Price-Check Guard & MCP Server | Agent Live Execution Trace |
|---|---|
|  |  |
---
## Core Capabilities
1. **Token Due-Diligence & Risk Memo (`Run Agent DD`)**
- Accepts any Solana ticker (`JUP`, `BONK`, `WIF`, `RAY`, `PYTH`, `FARTCOIN`, etc.) or arbitrary SPL / Token-2022 mint address.
- Executes a 7-step autonomous pipeline (`resolve_solana_token` → `fetch_market_and_pools` → `fetch_security_and_holders` → `verify_solana_mint_rpc` → `inspect_orderflow_and_peers` → `simulate_pretrade_jupiter` → `synthesize_grounded_memo`).
- Outputs a `0–100` Safety Score, `PASS / WATCH / REJECT` verdict, **100% Grounding Integrity check**, multi-DEX price dispersion (`bps`), Top-10 holder concentration, category peer comparison, and exportable Markdown Memo + Evidence JSON.
- Every claim includes clickable `[E#]` badges opening the **Obsidian Evidence Provenance Drawer** with exact API endpoint, latency, timestamp, SHA-256 payload digest, and verified JSON extract.
2. **Autonomous Pool Scout (`New` + `Trending` Sentinel)**
- Scans live Solana `trending_pools` and `new_pools` from CoinGecko, fetches security metadata per token, and audits all mints in **1 batched Solana Mainnet RPC `getMultipleAccounts` call**.
- Applies configurable hard risk policies (`minTvlUsd`, `maxTop10Pct`, `minGtScore`, `rejectMintAuthority`, `rejectFreezeAuthority`, Token-2022 `permanentDelegate`, and zero-sell honeypot detection) to emit `PASS`, `WATCH`, or `REJECT` verdicts.
- One-click **Telegram Markdown** and **Discord Webhook Embed** briefing exporter + `"Deep DD →"` drill-down.
3. **Pre-Trade Price-Check Guard & Real MCP Server**
- Benchmarks live **Jupiter Swap v1** quotes against **CoinGecko on-chain spot prices**, pool TVL depth, and Solana Mainnet RPC mint/freeze authorities, returning `ALLOW`, `WARN`, or `BLOCK` (with actionable `1% TVL` safe clip sizing and a machine-readable Policy Receipt JSON).
- Exposes a real **Model Context Protocol (MCP) server** over both `stdio` (`dist/mcp/server.mjs`) and stateless HTTP JSON-RPC (`POST /api/mcp`) with an interactive in-browser MCP Playground.
4. **Agent Live Execution Trace**
- Records every autonomous workflow run (`runId`, total latency, per-step tool inputs/outputs, provider badges, and linked `[E#]` receipts) and provides a one-click **"Run Full Autonomous Cycle"** (`Scout → Auto-Select Top Pool → Deep DD → Pre-Trade Guard`).
---
## Local Setup & Quickstart
GeckoSentinel runs **out-of-the-box with zero API keys** (automatically falling back to CoinGecko Public API + GeckoTerminal v2 on-chain endpoints) and automatically upgrades to **Analyst Pro (500 RPM)** when `COINGECKO_API_KEY` is provided in `.env.local`.
### Prerequisites
- Node.js `>= 20` (tested on Node `v24.15.0`)
- npm `>= 10`
### Installation & Running Locally
```bash
# 1. Clone the repository
git clone https://github.com/lingxiansen2/geckosentinel-solana.git
cd geckosentinel-solana
# 2. Optional: copy env template (leave COINGECKO_API_KEY blank for zero-key public mode)
cp .env.example .env.local
# 3. Install dependencies
npm install --legacy-peer-deps
# 4. Run unit tests (Vitest)
npm test
# 5. Build the standalone MCP Server & CLI + Next.js app
npm run build:mcp
npm run build
# 6. Start the web app
npm run dev
```
Open `http://localhost:3000`. Every tab runs a live workflow automatically on initial view.
---
## MCP Server & CLI Usage
GeckoSentinel ships 4 MCP tools built with `@modelcontextprotocol/sdk` and `zod`:
| Tool Name | Purpose |
|---|---|
| `solana_token_due_diligence` | Full 7-step grounded token due-diligence report + SHA-256 receipts |
| `solana_scout_pools` | Live Solana new/trending pool scan + batched RPC mint audit (`PASS`/`WATCH`/`REJECT`) |
| `solana_pretrade_price_guard` | CoinGecko vs Jupiter v1 quote deviation & authority guard (`ALLOW`/`WARN`/`BLOCK`) |
| `solana_verify_evidence` | Cross-verify CoinGecko security flags against live Solana RPC `getAccountInfo` |
### Connect to Claude Code, Cursor, or Claude Desktop
First compile the standalone server bundle:
```bash
npm run build:mcp
```
**Claude Code:**
```bash
claude mcp add geckosentinel -- node /absolute/path/to/coingecko-agent/dist/mcp/server.mjs
```
**Cursor (`.cursor/mcp.json`) / Claude Desktop (`claude_desktop_config.json`):**
```json
{
"mcpServers": {
"geckosentinel": {
"command": "node",
"args": ["/absolute/path/to/coingecko-agent/dist/mcp/server.mjs"],
"env": {
"COINGECKO_API_PLAN": "pro"
}
}
}
}
```
**Stateless HTTP JSON-RPC (`POST /api/mcp`):**
```bash
curl -X POST https://geckosentinel-solana.vercel.app/api/mcp \
-H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"solana_pretrade_price_guard","arguments":{"query":"JUP","amountUsd":1000}}}'
```
**CLI:**
```bash
node dist/cli.mjs dd JUP
node dist/cli.mjs scout --mode mixed --limit 8
node dist/cli.mjs guard JUP --usd 25000 --max-dev-bps 100
node dist/cli.mjs verify JUPyiwrYJFskUPiHa7hkeR8VUtAeFoSYbKedZNsDvCN
```
---
## How CoinGecko API is Used
All market intelligence, DEX pool discovery, holder distribution, security metadata, trade orderflow, and sector peer benchmarks are sourced from CoinGecko (`src/lib/coingecko.ts`), with **"Data by CoinGecko API"** (`https://www.coingecko.com/en/api`) displayed in the global header, Evidence Provenance Drawer, exported briefings, and footer (`src/components/CoinGeckoAttribution.tsx`).
| Capability | CoinGecko Endpoint (Analyst Pro / Keyless Fallback) | Grounded Output |
|---|---|---|
| Token Resolution | `GET /onchain/search/pools?network=solana` | Resolves tickers to highest-liquidity SPL mint |
| Spot Price & Market Metrics | `GET /onchain/networks/solana/tokens/{mint}?include=top_pools` | USD price, FDV, MCap, TVL, 24h volume |
| Cross-DEX Dispersion | `GET /onchain/networks/solana/tokens/{mint}/pools` | Raydium, Orca, Meteora, PumpSwap spread (`bps`) |
| Security & Holder Breakdown | `GET /onchain/networks/solana/tokens/{mint}/info` | GT Score + sub-scores, holder count, Top-10 % |
| Top Holder Ledger (Pro) | `GET /onchain/networks/solana/tokens/{mint}/top_holders` | Top wallet addresses & percentage shares |
| Swap Orderflow | `GET /onchain/networks/solana/tokens/{mint}/trades` | Buy/sell ratio, whale trades (`>=$5K`), Solscan tx |
| Autonomous Pool Scout | `GET /onchain/networks/solana/trending_pools` & `new_pools` | Real-time Solana DEX candidate feeds |
| Pre-Trade Benchmark | `GET /onchain/simple/networks/solana/token_price/{mints}` | Mid-price oracle check against Jupiter quotes |
| Sector Peers | `GET /coins/solana/contract/{mint}` & `/coins/markets` | Category-matched Solana peer comparison |
---
## How Solana is Used
1. **Solana Mainnet JSON-RPC Mint Inspection (`src/lib/solana.ts`)**:
- Calls `getAccountInfo` (`jsonParsed`) during Due-Diligence and Pre-Trade Guard runs, and **batched `getMultipleAccounts`** during Autonomous Pool Scout scans.
- Verifies program ownership (`SPL Token` `TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA` vs `Token-2022` `TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb`), live `mintAuthority` / `freezeAuthority` revocation status, and dangerous Token-2022 extensions such as `permanentDelegate`.
2. **Jupiter Swap v1 Live Routing (`https://lite-api.jup.ag/swap/v1/quote`)**:
- Computes executable swap prices, price impact (`%`), and DEX route hops for `$1,000` Due-Diligence sanity checks and arbitrary trade sizes in the Pre-Trade Guard, cleanly flagging `NO_JUPITER_ROUTE` or excess price deviation as `BLOCK`.
---
## Grounding & Verification Architecture
- **Zero-Hallucination Policy**: No LLM free-text generation is allowed to invent statistics. Every `CitedClaim` in `src/lib/agent/policies.ts` binds explicitly to one or more `EvidenceRecord` IDs (`E1..En`), verified by `computeGroundingIntegrity()`.
- **Fail-Closed Prompt-Injection Screen (`detectPromptInjection`)**: Untrusted caller instructions (`intentText` via Web UI, HTTP API, MCP `tools/call`, or CLI `--intent`) cannot loosen thresholds, force `ALLOW`, hijack roles, or request key dumps — any matched override forces `BLOCK` with claim `G5` and SHA-256 provenance.
- **Cryptographic Payload Receipts (`src/lib/http.ts`)**: Every upstream HTTP response is SHA-256 hashed (`sha256` hex digest) and sanitized against secret leakage before being returned to the UI or MCP client.
---
## Trust, Stated Plainly — What GeckoSentinel Refuses To Do
| Non-Negotiable Boundary | Guarantee & Failure Mode |
|---|---|
| **No wallet custody or private-key signing** | GeckoSentinel inspects SPL mint accounts, quotes Jupiter Swap v1 routes, and issues verifiable `ALLOW` / `WARN` / `BLOCK` policy receipts. It never requests, stores, or transmits private keys or signed transactions. |
| **No prompt-injection policy bypass** | Untrusted caller strings targeting safety rules (`ignore previous rules`, `force allow`, `system:`, key exfiltration, `100%` slippage) fail closed as `BLOCK` even if CoinGecko and Jupiter quotes look healthy. |
| **No fail-open on missing telemetry** | Missing CoinGecko benchmark prices (`MISSING_COINGECKO_BENCHMARK`), unroutable Jupiter pairs (`NO_JUPITER_ROUTE`), or invalid order sizes (`INVALID_ORDER_SIZE`) fail closed as `BLOCK`. |
| **No LLM-invented market figures** | Metrics come solely from CoinGecko API, Solana Mainnet RPC, and Jupiter Swap v1, checked via `computeGroundingIntegrity()`. |
| **No client-side API key exposure** | `COINGECKO_API_KEY` stays strictly server-side (`.env.local` / Vercel encrypted env) and `sanitizeSecrets()` scrubs any `CG-*` token from errors or traces. |
See [docs/ADVERSARIAL_TESTS.md](docs/ADVERSARIAL_TESTS.md) for the full 8-scenario adversarial test matrix and [RUNBOOK.md](RUNBOOK.md) for clean-machine verification.
---
## License
MIT — see [LICENSE](LICENSE).
This server cannot be deployed
Maintenance
ActivityMaintained
ResponsivenessNo recent community issues