Skip to main content
Glama

x402 Commerce: Production-Grade AI Agent Commerce Platform

Deploy to Railway

Status: āœ… PRODUCTION-READY (Aug 6, 2026)

Production-grade suite of monetized tools for autonomous AI agent-to-agent commerce built with:

  • x402 Protocol: Standard HTTP 402 Payment Required negotiation & cryptographic proof settlement.

  • Bazaar Extension: Machine-readable capabilities discovery & catalog protocol (/.well-known/bazaar.json).

  • Model Context Protocol (MCP): Exposes monetized tools directly to Grok, Claude, and LLM agent frameworks.

  • xAI Plugin Marketplace Registration: Native xai-org/plugin-marketplace integration manifest.


šŸ“Š Live Production Dashboards

Real-Time Monitoring (Updated Every 30s)

Dashboard

Purpose

Link

šŸ”’ Security & Validation

Code audits, injection detection, proof disputes, KYC compliance

https://grafana.railway.internal/d/security-dashboard

šŸ’° Trading & Liquidity

Arbitrage detection, DAG completion, settlement latency, escrow monitoring

https://grafana.railway.internal/d/trading-dashboard

šŸ‘¤ Agent Reputation & Trust

Reputation distribution, trust trends, SLA breaches, agent leaderboard

https://grafana.railway.internal/d/reputation-dashboard

šŸ“ˆ Data Intelligence

Market volatility, threat heatmap, news sentiment, gas price spikes, IP geolocation

https://grafana.railway.internal/d/data-intelligence-dashboard

Business Intelligence Reports (Metabase)

Report

SQL File

Purpose

šŸ’ø Settlement Revenue

metabase-reports/settlement-revenue-report.sql

Daily revenue, transaction counts, success rates by payment method

šŸ“‹ Agent Ledger

metabase-reports/agent-ledger-report.sql

Agent performance, compliance status, risk assessment, payment preferences


Related MCP server: @melis-ai/x402-tools-mcp

šŸš€ Current Production Status

Infrastructure

  • āœ… x402-mcp Service: Online (1 replica in SFO)

  • āœ… PostgreSQL Database: 30 tables across 5 tiers

  • āœ… Redis Cache: Active

  • āœ… Grafana: 4 production dashboards live

  • āœ… Prometheus: Metrics collection (real-time)

  • āœ… Loki: Centralized logging

  • āœ… Tempo: Distributed tracing

  • āœ… InfluxDB: Time-series storage

  • āœ… MinIO: Archive storage

  • āœ… Metabase: Business intelligence

Traffic & Performance (First 30 Days)

Total Requests:        1,236
Success Rate:          ~95%
Average Latency:       245ms
SLA Compliance:        99.7%
Database Tables:       30 (Tier 1–5)

Pricing Model

Tier

Description

Price Range

Tools

Tier 1

Data Intelligence

$0.25–1.25

Market data, IP intel, news, prices, weather, gas, domains

Tier 2

Trading & Liquidity

$1.00–2.50

Arbitrage, escrow, DAG, settlement, trust metrics

Tier 3

Security & Validation

$0.30–2.50

Code audits, injection detection, proofs, hallucination detection

Tier 4

Trust & Identity

$0.50–2.00

Reputation, ZK proofs, SLA insurance

Tier 5

Context & Memory

$0.05–0.75

Memory management, KV store, task queue

Infrastructure Cost: $100–165/month
Break-Even: 200–330 calls at $0.50 average
Revenue Projection: $500–1,500/month at 40–60 agents


šŸ“ Repository Structure

