MPP Project Setup
Before writing code
Fetch live docs:
- Fetch
https://www.npmjs.com/package/mppx for the latest mppx SDK version, installation, and API surface
- Web-search
site:github.com stripe-samples machine-payments for the official sample project structure
- Fetch
https://docs.stripe.com/payments/machine for Stripe machine payments setup requirements
- Web-search
site:mpp.dev overview for 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.json with x-payment-info extensions
- 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 with openssl rand -hex 32)
STRIPE_SECRET_KEY — If using Stripe payment method
TEMPO_RECIPIENT_ADDRESS — Wallet address for receiving Tempo payments
TEMPO_CHAIN_ID — 4217 for Tempo mainnet
TEMPO_USDC_CONTRACT — 0x20c000000000000000000000b9537d11c60e8b50 for 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.
1---2name: mpp-setup3description: Scaffold an MPP project — install mppx SDK, configure payment methods, set up server middleware, and create a basic paid API endpoint. Use when starting a new MPP machine payments project from scratch.4---5
6# MPP Project Setup
7
8## Before writing code
9
10**Fetch live docs**:
111. Fetch `https://www.npmjs.com/package/mppx` for the latest mppx SDK version, installation, and API surface
122. Web-search `site:github.com stripe-samples machine-payments` for the official sample project structure
133. Fetch `https://docs.stripe.com/payments/machine` for Stripe machine payments setup requirements
144. Web-search `site:mpp.dev overview` for the current protocol overview and getting started guide
15
16## What This Skill Does
17
18Scaffolds a new MPP project for monetizing HTTP services with machine payments:
19
201. **Detect language/framework** — TypeScript (Hono/Express/Next.js/Elysia), Python (FastAPI/Flask), or Rust
212. **Install SDK** — `npm install mppx` (TypeScript), `pip install pympp` (Python), or check mpp.dev for the Rust crate
223. **Create configuration** — Environment variables for secret key, payment method settings, Stripe keys
234. **Set up server middleware** — `Mppx.create()` with payment method configuration
245. **Create a paid endpoint** — Basic route protected by `mppx.charge()` middleware
256. **Add service discovery** — `GET /openapi.json` with `x-payment-info` extensions
267. **Set up client (optional)** — `mppx.fetch()` for consuming paid APIs
27
28## Environment Configuration
29
30These must be externalized (env vars or config file):
31- `MPP_SECRET_KEY` — 32-byte hex key for HMAC challenge binding (generate with `openssl rand -hex 32`)
32- `STRIPE_SECRET_KEY` — If using Stripe payment method
33- `TEMPO_RECIPIENT_ADDRESS` — Wallet address for receiving Tempo payments
34- `TEMPO_CHAIN_ID` — `4217` for Tempo mainnet
35- `TEMPO_USDC_CONTRACT` — `0x20c000000000000000000000b9537d11c60e8b50` for USDC on Tempo
36
37## Project Structure Pattern
38
39```
40my-mpp-service/
41├── src/
42│ ├── index.ts # Server entry point with Mppx middleware
43│ ├── routes/
44│ │ ├── paid.ts # Payment-protected endpoints
45│ │ └── free.ts # Free/health endpoints
46│ ├── config.ts # MPP and payment method configuration
47│ └── openapi.ts # Service discovery endpoint
48├── .env # Secrets (MPP_SECRET_KEY, STRIPE_SECRET_KEY)
49├── package.json
50├── tsconfig.json
51└── tests/
52 └── payment.test.ts
53```
54
55## Key Setup Decisions
56
57- **Payment method** — Tempo (crypto, sub-second), Stripe (cards via SPT), Lightning, or multiple
58- **Payment intent** — Charge (one-time per request) or Session (streaming micropayments)
59- **Framework** — Hono (recommended, lightweight), Express, Next.js, or Elysia
60- **Pricing model** — Fixed per-request, dynamic based on payload, or session-based streaming
61
62## Quick Start Pattern (Hono + Tempo)
63
64```typescript
65import { Hono } from 'hono';
66import { Mppx, tempo } from 'mppx/server';
67
68const mppx = Mppx.create({
69 secretKey: process.env.MPP_SECRET_KEY,
70 methods: [
71 tempo.charge({
72 chainId: 4217,
73 currency: '0x20C000000000000000000000b9537d11c60E8b50',
74 recipient: process.env.TEMPO_RECIPIENT_ADDRESS,
75 }),
76 ],
77});
78
79const app = new Hono();
80app.get('/api/data', mppx.charge({ amount: '100' }), (c) => {
81 return c.json({ data: 'premium content' });
82});
83```
84
85Fetch the latest mppx README and Stripe machine payments docs for exact SDK API, current payment method configuration options, and framework-specific setup before scaffolding.