agentgrade

← Knowledge Base

What is MPP?

MPP (Machine Payment Protocol) is a micropayment system built for AI agents. It uses pathUSD on the Tempo blockchain for near-instant, low-fee payments. Agents pay per API call using the mppx SDK.

How it works

  • Agent sends a request to a paid endpoint
  • Server returns HTTP 402 with a WWW-Authenticate: Payment header
  • The header contains: realm, amount, recipient, and network details
  • Agent pays using the mppx SDK
  • Agent retries with payment proof
  • Server verifies and responds
  • Key concepts

    How to add MPP to your service

    1. Install mppx

    npm install mppx
    

    2. Create a wallet

    npx mppx account create
    npx mppx account fund  # for testnet
    

    3. Add Express middleware

    import { mppMiddleware } from 'mppx';
    
    app.use('/api/paid-endpoint', mppMiddleware({
      amount: 0.01, // in USD
    }));
    

    4. Set environment variables

    MPP_SECRET_KEY=your_secret_key
    MPP_RECIPIENT_ADDRESS=your_wallet_address
    

    Spec maturity

    Production-ready. Live on the Tempo network with active services including AgentNews.

    Learn more