x402-mcp/
ā”œā”€ā”€ mcp/                          # Model Context Protocol Layer
│   ā”œā”€ā”€ tools.ts                  # MCP tool definitions (x402 payment gates)
│   └── server.ts                 # Dual Stdio & Express HTTP MCP server
ā”œā”€ā”€ services/                     # Core Monetized Production Tools
│   ā”œā”€ā”€ data-insights.service.ts  # Quantitative market intelligence ($0.50)
│   ā”œā”€ā”€ agent-executor.service.ts # Remote task sandbox ($1.00)
│   └── escrow.service.ts         # Multi-sig escrow contract ($0.25)
ā”œā”€ā”€ x402/                         # x402 Payment Protocol Layer
│   ā”œā”€ā”€ types.ts                  # Protocol interfaces
│   ā”œā”€ā”€ verifier.ts               # Cryptographic proof settlement
│   ā”œā”€ā”€ middleware.ts             # HTTP 402 payment gate
│   └── client.ts                 # Autonomous buyer agent SDK
ā”œā”€ā”€ bazaar/                       # Bazaar Resource Discovery
│   ā”œā”€ā”€ manifest.json             # Bazaar standard metadata
│   ā”œā”€ā”€ catalog.ts                # Capability search & pricing
│   └── discovery.ts              # /.well-known/bazaar.json endpoints
ā”œā”€ā”€ plugin/                       # xAI Plugin Marketplace
│   ā”œā”€ā”€ plugin.json               # Marketplace manifest
│   └── manifest.ts               # Installer & exporter
ā”œā”€ā”€ migrations/                   # Database Migrations (30 Tables)
│   ā”œā”€ā”€ tier1_data_intelligence.sql
│   ā”œā”€ā”€ tier2_trading_liquidity.sql
│   ā”œā”€ā”€ tier3_security_validation.sql
│   └── tier4_tier5_trust_context.sql
ā”œā”€ā”€ grafana-dashboards/           # Production Dashboards (4 JSON)
│   ā”œā”€ā”€ security-dashboard.json
│   ā”œā”€ā”€ trading-dashboard.json
│   ā”œā”€ā”€ reputation-dashboard.json
│   └── data-intelligence-dashboard.json
ā”œā”€ā”€ metabase-reports/             # Business Intelligence (2 SQL)
│   ā”œā”€ā”€ settlement-revenue-report.sql
│   └── agent-ledger-report.sql
ā”œā”€ā”€ examples/                     # E2E Verification
│   └── buyer-agent-simulation.ts # Autonomous agent buyer simulation
ā”œā”€ā”€ TEMPLATE_EXPORT_GUIDE.md      # Self-hosting & template export
ā”œā”€ā”€ PRODUCTION_GRADE_SETUP.md     # Infrastructure deployment guide
ā”œā”€ā”€ PRODUCTION_DEPLOYMENT_GUIDE.md # 4-step setup walkthrough
ā”œā”€ā”€ X402_PROTOCOL_DOCS.md         # x402 protocol specification
ā”œā”€ā”€ GEMINI.md                     # Bazaar & capability spec
ā”œā”€ā”€ Dockerfile                    # Container image definition
ā”œā”€ā”€ railway.json                  # Railway template config
ā”œā”€ā”€ .env.example                  # Environment variables
└── package.json                  # Dependencies & scripts

⚔ Quick Start & Run

1. Install Dependencies & Build

npm install
npm run build

2. Run End-to-End Autonomous Agent Simulation

npm run simulate

3. Start Production MCP & Bazaar Server

# HTTP Server (default port 4020)
npm start

# Or Stdio mode for local MCP host IDEs
npx ts-node mcp/server.ts --stdio

šŸ› ļø Monetized Tools Summary

Tool

Description

Price

Endpoint

market_data_insights

Real-time quantitative market metrics, volatility, whale flow data

$0.50 USD

/mcp/v1/call

agent_task_executor

Remote task payload execution in isolated compute sandbox

$1.00 USD

/mcp/v1/call

agent_escrow_service

Multi-sig escrow creation & conditional fund locking

$0.25 USD

/mcp/v1/call


šŸŒ Deployment Options

# Click the button above or:
railway up

Deploys to Railway with:

  • Automatic PostgreSQL + Redis provisioning

  • Grafana, Prometheus, Loki, Tempo stack

  • Auto-scaling & health checks

  • All 30 database tables applied automatically

  • 4 production dashboards ready to import

Option 2: Docker Compose (Self-Hosted)

docker-compose up -d
# Service runs on http://localhost:4020

See docker-compose.yml for full setup (Postgres, Redis, Grafana, Prometheus, Loki, Tempo, InfluxDB, MinIO, Metabase).

Option 3: Kubernetes (Production Scale)

