Skip to content

Quick Start

Prerequisites

  • Node.js >= 20
  • npm or pnpm

Installation

Terminal window
npm install x402-relay

Configuration

Copy the example environment file:

Terminal window
cp .env.example .env

Key variables:

VariableDescriptionRequired
API_KEYAdmin API key for service managementYes
DB_PATHSQLite database pathNo (default: ./x402-hub.db)
PORTServer portNo (default: 3402)
SCAN_INTERVAL_MSDiscovery scan intervalNo (default: 3600000)

Start the Server

Terminal window
# Development
npm run dev
# Production
npm run build && npm start

The API is now available at http://localhost:3402.

Verify

Terminal window
# Health check
curl http://localhost:3402/health
# List categories
curl http://localhost:3402/api/categories
# Search services
curl http://localhost:3402/api/services?query=AI

Connect an AI Agent (MCP)

Add to your Claude Desktop config (claude_desktop_config.json):

{
"mcpServers": {
"x402-hub": {
"command": "npx",
"args": ["@x402relay/mcp"]
}
}
}

Next Steps