Quick Start
Prerequisites
- Node.js >= 20
- npm or pnpm
Installation
npm install x402-relayConfiguration
Copy the example environment file:
cp .env.example .envKey variables:
| Variable | Description | Required |
|---|---|---|
API_KEY | Admin API key for service management | Yes |
DB_PATH | SQLite database path | No (default: ./x402-hub.db) |
PORT | Server port | No (default: 3402) |
SCAN_INTERVAL_MS | Discovery scan interval | No (default: 3600000) |
Start the Server
# Developmentnpm run dev
# Productionnpm run build && npm startThe API is now available at http://localhost:3402.
Verify
# Health checkcurl http://localhost:3402/health
# List categoriescurl http://localhost:3402/api/categories
# Search servicescurl http://localhost:3402/api/services?query=AIConnect an AI Agent (MCP)
Add to your Claude Desktop config (claude_desktop_config.json):
{ "mcpServers": { "x402-hub": { "command": "npx", "args": ["@x402relay/mcp"] } }}Next Steps
- How It Works — Understand the protocol
- Register Your API — Add your API to the catalog
- API Reference — Full endpoint documentation