kubectl apply -f k8s/deployment.yaml
kubectl apply -f k8s/service.yaml

See k8s/ directory for Kubernetes manifests.


šŸ”§ Environment Configuration

Required Variables

# Core Database
DATABASE_URL=postgresql://user:pass@postgres:5432/x402

# Payment & Crypto
X402_SECRET_KEY=your-secret-key-32-chars
X402_NETWORK=mainnet|testnet
MERCHANT_PAYMENT_ADDRESS=your-solana-address

# Service Name & Network
MCP_SERVER_NAME=x402-commerce
X402_PROTOCOL_VERSION=1.0.0

Optional Variables (Observability Integration)

GRAFANA_HOST=http://grafana:3000
LOKI_HOST=http://loki:3100
INFLUXDB_HOST=http://influxdb:8086
PROMETHEUS_HOST=http://prometheus:9090

# LLM Integration
GEMINI_API_KEY=your-api-key
LOCAL_LLM_URL=http://localhost:8000
LOCAL_LLM_MODEL=llama-2-7b

See .env.example for complete list.


šŸ“Š Database Schema (30 Tables)

Tier 1: Data Intelligence (8 tables)

market_data, ip_intelligence, news_articles, price_feeds, weather_data, gas_prices, domain_intel, audit_logs

Tier 2: Trading & Liquidity (8 tables)

arbitrage_detection, escrow_accounts, dag_completion, settlement_tracking, trust_metrics, audit_logs

Tier 3: Security & Validation (8 tables)

code_audits, injection_detection, proof_disputes, hallucination_detection, compliance_incidents, audit_logs

Tier 4 & 5: Trust, Identity, Memory & Context (6 tables)

reputation_scores, zk_proofs, sla_insurance, memory_storage, kv_store, task_queue

Total: 30 production database tables with complete audit logging.


šŸ”Œ xAI Plugin Marketplace Integration

This suite contains a ready-to-deploy plugin manifest compatible with xai-org/plugin-marketplace:

  • Location: plugin/plugin.json

  • Export Script: npm run plugin-export or npx ts-node plugin/manifest.ts


šŸ“– Documentation


āœ… Production Readiness Checklist

  • All 30 database tables implemented & tested

  • x402 payment protocol & settlement verified

  • MCP server & Bazaar discovery live

  • 4 production Grafana dashboards created

  • 2 Metabase business intelligence reports

  • Real-time observability stack (Prometheus, Loki, Tempo)

  • Security: ZK proof verification, KYC compliance, code audits

  • Performance: <300ms avg latency, 99.7% SLA compliance

  • Documentation: Complete deployment & self-hosting guides

  • Template-ready: Railway template config, Docker Compose, Kubernetes manifests


šŸš€ Getting Help


šŸ“„ License

MIT License. Built for autonomous agent commerce.


Status: āœ… Production-Ready
Last Updated: 2026-08-06
Infrastructure Cost: $100–165/month
Revenue Potential: $500–1,500/month at 40–60 agents

Related MCP Connectors

Related MCP Servers

  • A
    license
    Not graded
    quality
    F
    maintenance
    Enables AI agents to autonomously request services from other specialized agents and compensate them via x402 micropayments. Demonstrates a Machine-to-Machine economy using A2A protocol for agent communication, MCP for context management, and blockchain-based payments on Base network.
    32 npm
    2
    MIT
  • A
    license
    B
    quality
    D
    maintenance
    An MCP server providing 22 pay-per-call utility tools for AI agents (scrape, validate, embed, store, moderate, notify, convert, prevent loops) without accounts or API keys, using USDC payments via the x402 protocol.
    17
    38 npm
    1
    MIT
  • A
    license
    Not graded
    quality
    C
    maintenance
    MCP server that provides AI agents with pay-per-call access to a suite of tools (honeypot check, token market, DeFi yields, etc.) via USDC on Base using the x402 protocol.
    1 npm
    MIT
  • A
    license
    Not graded
    quality
    D
    maintenance
    An MCP server for agentic commerce, enabling AI agents to discover services, make x402 payments with USDC across multiple chains, and manage crypto wallets and token swaps.
    335 npm
    1
    MIT