## 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

1. Agent sends a request to a paid endpoint
2. Server returns **HTTP 402** with a `WWW-Authenticate: Payment` header
3. The header contains: realm, amount, recipient, and network details
4. Agent pays using the mppx SDK
5. Agent retries with payment proof
6. Server verifies and responds

## Key concepts

- **pathUSD**: A stablecoin on the Tempo chain (1 pathUSD = 1 USD)
- **mppx**: The CLI and SDK for making and receiving MPP payments
- **Sub-second finality**: Payments confirm almost instantly
- **Low fees**: Designed for micropayments (fractions of a cent)

## How to add MPP to your service

### 1. Install mppx

```bash
npm install mppx
```

### 2. Create a wallet

```bash
npx mppx account create
npx mppx account fund  # for testnet
```

### 3. Add Express middleware

```javascript
import { mppMiddleware } from 'mppx';

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

### 4. Set environment variables

```bash
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

- [mppx on npm](https://www.npmjs.com/package/mppx) — SDK, CLI, and Express middleware

## Related

- [OpenAPI](/kb/openapi)
