x402 Data & Security MCP Server
by spleyapp
README.md
# SpleyLabs x402 Paid Data, Security & MCP Intelligence API (`v1.3.1`)
**Zero-KYC, zero-dependency, pay-per-request AI, RAG, Agent Supply-Chain Pre-Flight Security (with GitHub `<7d` star-spike stealer-trap detection), Agency GEO / Agentic Readiness, Post-Quantum Security (ML-KEM/P-256), `DESIGN.md`, B2B Enrichment & Market Intelligence APIs — exposed over BOTH REST x402 AND Streamable HTTP MCP (`POST /mcp`, `2025-06-18`, 22 tools) + 0.00%-fee Sovereign Direct-USDC B2B Bulk Invoices (14 SKUs) — settling USDC directly to Solana, Base, Polygon, and Arbitrum.**
[](https://railway.com?referralCode=9ObSep)
---
## Why This Exists
Autonomous AI agents, MCP clients, RAG pipelines, security scanners, and lead-enrichment workflows shouldn't need API keys, credit cards, monthly subscriptions, or KYC forms to query live structured web intelligence.
This server implements **x402 v2 (`PAYMENT-SIGNATURE` / `PAYMENT-REQUIRED`) + x402 v1 (`X-PAYMENT`)**, **Streamable HTTP MCP `2025-06-18` (`POST /mcp`)**, **0.00%-fee Sovereign Direct-USDC B2B Invoices (`/v1/invoice/*`)**, **OpenAPI 3.1 (`x-payment-info` + `info.x-guidance`)**, **RFC 9727 `/.well-known/api-catalog`**, **Google A2A 0.3.0 `/.well-known/agent-card.json`**, **ERC-8004 `/.well-known/agent-registration.json`**, and **ClawHub `SKILL.md`** with **zero npm dependencies** (`"dependencies": {}`), running identically on **Node.js 20+**, **Docker / Railway**, **Akash Network**, **Cloudflare Workers**, and **Deno 2**.
- **Streamable HTTP MCP-over-x402 (`POST /mcp`, `2025-06-18`)**: Native JSON-RPC 2.0 MCP endpoint exposing **22 tools** (10 free preview tools + 10 x402-gated paid tools accepting HTTP `PAYMENT-SIGNATURE`/`X-PAYMENT` OR MCP `_meta["x402/payment"]` + 2 Direct-USDC B2B invoice tools), matching the MCP service declared in `/.well-known/agent-registration.json`.
- **Solana + Base Co-First USDC Rails**: Per-call micro-payments settle directly to your Solana or EVM wallet via [`https://facilitator.payai.network`](https://facilitator.payai.network) (0% platform cut, zero KYC, zero payout hold).
- **0.00%-Fee Sovereign Direct-USDC B2B Bulk Checkout (14 Verified SKUs)**: Issue micro-penny EIP-681 & Solana Pay invoices (`POST /v1/invoice`) and verify settlement directly against Base, Arbitrum, Polygon, and Solana Mainnet RPCs (`POST /v1/invoice/verify`, fast-fail `4s` RPC timeout for Cloudflare Workers compatibility) with zero intermediary fees.
- **Never Charged on Failure**: Payment is verified cryptographically (`/verify`) before extraction, and **settled on-chain (`/settle`) ONLY after live upstream extraction succeeds**. Upstream 5xx errors return `paymentCharged: false` and never settle.
- **Replay & SSRF Hardened**: In-flight nonce locking + bounded replay cache prevents concurrent TOCTOU replay attacks; strict public-host validation blocks `.internal`, `.local`, `.nip.io`, IP literals, and private DNS/redirect hops (`HTTP 400`).
- **Strict 0% Russia / 0% Belarus Policy**: Enforced across REST GET/POST inputs, MCP `tools/call`, B2B invoice buyer & `buyerOrg` checks, BCP-47 locales (`ru-*`, `be-*` blocked; Belgium `country=be` / `fr-BE` allowed), Android/iOS store IDs, redirects, and extracted contacts (`HTTP 451`).
- **AgentCash / x402scan / x402-list Ready**: Passes **15/15** automated pre-flight signability, MCP & discovery checks (`npm run preflight -- <BASE_URL>`).
---
## Paid Endpoints & Unit Pricing (10 Zero-Proxy Engines)
| Endpoint | Free Preview | Price (USDC) | Atomic Units | What It Returns |
|---|---|---:|---:|---|
| `GET \| POST /v1/security/agent-preflight` | `/v1/preview/security/agent-preflight` | **$0.020** | `20000` | Agent Supply-Chain, GitHub Star-Spike & x402 Pre-Flight Auditor: static scan (Trojan-Source bidi Unicode, `curl\|sh` RCE, `~/.ssh`/`.env` exfil, prompt injection, webhook sinks, RU/BY endpoints) + **GitHub `<7d` repo age + sudden star-spike stealer-trap detection** + live x402 `402` canonical USDC/EIP-712 check -> `CLEAR \| HOLD \| ABORT` |
| `GET \| POST /v1/audit/agentic-readiness` | `/v1/preview/audit/agentic-readiness` | **$0.020** | `20000` | Agency GEO & Agentic Commerce Readiness Audit: 6-bot `robots.txt` AI crawler matrix, 9-protocol discovery matrix (`/llms.txt`, `llms-full.txt`, `ucp`, `x402`, `a2a`, `erc-8004`, `api-catalog`, `openapi`, `sitemap`), JSON-LD `@type` schemas, OpenGraph, non-circular Tailwind v4 `@theme` CSS, graceful WAF/429 fallback & 0–100 score/grade |
| `GET \| POST /v1/security/pqc-audit` | `/v1/preview/security/pqc-audit` | **$0.010** | `10000` | Live Post-Quantum Cryptography audit: TLS 1.3 `X25519MLKEM768` KEX + leaf X.509 P-256 curve (Node runtime), DNSSEC Alg 13 (`P-256`) via DoH, OIDC/JWKS `ES256`, HSTS/HTTP3, A–F grade & H1 2027 remediation plan |
| `GET \| POST /v1/design/extract-design-md` | `/v1/preview/design/extract-design-md` | **$0.010** | `10000` | Live website + stylesheet token extraction -> ranked hex palette, up to 120 CSS custom properties, web fonts, radii, shadows, breakpoints, dark mode & drop-in `DESIGN.md` |
| `GET \| POST /v1/apps/reviews` | `/v1/preview/apps/reviews` | **$0.005** | `5000` | Unified iOS App Store + Android Google Play reviews (auto country->language mapping), hybrid sentiment, 11-topic pain points, bug/feature extraction & version regression alerts |
| `GET \| POST /v1/websites/enrich` | `/v1/preview/websites/enrich` | **$0.005** | `5000` | B2B domain enrichment: emails (incl. Cloudflare `data-cfemail` XOR decode), LinkedIn/X/GitHub/YouTube profiles, 25-tool tech stack, pricing/careers/docs signals, `llms.txt` & `robots.txt` AI-crawler policy |
| `GET \| POST /v1/shopify/catalog` | `/v1/preview/shopify/catalog` | **$0.003** | `3000` | Deduplicated Shopify product catalog, variant price/discount/stock metrics, 21-app tech stack detector, `llms.txt` + `/.well-known/ucp` agentic readiness audit |
| `GET \| POST /v1/youtube/transcript` | `/v1/preview/youtube/transcript` | **$0.002** | `2000` | Full timestamped captions, Markdown, optional SRT, overlapping RAG chunks with `youtu.be/{id}?t=` deep-links & video metadata |
| `GET \| POST /v1/youtube/channel` | `/v1/preview/youtube/channel` | **$0.002** | `2000` | Canonical `UC...` channel ID, subscriber/view counts, extracted business inquiry emails, external social links & 15 latest RSS videos |
| `GET \| POST /v1/google/trends` | `/v1/preview/google/trends` | **$0.002** | `2000` | Google Trends interest-over-time, computed momentum/direction (`surging`/`rising`/`declining`), up to 5-keyword comparison, regional breakdown, breakout queries & Daily Trending RSS |
> Need Google Ads Transparency Center data (which enforces residential-proxy rate limits on direct IPs)? Use our verified managed Apify Actor: [`spleylabs/google-ads-transparency-api`](https://apify.com/spleylabs).
### Streamable HTTP MCP over x402 (`POST /mcp`, Protocol `2025-06-18`)
- `POST /mcp` — JSON-RPC 2.0 (`initialize`, `ping`, `notifications/initialized`, `tools/list`, `tools/call`; batch up to 10 calls; `DELETE /mcp` stateless teardown).
- Exposes **22 tools**: 10 free rate-limited `preview_*` tools + 10 x402-gated paid tools (accepting `PAYMENT-SIGNATURE`/`X-PAYMENT` HTTP headers OR `params._meta["x402/payment"]`) + 2 Sovereign Direct-USDC B2B invoice tools (`list_b2b_invoice_catalog`, `create_b2b_usdc_invoice`).
- Unpaid calls to paid MCP tools return **HTTP `402` + `PAYMENT-REQUIRED` header + JSON-RPC error `code: 402`** with full v1/v2 accepts metadata.
### 0.00%-Fee Sovereign Direct-USDC B2B Bulk-Pack Checkout (Free to Quote & Verify)
- `GET /v1/invoice/catalog` — Lists all **14 verified B2B bulk dataset & recurring intelligence SKUs** (`$79–$500` USDC, covering **`PQC-Radar`**, **`AgentGuard`** (`agentguard-pack-100` `$199`, `agentguard-enterprise-mo` `$299/mo`), **`Agentic-GEO`**, **`SponsorGraph AI`**, creator/churn feeds & custom pipelines)
- `POST /v1/invoice` — Generates a deterministic micro-penny reconciled invoice with **EIP-681** (Base, Arbitrum, Polygon) & **Solana Pay** (`solana:...&memo=`) URIs under strict 0% RU/BY compliance (`HTTP 451` on blocked countries/orgs/locales/domains; Belgium `BE` allowed)
- `POST /v1/invoice/verify` — Live on-chain RPC verification (fast-fail `4s` timeout, Base/Arbitrum/Polygon `eth_getTransactionReceipt` + Solana `getTransaction` with net token accounting, server-authoritative `storedInv` amount/timestamp lock, replay guard)
### Machine-Readable Discovery Routes (Free, `security: []`)
- `GET /.well-known/x402` (alias `/.well-known/x402.json`) — AgentCash & Bazaar discovery (`version: 1, x402Version: 2`, 10 URL string `resources` + full `endpoints`)
- `GET /openapi.json` — OpenAPI 3.1.0 compliant with x402scan (`info.x-guidance`, `x-payment-info`, `security: []` on free, MCP & invoice routes)
- `GET /.well-known/api-catalog` — RFC 9727 `application/linkset+json`
- `GET /.well-known/agent-card.json` (alias `/.well-known/agent.json`) — Google A2A `0.3.0` Agent Card (**10 skills**)
- `GET /.well-known/agent-registration.json` — ERC-8004 (`eip-8004#registration-v1`) manifest (declares live `POST /mcp` `2025-06-18` service)
- `GET /llms.txt` — Progressive AgentCash & LLM integration guide
- `GET /health` — Live uptime + PayAI facilitator `/supported` reachability & dynamic Solana `feePayer`
---
## Payment Rails (Mainnet Verified)
Verified live against `https://facilitator.payai.network/supported` & `POST /verify`, and on-chain via `eth_call` (`name()="USD Coin"`, `version()="2"`):
| Priority | Network | x402 v2 (CAIP-2) | x402 v1 | USDC Asset Contract / Mint | Recipient Wallet (`payTo`) |
|---:|---|---|---|---|---|
| 1 | **Solana** | `solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp` | `solana` | `EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v` | `7dhXhA8b3CPP8oZDK8kF74jPWmHnwK8ykDUNyFZecce4` |
| 2 | **Base** | `eip155:8453` | `base` | `0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913` | `0xa32816145ddB4c141E635022fE50917f3ec4b978` |
| 3 | **Polygon** | `eip155:137` | `polygon` | `0x3c499c542cEF5E3811e1192ce70d8cC03d5c3359` | `0xa32816145ddB4c141E635022fE50917f3ec4b978` |
| 4 | **Arbitrum** | `eip155:42161` | `arbitrum` | `0xaf88d065e77c8cC2239327C5EDb3A432268e5831` | `0xa32816145ddB4c141E635022fE50917f3ec4b978` |
Override defaults with `X402_SOLANA_PAY_TO`, `X402_EVM_PAY_TO`, `X402_FACILITATOR_URL`, and `PUBLIC_BASE_URL` when self-hosting (honored by x402 challenges, MCP paid tools, and `/v1/invoice` URIs).
---
## Live Empirical Benchmark (`BENCHMARK_RESULTS.json`, 2026-12-06)
Measured via `npm run bench` (Node.js v24.21.0, **0 dependencies**, **10/10 live zero-proxy queries passed**):
| Query | Endpoint | Latency | Payload | Verified Live Output |
|---|---|---:|---:|---|
| `github.com/spleyapp/spley-x402-data-api` Supply-Chain Audit | `/v1/security/agent-preflight` | **106 ms** | 0.3 KB | Auto-fetched `SKILL.md` + GitHub repo trust -> `verdict: CLEAR`, `riskScore: 0` |
| `cloudflare.com` PQC & P-256 Audit | `/v1/security/pqc-audit` | **146 ms** | 1.8 KB | Grade `C` (65/100): `X25519MLKEM768` (`hasMlKem=true`), leaf `prime256v1`, DNSSEC Alg 13 `P-256` |
| 3Blue1Brown 19m talk (`aircAruvnKk`) | `/v1/youtube/transcript` | **226 ms** | 128.9 KB | **3,357 words**, 286 segments, **16 RAG chunks** + SRT (`innertube-ios`) |
| `posthog.com` B2B Enrichment | `/v1/websites/enrich` | **250 ms** | 0.8 KB | Title, `linkedin`/`x`/`github`, `Gatsby, React, Tailwind CSS, Vercel, PostHog`, `llms.txt=true` |
| ChatGPT iOS + Android (30+30) | `/v1/apps/reviews` | **426 ms** | 28.5 KB | **60 live reviews** (30 Apple + 30 Google Play), avg `4.02★`, top pain `billing_subscription` |
| `stripe.com` -> `DESIGN.md` | `/v1/design/extract-design-md` | **448 ms** | 12.0 KB | 3 stylesheets, 16 ranked hex colors, **120 CSS vars**, 3.5 KB drop-in `DESIGN.md` |
| Marques Brownlee (`@mkbhd`) | `/v1/youtube/channel` | **549 ms** | 4.3 KB | `UCBJycsmduvYEL83R_U4JriQ`, 21.5M subs, `business@MKBHD.com`, 16 links, 15 RSS videos |
| `allbirds.com` (in-stock 50) | `/v1/shopify/catalog` | **616 ms** | 59.9 KB | **50/50 unique products**, median `$18 USD`, `Yotpo, Attentive, Shop Pay`, `llms.txt` + `ucp` |
| `cloudflare.com` GEO & Agentic Readiness | `/v1/audit/agentic-readiness` | **742 ms** | 1.3 KB | Score **`94/100` (`Grade A`)**, `llms.txt=true`, RFC 9727 `api-catalog=true`, `openapi.json=true`, 3 JSON-LD types |
| `ai agents` US 3m + Daily Trending | `/v1/google/trends` | **754 ms** | 24.1 KB | 92 timeline pts, momentum `-20.1%`, 25 regions, 10 breakout queries, 10 Daily Trending items |
---
## Quickstart & Multi-Cloud Deployment
### 1. Run Locally & Test with the Zero-Dep Buyer SDK Quickstart
```bash
# Terminal 1: Start server (Node.js 20+, zero npm install required)
node src/server.mjs
# Terminal 2: Run zero-dep buyer quickstart (Discovery + Free Preview + x402 v2 Challenge + Streamable HTTP MCP)
node examples/x402-client-quickstart.mjs http://127.0.0.1:3402
# Or run on Deno 2+ (0 node:* imports)
deno run --allow-net --allow-env src/deno.mjs
```
### 2. Deploy Globally in One Command
- **Cloudflare Workers Free (100K req/day, $0/mo, 0 `node:*` imports in `src/worker.mjs`):**
```bash
npx wrangler deploy
```
- **Deno Deploy Free (1M req/mo, $0/mo):** Import this repo with entrypoint `src/deno.mjs`.
- **Akash Network Sovereign Crypto Compute (`~$3–$5/mo` in USDC/AKT, full `node:tls` ML-KEM sockets, zero credit card):** Deploy directly with [`akash-deploy.yaml`](./akash-deploy.yaml) (SDL v2.0).
- **Railway (1-click Docker + `railway.json` `/health` check):** Deploy via [Railway](https://railway.com?referralCode=9ObSep).
- **Docker / Render / Fly.io:** Pre-configured `Dockerfile`, `render.yaml`, and `fly.toml`.
### 3. Pre-Flight Check & Directory Registration
Once deployed to a persistent public HTTPS URL, verify all **15** signability, MCP & discovery gates and register across AgenticTrade, 402index, x402-list, and x402scan:
```bash
# Dry-run 15-point pre-flight against local or live server
node scripts/submit-directories.mjs http://127.0.0.1:3402
# Live programmatic submission (strictly refuses localhost/tunnels/static hosts)
node scripts/submit-directories.mjs https://your-live-origin.com --submit
```
---
## Automated Tests
```bash
npm test # 14 protocol, MCP 2025-06-18, GitHub star-spike trap, buyer quickstart, x402scan, A2A, ERC-8004, Direct-USDC invoice, PayAI live /verify, SSRF, RU/BY & CF Worker graph tests
npm run test:live # 14 live real-world upstream extraction tests across all 10 endpoints
npm run test:all # Complete 28-test suite
npm run bench # Live 10-endpoint latency & yield benchmark
```
---
## SpleyLabs Ecosystem
- **Managed Apify Store Actors**: https://apify.com/spleylabs
- **Official MCP Server**: https://github.com/spleyapp/spley-mcp-data-apis
- **Direct-USDC B2B Datasets & 0%-Fee Checkout**: https://spleyapp.github.io/spley-mcp-data-apis/pay/
- **n8n AI Workflows**: https://github.com/spleyapp/n8n-ai-data-workflows
- **Agent Skill (`ClawHub` / Claude Code / Cursor)**: [`SKILL.md`](./SKILL.md)
This server cannot be deployed
Maintenance
ActivityMaintained
ResponsivenessNo recent community issues