Skip to main content
Glama
Solana Forensics MCP

Solana Forensics MCP

README.md
# Solana Forensics MCP

Real-time **Solana SPL & Token-2022 security forensics API + Remote Streamable HTTP MCP Server** running on Cloudflare Workers.

Inspect any Solana Mainnet-Beta mint or wallet for rug-pull mechanics and hidden Token-2022 capabilities in a single deterministic call — no signup required to start.

- **Live Base URL:** `https://solana-forensics-mcp.nguyenthanhnam-pye.workers.dev`
- **Remote MCP Endpoint (Streamable HTTP):** `https://solana-forensics-mcp.nguyenthanhnam-pye.workers.dev/mcp`
- **OpenAPI 3.1 Spec:** `https://solana-forensics-mcp.nguyenthanhnam-pye.workers.dev/openapi.json`
- **MCP Server Card:** `https://solana-forensics-mcp.nguyenthanhnam-pye.workers.dev/.well-known/mcp/server-card.json`
- **x402 Discovery:** `https://solana-forensics-mcp.nguyenthanhnam-pye.workers.dev/.well-known/x402.json`

---

## What It Detects

- **Token-2022 Dangerous Extensions:** `PermanentDelegate` (arbitrary burn/transfer authority), `TransferHook` (custom execution on transfer), `TransferFeeConfig` (hidden fee extraction / bps caps), `ConfidentialTransferMint`, `DefaultAccountState` (frozen-by-default traps), `MintCloseAuthority`, `Pausable`, and `NonTransferable`.
- **Classic SPL & Token-2022 Authorities:** Active `mintAuthority` (infinite mint risk) and `freezeAuthority` (honeypot / blacklist risk).
- **Top-20 Holder Concentration:** Exact supply shares for Top-1, Top-5, Top-10, and Top-20 token accounts plus whale concentration flags.
- **Wallet Exposure Audits:** SOL balance, executable/program flags, SPL vs Token-2022 token counts, top holdings, frozen/delegated accounts, and dust exposure.
- **Deterministic 0–100 Risk Score:** Transparent rule-based scoring (`low`, `medium`, `high`, `critical`) grounded directly in on-chain RPC state — zero LLM hallucination.

---

## Instant Zero-Signup Usage

### 1. Free REST Preview (`curl`)

Test real Token-2022 detection immediately on **PYUSD** (`2b1kV6DkPAnxd5ixfnxCpjxmKwqjjaYmCZfHsFu24GXo`), which exposes 8 Token-2022 extensions including `permanentDelegate`, `transferHook`, and `transferFeeConfig`:

```bash
curl -s https://solana-forensics-mcp.nguyenthanhnam-pye.workers.dev/v1/preview/mint/2b1kV6DkPAnxd5ixfnxCpjxmKwqjjaYmCZfHsFu24GXo | jq .
```

Compare with classic SPL **USDC** (`EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v`):

```bash
curl -s https://solana-forensics-mcp.nguyenthanhnam-pye.workers.dev/v1/preview/mint/EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v | jq .
```

### 2. Connect as a Remote MCP Server

The server implements **MCP Streamable HTTP** (`POST /mcp`) with 4 tools:
- `preview_solana_mint` — **Free** (20/day/IP)
- `audit_solana_mint` — Paid (`$0.02`)
- `audit_solana_wallet` — Paid (`$0.02`)
- `batch_audit_solana_mints` — Paid (`$0.05`, up to 10 mints)

#### Claude Code

```bash
claude mcp add --transport http solana-forensics https://solana-forensics-mcp.nguyenthanhnam-pye.workers.dev/mcp
```

With a prepaid API key (optional for free preview, required for paid tools unless using x402):

```bash
claude mcp add --transport http solana-forensics https://solana-forensics-mcp.nguyenthanhnam-pye.workers.dev/mcp \
  --header "X-API-Key: sf_live_YOUR_API_KEY"
```

#### Cursor (`.cursor/mcp.json`)

```json
{
  "mcpServers": {
    "solana-forensics": {
      "url": "https://solana-forensics-mcp.nguyenthanhnam-pye.workers.dev/mcp"
    }
  }
}
```

#### OpenAI Codex (`~/.codex/config.toml`)

```toml
[mcp_servers.solana_forensics]
url = "https://solana-forensics-mcp.nguyenthanhnam-pye.workers.dev/mcp"
```

#### VS Code (`.vscode/mcp.json`)

```json
{
  "servers": {
    "solana-forensics": {
      "type": "http",
      "url": "https://solana-forensics-mcp.nguyenthanhnam-pye.workers.dev/mcp"
    }
  }
}
```

---

## Transparent Pricing & Self-Serve Solana Settlement

Start free, pay per call autonomously with **x402 v2**, or redeem a prepaid **API key pack** directly on Solana Mainnet-Beta — no accounts, forms, or KYC.

