- Gate endpoints behind x402 USDC paywalls
- Publish a machine-readable manifest at
/.well-known/agent.json - Expose a trust score at
/reputation - Register on the decentralized Solana registry for autonomous discovery
Prerequisites
- Node.js ≥ 18
- pnpm (
npm install -g pnpm) - A Solana Devnet wallet with a small amount of SOL (for the one-time on-chain registration)
Option A: Use the Reference Server
Clone the repo and run as-is — then add your own routes.Build & Start
| Endpoint | Auth | Description |
|---|---|---|
GET /.well-known/agent.json | None | Service manifest |
GET /reputation | None | Trust score |
GET /registry | None | All registered agents |
GET /api/fetch-price/:token | x402 (0.05 USDC) | Live token prices |
GET /api/analyze-token/:address | x402 (0.1 USDC) | Token security analysis |
Add Your Own Routes
Create new files in
packages/mcp-server/src/api/routes/services/. Each route needs:- A route handler with your business logic
- The
x402Paywall(amount, USDC_MINT)middleware to enforce payment - An entry in the service manifest
/.well-known/agent.json is what buyer agents read to decide what to buy. Keep it accurate.Option B: Use the SDK in Your Own App
If you already have an Express.js server, install the SDK and add paywalls to your existing routes:Register On-Chain
Register your merchant on the decentralized Solana registry so buyer agents can discover you: Using the CLI:How Buyers Find and Pay You
Once you’re registered, the buyer flow is fully autonomous:| Step | What happens |
|---|---|
1. discover_registry | Buyer scans Solana for registered merchants via SPL Memo |
2. read_manifest | Buyer fetches /.well-known/agent.json — sees your services and pricing |
3. check_reputation | Buyer checks /reputation — success rate, total transactions |
4. probe_x402 | Buyer confirms the on-chain payment requirements |
5. pay_x402_invoice | Buyer sends USDC → Solana tx confirmed → data returned |