MPP Project Setup
Before writing code
Fetch live docs:
- Fetch
https://www.npmjs.com/package/mppxfor the latest mppx SDK version, installation, and API surface - Web-search
site:github.com stripe-samples machine-paymentsfor the official sample project structure - Fetch
https://docs.stripe.com/payments/machinefor Stripe machine payments setup requirements - Web-search
site:mpp.dev overviewfor the current protocol overview and getting started guide
What This Skill Does
Scaffolds a new MPP project for monetizing HTTP services with machine payments:
- Detect language/framework — TypeScript (Hono/Express/Next.js/Elysia), Python (FastAPI/Flask), or Rust
- Install SDK —
npm install mppx(TypeScript),pip install pympp(Python), or check mpp.dev for the Rust crate - Create configuration — Environment variables for secret key, payment method settings, Stripe keys
- Set up server middleware —
Mppx.create()with payment method configuration - Create a paid endpoint — Basic route protected by
mppx.charge()middleware - Add service discovery —
GET /openapi.jsonwithx-payment-infoextensions - Set up client (optional) —
mppx.fetch()for consuming paid APIs
Environment Configuration
These must be externalized (env vars or config file):
MPP_SECRET_KEY— 32-byte hex key for HMAC challenge binding (generate withopenssl rand -hex 32)STRIPE_SECRET_KEY— If using Stripe payment methodTEMPO_RECIPIENT_ADDRESS— Wallet address for receiving Tempo paymentsTEMPO_CHAIN_ID—4217for Tempo mainnetTEMPO_USDC_CONTRACT—0x20c000000000000000000000b9537d11c60e8b50for USDC on Tempo
Project Structure Pattern
my-mpp-service/
├── src/
│ ├── index.ts # Server entry point with Mppx middleware
│ ├── routes/
│ │ ├── paid.ts # Payment-protected endpoints
│ │ └── free.ts # Free/health endpoints
│ ├── config.ts # MPP and payment method configuration
│ └── openapi.ts # Service discovery endpoint
├── .env # Secrets (MPP_SECRET_KEY, STRIPE_SECRET_KEY)
├── package.json
├── tsconfig.json
└── tests/
└── payment.test.ts
Key Setup Decisions
- Payment method — Tempo (crypto, sub-second), Stripe (cards via SPT), Lightning, or multiple
- Payment intent — Charge (one-time per request) or Session (streaming micropayments)
- Framework — Hono (recommended, lightweight), Express, Next.js, or Elysia
- Pricing model — Fixed per-request, dynamic based on payload, or session-based streaming
Quick Start Pattern (Hono + Tempo)
import { Hono } from 'hono';
import { Mppx, tempo } from 'mppx/server';
const mppx = Mppx.create({
secretKey: process.env.MPP_SECRET_KEY,
methods: [
tempo.charge({
chainId: 4217,
currency: '0x20C000000000000000000000b9537d11c60E8b50',
recipient: process.env.TEMPO_RECIPIENT_ADDRESS,
}),
],
});
const app = new Hono();
app.get('/api/data', mppx.charge({ amount: '100' }), (c) => {
return c.json({ data: 'premium content' });
});
Fetch the latest mppx README and Stripe machine payments docs for exact SDK API, current payment method configuration options, and framework-specific setup before scaffolding.