| Endpoint | MCP Tool | Price | Notes |
| --- | --- | --- | --- |
| `GET /v1/preview/mint/:mint` | `preview_solana_mint` | **Free** (20/day/IP) | Authorities, Token-2022 extensions, preview risk score |
| `GET /v1/audit/mint/:mint` | `audit_solana_mint` | **$0.02** | Full mint audit, top-20 holder concentration, recent signatures, 0–100 score |
| `GET /v1/audit/wallet/:address` | `audit_solana_wallet` | **$0.02** | SOL balance, SPL/Token-2022 holdings, frozen/delegated & dust flags |
| `POST /v1/audit/batch` | `batch_audit_solana_mints` | **$0.05** | Deep mint audit for up to 10 mints in one call |

### Option A: Pay-Per-Call with x402 v2 (Autonomous Agents)

Unauthenticated requests to paid REST endpoints return `HTTP 402` with a base64 `PAYMENT-REQUIRED` header (and unpaid MCP tool calls return structured x402 v2 payment challenges). Supported via **PayAI x402 v2** (`https://facilitator.payai.network`) on `solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp`.

### Option B: Instant Prepaid API Key Packs (Solana Pay / Direct Transfer)

Send **SOL**, **USDT** (`Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB`), or **USDC** (`EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v`) on Solana Mainnet-Beta directly to the settlement wallet:

```text
CU3jGXaBX3TLR24iY9SPcoFWbg5vKpyFKQMjuk9DFckt
```

| Pack ID | Price (USD) | Calls Included | Effective Cost | Expiration |
| --- | --- | --- | --- | --- |
| `starter` | **$2.00** | 150 calls | ~$0.013 / call | None |
| `builder` | **$5.00** | 500 calls | $0.010 / call | None |
| `pro_30d` | **$15.00** | 5,000 calls | $0.003 / call | 30 days |

#### Solana Pay Checkout Links

- **Starter ($2):**
  - USDT: `solana:CU3jGXaBX3TLR24iY9SPcoFWbg5vKpyFKQMjuk9DFckt?amount=2&spl-token=Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB&label=Solana%20Forensics%20MCP%20-%20Starter`
  - USDC: `solana:CU3jGXaBX3TLR24iY9SPcoFWbg5vKpyFKQMjuk9DFckt?amount=2&spl-token=EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v&label=Solana%20Forensics%20MCP%20-%20Starter`
  - SOL: `solana:CU3jGXaBX3TLR24iY9SPcoFWbg5vKpyFKQMjuk9DFckt?label=Solana%20Forensics%20MCP%20-%20Starter`
- **Builder ($5):**
  - USDT: `solana:CU3jGXaBX3TLR24iY9SPcoFWbg5vKpyFKQMjuk9DFckt?amount=5&spl-token=Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB&label=Solana%20Forensics%20MCP%20-%20Builder`
  - USDC: `solana:CU3jGXaBX3TLR24iY9SPcoFWbg5vKpyFKQMjuk9DFckt?amount=5&spl-token=EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v&label=Solana%20Forensics%20MCP%20-%20Builder`
- **Pro 30-Day Pass ($15):**
  - USDT: `solana:CU3jGXaBX3TLR24iY9SPcoFWbg5vKpyFKQMjuk9DFckt?amount=15&spl-token=Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB&label=Solana%20Forensics%20MCP%20-%20Pro%2030d`
  - USDC: `solana:CU3jGXaBX3TLR24iY9SPcoFWbg5vKpyFKQMjuk9DFckt?amount=15&spl-token=EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v&label=Solana%20Forensics%20MCP%20-%20Pro%2030d`

#### Redeem Immediately

Once your Solana transaction confirms, redeem it immediately for a live API key:

```bash
curl -s -X POST https://solana-forensics-mcp.nguyenthanhnam-pye.workers.dev/v1/keys/redeem \
  -H "Content-Type: application/json" \
  -d '{"txSignature":"<CONFIRMED_MAINNET_TX_SIG>","pack":"builder"}' | jq .
```

Then pass the returned key via `X-API-Key: sf_live_...` or `Authorization: Bearer sf_live_...` on any REST or `/mcp` request (or pass a single-call payment proof directly via `X-Solana-Tx: <TX_SIG>`).

---

## Machine Discovery Endpoints

- **OpenAPI 3.1 Spec:** `GET https://solana-forensics-mcp.nguyenthanhnam-pye.workers.dev/openapi.json`
- **MCP Server Card:** `GET https://solana-forensics-mcp.nguyenthanhnam-pye.workers.dev/.well-known/mcp/server-card.json`
- **x402 Resource Discovery:** `GET https://solana-forensics-mcp.nguyenthanhnam-pye.workers.dev/.well-known/x402.json`
- **Service Health:** `GET https://solana-forensics-mcp.nguyenthanhnam-pye.workers.dev/health`
- **Credit Packs Catalog:** `GET https://solana-forensics-mcp.nguyenthanhnam-pye.workers.dev/v1/packs`

---

## Self-Hosting & Testing

```bash
# Run deterministic unit tests (Node.js >= 20)
node --test test/*.test.js

# Configure your own Cloudflare Worker + KV namespaces
cp wrangler.example.toml wrangler.toml
# Replace placeholder KV IDs and settlement wallet in wrangler.toml, then deploy:
npx wrangler deploy
```

## License

[MIT](LICENSE)