All projects

MCPay

CRE-verified x402 payment gateway enabling AI agents to buy premium MCP tools with on-chain proof

CRE & AI DeFi & Tokenization Thirdweb

What it is

MCPay solves a critical gap in the x402 agent economy: trust. With 251+ x402 services and 50M+ transactions, AI agents can pay for tools — but nobody verifies delivery. When an agent pays $0.05 for a premium MCP security scan, the x402 facilitator confirms payment settled, but what if the MCP server returns garbage data? Or charges without delivering?

MCPay is a CRE-powered trust layer that sits on top of existing x402 infrastructure. It uses Chainlink CRE to orchestrate the complete lifecycle of a paid agent-to-MCP transaction:

  1. Pre-flight Check — CRE reads spending policies from ShieldVault.sol on Base Sepolia
  2. x402 Payment — Agent pays USDC via Coinbase facilitator on Base Sepolia
  3. Service Delivery — CRE calls the premium MCP server and captures the response
  4. Quality Validation — Off-chain compute validates response schema and quality scoring
  5. On-chain Attestation — DON consensus writes verifiable proof to ShieldVault.sol

The demo showcases OpenClaw (autonomous security agent on Telegram) purchasing a premium smart contract vulnerability scanner MCP tool, with the entire payment and verification flow visible on Base Sepolia.

No existing x402 gateway (Vercel x402-mcp, ElizaOS mcp-gateway, Foldset, Kobaru) verifies service delivery. MCPay is the first to add CRE-verified trust to agent payments.

How it Works

MCPay is built with a modular architecture across 5 components:

  • CRE Workflow (TypeScript): Orchestrates the full verify-pay-attest pipeline using @chainlink/cre-sdk. Handles HTTP triggers, external API calls, off-chain quality validation, and on-chain writes to Base Sepolia via DON consensus.

  • ShieldVault.sol (Solidity/Foundry): Smart contract on Base Sepolia storing attestations (payment hash, service hash, quality score), spending policies (max per call, daily limits), and dispute signals. Written to by the CRE workflow.

  • Backend API (Express.js on AWS EC2): REST API + WebSocket server that connects the frontend to the x402 payment flow. Uses ethers.js for real Base Sepolia transactions and @x402/axios for payment handling.

  • OpenClaw Agent (Telegram Bot): Autonomous security agent powered by Groq (llama-3.1-8b-instant) that discovers premium MCP tools, pays via x402, and reports results with on-chain proof.

  • Frontend (Next.js on Vercel): Retro-futuristic landing page with MCPremium Store, interactive N8N-style flow visualization, wallet connection, and SDK documentation.

Tech stack: TypeScript, Chainlink CRE SDK, Solidity, Foundry, Express.js, Groq, x402 protocol, Base Sepolia, ethers.js, viem, Next.js, Tailwind CSS.

Links

Created by

  • Jawy Romero Pinto