A-Pay Protocol
OfficialThis A-Pay MCP server lets an AI agent make HTTP 402-protected API/web requests, auto-settle micropayments within budget limits, and inspect wallet/payment details on Base L2.
Make GET/POST/PUT/DELETE requests to any API or website, with optional headers and JSON body.
Automatically handle HTTP 402 challenges by signing payment authorizations within configured limits and unlocking data in <25ms.
Inspect the agent wallet address, spending guardrails, and total spent in USDC and $APAY.
Configure daily and per-call spending budgets for both USDC and $APAY to prevent runaway spending.
Probe an endpointβs HTTP 402 price quote, currency, and payout receiver without spending funds.
Check live on-chain Base L2 balances for ETH, USDC, and $APAY.
Provides a wrapper for CrewAI agents, enabling autonomous HTTP 402 micropayments with spending guardrails.
Provides middleware for Express.js APIs to enforce HTTP 402 paywalls, allowing AI agents to pay per request.
Provides middleware for FastAPI backends to enforce HTTP 402 paywalls, allowing AI agents to pay per request.
Provides a wrapper for LangChain agents, enabling autonomous HTTP 402 micropayments with spending guardrails.
Provides middleware for Next.js 15 applications to enforce HTTP 402 paywalls, allowing AI agents to pay per request.
Provides a WordPress plugin for AI paywalls, allowing site owners to charge AI crawlers via HTTP 402.
β‘ A-Pay Protocol (AgentPay)
The World's First Fully Autonomous HTTP 402 Micropayment & Economic Settlement Layer on Base L2
π Canonical Protocol Identity & Verified Network
Official Protocol Domain: https://apayprotocol.org (Cloudflare Global Edge Anycast, DDoS Protected)
Official Basename (Base L2 ENS):
apayprotocol.base.ethOfficial WordPress Plugin: https://wordpress.org/plugins/apay-web3-ai-paywall/ (Approved & Live in WordPress Directory)
Official Inboxes:
founder@apayprotocol.org|contact@apayprotocol.org|security@apayprotocol.orgOfficial GitHub Organization: https://github.com/apayprotocol (Verified Domain Organization)
Official GitLab (Decentralized Mirror): https://gitlab.com/apayprotocol/a_pay (Continuous Edge Delivery Mirror)
Live Web App & Developer Console: https://apayprotocol.org
Technical Whitepaper: https://apayprotocol.org/whitepaper
Founder & Lead Architect: Sagar Yadav
Official Telegram: https://t.me/apay_protocol | Bot: @APay_Protocol_Bot
βοΈ Verified Smart Contracts (Base Mainnet β Chain ID 8453)
Contract / Resource | Contract Address | Explorer / Pool |
$APAY Token (ERC-20) |
| BaseScan (100M Fixed Cap) |
EscrowVault (Session Keys) |
| BaseScan (Non-Custodial Delegated Spend) |
APayRouterV2 (Enterprise) |
| BaseScan (Cumulative Channels & Merkle Claims) |
APayRouter (V1 Gateway) |
| BaseScan (1.0% Protocol Fee) |
StakingVault (Anti-Spam) |
| BaseScan (Collateral & Slashing) |
Aerodrome Liquidity Pool |
| |
Market Analytics | DexScreener Live Pool |
π§ͺ Base Sepolia Testnet (Chain ID 84532)
Testnet Faucet APAY:
0x8dd4ff9035c7d4e0Bef30aa64FC30d128A4066C3EscrowVault:
0x3E35a9E802627a3D9A86D6554e72b1C446E34aAFAPayRouterV2:
0xD08c8A337E5339d1c083E06d74A9265956ceEA16APayRouter V1:
0x71434344beEF9C44fF3BC95572bEB7bFB8847ec6
Related MCP server: @arispay/payagent-mcp
π‘ The Genesis: Unlocking HTTP 402 After 30 Years
In 1996, Sir Tim Berners-Lee and the IETF authored RFC 2068, reserving the HTTP status code 402 Payment Required for digital cash protocols.
For thirty years, status code 402 sat dormant. Web 2.0 forced digital payments into human-centric credit card rails (Visa, Mastercard, Stripe), requiring KYC identity checks, CAPTCHAs, and minimum fixed transaction fees of $0.30 + 2.9%.
β οΈ The Problem Today (2026 AI Agent Economy)
AI Agents Have No Credit Cards: Autonomous software agents (Claude Desktop, Cursor, LangChain, AutoGen, CrewAI) execute multi-step workflows across the web. They cannot hold credit cards, submit passports for KYC, or solve visual captchas.
Publishers & Website Owners are Bleeding Compute: Autonomous AI scrapers (GPTBot, ClaudeBot, PerplexityBot) crawl millions of pages daily. Publishers face massive server bandwidth bills while their proprietary intelligence is consumed for free.
Stripe Kills Micropayments: If an AI agent wants to purchase a single database row, an API call, or an article for $0.001 (0.1Β’), Stripe's $0.30 fixed fee makes it impossible.
π The A-Pay Solution
A-Pay is the world's first autonomous economic settlement layer that implements the native HTTP 402 standard on Base Layer 2.
Sub-Cent Micropayments: Settle transactions as small as $0.0001 (0.01Β’) in native USDC or $APAY.
Zero Gas Friction for Agents: Agents sign off-chain cryptographic authorizations (EIP-712). Relayers handle batch settlement on Base L2.
Sub-15ms Latency: Cryptographic verification completes in under 15 milliseconds, seamlessly unblocking HTTP responses.
100% Non-Custodial & Audited: Guarded by smart contract session keys with daily spending limits and per-call caps.
ποΈ The Three Architectural Pillars
A-PAY PROTOCOL
β
ββββββββββββββββββββββββββββββββββββΌβββββββββββββββββββββββββββββββββββ
βΌ βΌ βΌ
[PILLAR 1: SELLER] [PILLAR 2: BUYER] [PILLAR 3: SETTLEMENT]
HTTP 402 Paywall Layer Autonomous Agent Wallets Base L2 Escrow Vault
ββββββββββββββββββββββ ββββββββββββββββββββββββ ββββββββββββββββββββ
β’ WordPress AI Paywall Plugin β’ Model Context Protocol (MCP) β’ EIP-712 Batch Settlement
β’ Reverse Proxy (`apay protect`) β’ Ephemeral Session Keys β’ Non-Custodial Escrow
β’ FastAPI / Express Decorators β’ Daily Budgets & Per-Call Caps β’ Cumulative Payment Channels
β’ Next.js 15 Middleware β’ LangChain / CrewAI Wrappers β’ Native USDC & $APAY SupportPillar 1: HTTP 402 Paywall & Monetization Layer (For Publishers & Sellers)
Turn unmetered AI crawler traffic into instant, automated revenue:
Selective Bot Paywall: Genuine human visitors read your website freely without popups or captchas. Autonomous AI crawler bots automatically receive an HTTP 402 Payment Required challenge.
Instant Reverse Proxy: Protect ANY existing REST API, FastAPI backend, or web server with a single terminal command:
apay protect --target http://localhost:8000 --price 0.001 --wallet 0xYourPayoutAddressNative Framework SDKs: Drop-in middleware for Next.js 15, FastAPI, Express.js, and WordPress.
Pillar 2: Autonomous Agent Wallet & MCP Server (For AI Agents & LLMs)
Give AI agents economic agency with programmatic safety rails:
Model Context Protocol (MCP): Native integration for Claude Desktop, Cursor, Cline, Windsurf, and custom LLM tool runners.
Spending & Counterparty Guardrails: Define hard spending limits (
daily_budget_usdc=2.00,max_per_call_usdc=0.01) and opt-in verified seller verification (verify_seller_seal=Truevia SealKeeper). The agent cannot exceed its delegated allowance or settle with unproven/withheld sellers.Auto-Settling HTTP Client:
APaySessionautomatically catches402headers, checks seller reputation/SEAL, signs the EIP-712 challenge, and retrieves data in a single round-trip without human intervention.
Pillar 3: On-Chain Base L2 Settlement & Escrow Vault (For Enterprise Web3 Security)
Enterprise-grade cryptographic settlement built on Coinbase's Base Layer 2:
EscrowVault: Agents deposit or lock funds into dedicated smart contracts. Session keys authorize payments without holding root private keys.
APayRouterV2: Batch settlements aggregate thousands of off-chain micro-signatures into a single Merkle-verified on-chain transaction, reducing effective gas costs to fractions of a cent.
Dual-Currency Support: Settle in dollar-pegged USDC or the protocol utility token $APAY with fee discounts.
π₯ Who Is A-Pay For? (Target Personas & Benefits)
User Persona | The Pain Point Today | How A-Pay Solves It |
Website Owners & Publishers | AI bots scrape content for free; hosting bills surge; paywalls block human readers. | Human visitors read for free; AI scrapers pay $0.001/page via HTTP 402 paywall. |
API Providers & SaaS Founders | Monthly SaaS billing requires Stripe KYC, invoices, high churn, and $0.30 transaction minimums. | Pure pay-per-call micro-billing ($0.005/request); zero chargebacks; instant settlement. |
AI Engineers (Claude/Cursor) | Agents cannot purchase web search results, private datasets, or pay for third-party tools. | Agents hold delegated session wallets with daily budgets to pay for tools autonomously. |
Web3 & Base L2 Builders | Tokens lack real-world utility; micro-transaction dApps suffer from gas friction. | Millions of automated M2M agent micro-settlements flowing through Base L2 contracts. |
π Quickstart & Universal Developer Setup
1. Python Developers (FastAPI & AI Agents)
pip install apayProtect a FastAPI Endpoint with HTTP 402:
from fastapi import FastAPI, Depends
from apay import require_payment
app = FastAPI()
@app.get("/api/alpha-feed")
@require_payment(price_usdc=0.005, receiver="0xYourPayoutWalletAddress")
async def get_alpha_feed():
return {"status": "unlocked", "data": "Exclusive proprietary real-time signals"}Call Protected APIs with an Autonomous Agent:
from apay import APaySession, AgentWallet, check_seller_seal
# Create an agent wallet with strict safety caps
wallet = AgentWallet(
private_key="0x...",
max_per_call_usdc=0.01,
daily_budget_usdc=5.00
)
# Enable verified seller guardrail (SealKeeper SEAL integration)
# When True, verifies seller's cryptographic EdDSA SEAL signature and ensures
# wallet ownership is proven (wallet.proven === True) before signing payment.
session = APaySession(wallet, verify_seller_seal=True)
# Automatically handles HTTP 402 challenges & settles on the fly (<15ms)
response = session.get("https://api.example.com/api/alpha-feed")
print(response.json())
# Standalone seller SEAL lookup:
status = check_seller_seal("0x7dfc75477f00c65f7b611f194d282d8b5a6f30dc")
print("Seller proven:", status["proven"], "Handle:", status.get("handle"))2. TypeScript & Node.js Developers (Next.js & Express)
Scaffold a complete fullstack project in 30 seconds:
npx create-apay-app my-autonomous-agentOr install the gateway & agent library:
npm install apay-gateway viemimport { APayClientTS, AgentWalletTS, checkSellerSeal } from "apay-gateway";
const wallet = AgentWalletTS.create({
privateKey: process.env.AGENT_PRIVATE_KEY as `0x${string}`,
maxPerCallUsdc: 0.05,
dailyBudgetUsdc: 2.0,
});
// Initialize client with opt-in SealKeeper verified seller guardrail
const client = new APayClientTS(wallet, {
verifySellerSeal: true, // Rejects unproven, withheld, or invalid seller SEALs
});
// Auto-settling request with verified seller check (<15ms)
const res = await client.fetch("https://data-provider.com/market-depth");
const data = await res.json();
console.log(data);
// Standalone seller SEAL verification:
const seal = await checkSellerSeal("0x7dfc75477f00c65f7b611f194d282d8b5a6f30dc");
console.log("Seller proven:", seal.proven, "Handle:", seal.handle);3. Claude Desktop & Cursor (Model Context Protocol / MCP)
One-Click Install via Smithery:
npx -y smithery mcp add apayprotocol/apayOr Add to claude_desktop_config.json / Cursor (.cursor/mcp.json):
{
"mcpServers": {
"apay": {
"command": "uvx",
"args": ["apay", "mcp"],
"env": {
"APAY_NETWORK": "base-mainnet",
"APAY_CURRENCY": "DUAL",
"APAY_MAX_PER_CALL": "0.05",
"APAY_DAILY_BUDGET": "2.00"
}
}
}
}Now Claude or Cursor can execute tools:
apay_request: Send requests to HTTP 402 protected APIs and settle on-the-fly.apay_get_balance: Inspect live on-chain balances (ETH, USDC, $APAY).apay_inspect_endpoint: Probe an API paywall for price and terms without spending gas.apay_set_budget: Adjust per-call limits and daily spending guardrails.
4. Website Owners & WordPress (Zero Code Reverse Proxy)
Protect ANY live web server or WordPress site without changing a single line of backend code:
apay protect --target http://localhost:8000 --price 0.001 --wallet 0xYourPayoutAddressHuman browsers view the site freely.
AI web crawlers (GPTBot, ClaudeBot, Bytespider) receive an HTTP 402 challenge and pay per scrape.
5. Coinbase AgentKit (On-Chain Base L2 Agents)
Drop-in Action Provider enabling any Coinbase AgentKit agent to probe and settle HTTP 402 micropayments on Base L2:
Python:
from apay.integrations.agentkit import create_apay_action_provider
apay_provider = create_apay_action_provider(
network="base-mainnet",
max_per_call_usdc=0.05,
daily_budget_usdc=2.00,
)TypeScript:
import { createAPayActionProvider } from "apay-gateway/agentkit";
const apayProvider = createAPayActionProvider({
network: "base-mainnet",
preferredCurrency: "USDC",
});Provides 5 native tools: apay_probe_endpoint, apay_request, apay_get_wallet_status, apay_get_balance, apay_set_budget.
π Project Architecture
a_pay/
βββ src/apay/ # Core Python SDK & Runtime
β βββ cli.py # β‘ 1-Command CLI (`apay protect`, `apay wallet new`, `apay mcp`)
β βββ client.py # π€ Autonomous HTTP client with auto-402 negotiation
β βββ wallet.py # π In-memory delegated wallet & spending limits
β βββ proxy.py # π‘οΈ Ultra-light reverse proxy HTTP 402 paywall
β βββ relayer.py # π EIP-712 batch settlement relayer
β βββ integrations/ # π LangChain, CrewAI & AutoGen agent wrappers
βββ gateway-ts/ # Enterprise TypeScript Gateway & EIP-712 Verifier
βββ packages/create-apay-app # Official NPX starter scaffolding CLI
βββ contracts/ # Audited Solidity Smart Contracts (Base Mainnet & Sepolia)
β βββ APAYToken.sol # ERC-20 100M Cap Protocol Utility Token
β βββ EscrowVault.sol # Session Key Delegated Spending Vault
β βββ APayRouterV2.sol # Cumulative Channel & Merkle Root Router
β βββ StakingVault.sol # Anti-Spam Collateral Engine
βββ web/ # Official Portal (Next.js 15, Tailwind, RainbowKit, Wagmi)
βββ docs/ # Complete Protocol Specifications & RFCs
βββ spec/ # RFC wire format & EIP-712 domain specifications
βββ pyproject.toml # Official Hatchling packaging configurationπ Security & Verification Guarantees
Non-Custodial Session Delegation: Agents operate with strictly sandboxed session keys. The agent NEVER has access to the owner's primary root wallet or vault withdrawal functions.
Deterministic Cryptographic Limits: Spending caps are signed off-chain and enforced both in-memory and on-chain by the
EscrowVaultsmart contract.Formal Verification & Secrets Hygiene:
Zero hardcoded secrets, seed phrases, or private keys across the entire codebase.
Automated security scans verified via
python3 scripts/scan_secrets.py.On-chain bytecode verified on BaseScan.
π€ Community & Ecosystem
Official Website: https://apayprotocol.org
Technical Whitepaper: https://apayprotocol.org/whitepaper
Founder & Lead Architect: Sagar Yadav
Official Telegram: https://t.me/apay_protocol | Gateway Bridge
Official Discord: https://discord.gg/cW2WRSfb35 (Developer Community)
Official Subreddit: r/A_Pay_Protocol
GitHub Organization: https://github.com/apayprotocol
Official Basename:
apayprotocol.base.ethContact & Security:
founder@apayprotocol.org|security@apayprotocol.org
A-Pay is an open-source decentralized economic protocol for the machine-to-machine economy. Built on Base Layer 2.
Available Tools
5 toolsapay_get_balanceA
Inspect the agent's live on-chain balances on Base Layer 2, including native ETH (for gas), USDC, and $APAY tokens.
Inputs: no named parameters.
apay_get_wallet_statusA
Inspect the agent's active non-custodial wallet address, current spending guardrails, and total spent in USDC and $APAY.
Inputs: no named parameters.
apay_inspect_endpointA
Inspect an endpoint to check if it requires an A-Pay micropayment, inspect the exact price quote, currency, and payout receiver without spending any funds.
Inputs: url (required).
apay_requestB
Make an HTTP request (GET, POST, etc.) to any API or website. If the endpoint returns an HTTP 402 Payment Required challenge, A-Pay automatically signs the cryptographic payment authorization within your budget limits and unlocks the data in <25ms.
Inputs: url (required), method, headers, json_body.
apay_set_budgetC
Configure agent safety invariants and spending guardrails. Prevents runaway loops or overcharging.
Inputs: daily_budget_apay, daily_budget_usdc, max_per_call_apay, max_per_call_usdc.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelogβ¦
TDQS
Scored across 5 tools
Each tool targets a distinct action: inspecting an endpoint, checking balances, making a paid request, viewing wallet status/guardrails, and setting budget. The dry-run inspect tool is clearly separated from the actual payment request tool, and balance vs wallet status are differentiated by their descriptions.
All tools use a consistent apay_ prefix and mostly follow a verb_noun pattern (inspect_endpoint, get_balance, get_wallet_status, set_budget). apay_request is the lone verb-only name, a minor deviation but still readable and predictable.
Five tools are well-scoped for a micropayment protocol agent surface: inspect, request, balance, status, and budget. Each tool earns its place with no obvious redundancy or missing core operation.
The toolset covers the essential lifecycle: checking payment requirements, executing paid requests, viewing balances, inspecting wallet state, and configuring spending limits. Minor gaps exist around transaction history or explicit wallet funding/withdrawal, but agents can work around these.
Maintenance
Related MCP Connectors
Universal HTTP 402 Micropayment Protocol & Autonomous Economic Settlement Engine for AI Agents
Machine-payable API infrastructure for autonomous agents. Per-call x402 settlement in USDC.
Monetization and execution gateway for autonomous AI agents on Base Mainnet
Autonomous HTTP 402 Web Scraping Mesh on Base for $0.02 USDC.
Related MCP Servers
- AlicenseNot gradedqualityCmaintenanceUSDC payments for AI agents on Base. Direct transfers, pre-funded tabs, x402 paywall handling, and service discovery.92 npmMIT

@arispay/payagent-mcpofficial
AlicenseAqualityBmaintenanceEnables AI agents to call paid APIs and settle HTTP 402 payment challenges with USDC on Base, without private keys ever being involved.7228 npmMIT- AlicenseNot gradedqualityCmaintenanceEnables pay-per-call access control for AI agents using HTTP 402 and on-chain settlement, allowing microtransactions for API usage.84 PyPIMIT
- AlicenseNot gradedqualityCmaintenanceEnables machine-payable, zero-subscription AI utility tools via HTTP 402 on Base and Solana, including markdown web scraping, prompt injection detection, Solana token audits, and domain intelligence.MIT