Machine Payments Protocol extension for Pi
pi-mpp is an early-stage TypeScript project in the AI payments / x402 ecosystem. It currently has 0 GitHub stars and 0 forks.
MPP (Machine Payments Protocol) extension for Pi and OpenClaw. Lets the agent make paid HTTP requests to MPP-enabled services, handling the 402 Payment Required challenge flow automatically.
git clone <this-repo> ~/.pi/agent/extensions/mpp
cd ~/.pi/agent/extensions/mpp
npm install
Or for project-local use:
git clone <this-repo> .pi/extensions/mpp
cd .pi/extensions/mpp
npm install
Quick test without installing globally:
pi -e ./index.ts
Set env vars for whichever methods you want. Multiple can coexist — the SDK picks the right one based on what the server's 402 challenge offers.
| Method | Env Vars | Notes |
|---|---|---|
| Tempo | MPPX_PRIVATE_KEY |
Hex private key (0x...) for a Tempo wallet |
| Stripe | MPPX_STRIPE_SPT_URL |
URL of your SPT proxy endpoint |
MPPX_STRIPE_PAYMENT_METHOD (optional) |
Default Stripe payment method ID | |
| Lightning | MPPX_SPARK_MNEMONIC |
BIP39 mnemonic for a Spark wallet |
MPPX_SPARK_NETWORK (optional) |
mainnet (default), regtest, or signet |
|
| Card | MPPX_CARD_ID |
Card ID from your tokenization provider |
MPPX_CARD_ENABLER_URL |
URL of your credential issuer endpoint |
Credentials can be provided via env vars or a JSON secrets file (aligned with OpenClaw's source: "file" pattern):
export MPPX_SECRETS_FILE=~/.openclaw/mpp-secrets.json
The file uses env var names as keys:
{
"MPPX_PRIVATE_KEY": "0x...",
"MPPX_SPARK_MNEMONIC": "word1 word2 ...",
"MPPX_ALLOWED_HOSTS": "api.example.com,mpp.dev"
}
Env vars take priority over the file. The secrets file should be chmod 600 — OpenClaw enforces this for its own secrets files.
Strongly recommended for OpenClaw users. Without an allowlist, the agent can pay any MPP-enabled endpoint — including attacker-controlled services via prompt injection.
export MPPX_ALLOWED_HOSTS="api.example.com,mpp.dev,fal.mpp.tempo.xyz"
Supports subdomains — example.com allows api.example.com. If unset, all hosts are allowed.
| Env Var | Default | Description |
|---|---|---|
MPPX_SPEND_LIMIT |
10 |
Max paid requests per session |
MPPX_AUTO_APPROVE |
false |
Skip first-use confirmation prompt |
Pi TUI (interactive):
MPP: tempo [3/10]OpenClaw (headless):
MPPX_SPEND_LIMIT to control the ceilingThe extension registers a single tool: mpp_request
mpp_request({
url: "https://api.example.com/resource",
method: "POST", // optional, default GET
body: '{"prompt": "hello"}', // optional, JSON string
headers: { "X-Custom": "value" } // optional
})
The tool returns the response status, body, payment receipt (if paid), and running spend count.
mpp_request with a URLmppx SDK402 Payment Required, the SDK automatically:WWW-Authenticate headerAuthorization: Payment credentialPayment-ReceiptMIT
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.