A reverse proxy that wraps any existing HTTP API with MPP payment gating — zero code changes on the origin API.
mppx-proxy is an early-stage TypeScript project in the AI payments / x402 ecosystem. It currently has 4 GitHub stars and 0 forks.
A reverse proxy that wraps any existing HTTP API with MPP payment gating — zero code changes on the origin API.
API owners register their key and set a USDC price per call. AI agents (or any HTTP client using mpp-solana) pay automatically via Solana and get access. No accounts, no API keys for callers — payment is the auth.
Agent mppx-proxy Origin API
│ │ │
│── GET /api.openweathermap.org/... ────▶│ │
│ │ 402 Payment Required │
│◀── WWW-Authenticate: MPP ─────────────│ {mint, recipient, amount} │
│ │ │
│ [pays USDC on Solana devnet/mainnet] │ │
│ │ │
│── GET /api.openweathermap.org/... ────▶│ │
│ Authorization: Payment <tx-sig> │── GET /data/2.5/weather ───▶│
│ │ X-API-Key: <real-key> │
│◀── 200 OK + Payment-Receipt ──────────│◀── 200 OK ───────────────────│
/v1/premium/* vs /v1/basic/*)/dashboard, fill in your origin host, real API key, Solana wallet, and pricehttps://proxy.mppx.xyz/api.openweathermap.orgimport { solana, Mppx } from 'mpp-solana/client'
const client = Mppx.create({
methods: [solana.charge({ wallet: agentWallet, network: 'devnet' })],
})
// Automatically handles 402 → pay on Solana → retry
const res = await client.fetch(
'https://proxy.mppx.xyz/api.openweathermap.org/data/2.5/weather?q=London',
)
const data = await res.json()
https://proxy.mppx.xyz/{origin-host}/{path...}?{query}
└─ registered ─┘ └─ forwarded as-is ──────────┘
| Layer | Choice |
|---|---|
| Server | Hono |
| Runtimes | Cloudflare Workers + Bun |
| Storage | Turso (libSQL) |
| Payment protocol | mpp-solana + mppx |
| Crypto | Web Crypto API (AES-256-GCM) |
bun install
Create a .dev.vars file (never committed):
TURSO_URL=libsql://your-db.turso.io
TURSO_AUTH_TOKEN=your-token
MPP_SECRET_KEY=<64-char hex, 32 bytes>
ENCRYPTION_KEY=<64-char hex, 32 bytes>
SOLANA_NETWORK=devnet
SOLANA_RPC_URL=
Generate keys:
openssl rand -hex 32 # MPP_SECRET_KEY
openssl rand -hex 32 # ENCRYPTION_KEY
bun dev
# → DB migrations applied
# → mppx-proxy running at http://localhost:3000
Open http://localhost:3000/dashboard to register your first API.
# 1. Run DB migrations against Turso (once, before first deploy)
TURSO_URL=libsql://... TURSO_AUTH_TOKEN=... bun -e "
import { createClient } from '@libsql/client'
import { runMigrations } from './src/db/migrate.ts'
const db = createClient({ url: process.env.TURSO_URL, authToken: process.env.TURSO_AUTH_TOKEN })
await runMigrations(db)
console.log('done')
"
# 2. Set secrets
wrangler secret put TURSO_URL
wrangler secret put TURSO_AUTH_TOKEN
wrangler secret put MPP_SECRET_KEY
wrangler secret put ENCRYPTION_KEY
# 3. Deploy
bun run deploy
# Register an API via the dashboard first, then:
curl -v http://localhost:3000/api.openweathermap.org/data/2.5/weather?q=London
# → HTTP/1.1 402 Payment Required
# → WWW-Authenticate: MPP ...
Fund a Solana devnet wallet with USDC at spl-token-faucet.com, then:
AGENT_WALLET_SECRET=<base58-secret> PROXY_URL=http://localhost:3000 bun examples/agent-demo.ts
src/
├── index.ts # CF Workers export + Bun server entry
├── app.ts # Hono app wiring
├── crypto.ts # AES-256-GCM encrypt/decrypt (Web Crypto API)
├── forwarder.ts # Strip proxy prefix, inject API key, forward request
├── db/
│ ├── client.ts # Turso client init
│ ├── queries.ts # Typed DB queries
│ └── migrate.ts # Schema migrations
├── payment/
│ ├── gate.ts # MPP 402 challenge + verification (mpp-solana)
│ ├── price.ts # Route pattern → USDC price resolver
│ └── store.ts # Turso-backed mppx Store (replay protection + earnings)
├── routes/
│ ├── proxy.ts # Catch-all proxy route
│ └── dashboard.ts # Dashboard HTTP handlers
└── dashboard/
└── views.ts # HTML views
examples/
└── agent-demo.ts # End-to-end agent demo script
The embedded dashboard at /dashboard has three views:
/dashboard/pricing?host=...) — add path patterns with per-route prices/dashboard/earnings?host=...) — view payment history and total USDC earnedbun test
18 tests across crypto, price resolver, store adapter, forwarder, and proxy route.
HEHEHEHE
TypeScript Interface for Machine Payments Protocol
Alephant is an open-source AI Agent Gateway for routing, tracking, and controlling LLM usage across AI agents, members, and workflows, and for publishing agent capabilities as paid endpoints with x402 and MPP payment rails.
Specifications for the Machine Payments Protocol - powered by the "Payment" HTTP authentication scheme
Rust SDK for the Machine Payments Protocol
Website for the Machine Payments Protocol
Building blocks for Agentic payments (x402, MPP, AP2) for TypeScript, Rust, Go, Python, Ruby, PHP, Lua, Kotlin and Swift.