Skip to content
Skills Library
Programming · Building & coding

mpp-proxy

/mpp-proxy

Implement MPP payment proxies — wrap existing APIs with HTTP 402 payment gates without modifying the upstream service. Use when monetizing third-party APIs, adding payment layers to existing services, or building API marketplaces.

Licence
MIT
Last repository change
14.09.2026

Assessment and security

100/ 100Class: good
Format25 / 25
Frontmatter with name and description, valid name, description up to 1,024 characters, name matching the folder.
Discoverability25 / 25
Description explains when to use the skill, has a reasonable length and uses third person.
Content35 / 35
At least 150 words and at most 500 lines, headings, step lists, examples or code.
Hygiene15 / 15
No placeholders such as TODO, no Windows paths, with a licence.
Riskno signals detected in the scan
Files in this package
1
Scripts
0
HTML comments
0
URLs in SKILL.md
6
Deprecation

No signals detected. Repository changed on 14.09.2026, without references to retired models or APIs.

Licence

MIT, open: use and modify while retaining author attribution.

What it does and when to use it

Implement MPP payment proxies — wrap existing APIs with HTTP 402 payment gates without modifying the upstream service. Use when monetizing third-party APIs, adding payment layers to existing services, or building API marketplaces.

Original author description

Implement MPP payment proxies — wrap existing APIs with HTTP 402 payment gates without modifying the upstream service. Use when monetizing third-party APIs, adding payment layers to existing services, or building API marketplaces.

How it works

  1. Before writing code
  2. Conceptual Architecture
Original SKILL.md headings · 124 lines, 580 words
SKILL.md preview
---
name: mpp-proxy
description: Implement MPP payment proxies — wrap existing APIs with HTTP 402 payment gates without modifying the upstream service. Use when monetizing third-party APIs, adding payment layers to existing services, or building API marketplaces.
allowed-tools: Read, Write, Edit, Bash, Grep, Glob, WebSearch, WebFetch
---

# MPP Payment Proxy

## Before writing code

**Fetch live docs**:
1. Fetch `https://www.npmjs.com/package/mppx` for the proxy handler API and configuration
2. Web-search `mppx proxy payment 402 existing API monetize` for proxy implementation patterns
3. Web-search `site:github.com stripe-samples machine-payments proxy` for official proxy sample code
4. Fetch `https://developers.cloudflare.com/agents/agentic-payments/mpp/` for Cloudflare Workers proxy patterns

## Conceptual Architecture

### What the Proxy Does

The MPP proxy wraps an existing upstream API with a payment gate, requiring clients to pay before their requests are forwarded. The upstream API is unmodified — it never sees the payment flow.

```
Client → MPP Proxy (402 challenge-response) → Upstream API
         ↑ payment gate                       ↑ unmodified
```

### Use Cases

- **API monetization** — Charge for access to your own internal APIs
- **Third-party reselling** — Add payment layer on top of third-party APIs (with permission)
- **API marketplace** — Proxy multiple upstream APIs through a single payment gateway
- **Rate-limiting replacement** — Replace API key + rate limits with pay-per-use
- **Value-added wrapper** — Add caching, transformation, or enrichment on top of upstream APIs

### Proxy Architecture

```
┌──────────────┐     ┌──────────────────────┐     ┌──────────────┐
│  AI Agent    │────→│    MPP Proxy          │────→│  Upstream    │
│  (Client)    │←────│  1. 402 Challenge     │←────│  API         │
│              │     │  2. Verify Payment    │     │  (Unmodified)│
│              │     │  3. Forward Request   │     │              │
│              │     │  4. Return + Receipt  │     │              │
└──────────────┘     └──────────────────────┘     └──────────────┘
```

### mppx Proxy Handler

The `mppx` SDK provides a dedicated proxy handler:

```typescript
import { Mppx, tempo } from 'mppx/server';

const mppx = Mppx.create({
  secretKey: process.env.MPP_SECRET_KEY,
  methods: [tempo.charge({ /* config */ })],
});

// Proxy all requests to upstream with payment gate
app.all('/api/*', mppx.charge({ amount: '100' }), async (c) => {
  const upstreamUrl = `https://upstream-api.com${c.req.path}`;
  const response = await fetch(upstreamUrl, {
    method: c.req.method,
    headers: c.req.headers,
    body: c.req.method !== 'GET' ? await c.req.text() : undefined,
  });
  return new Response(response.body, {
    status: response.status,
    headers: response.headers,
  });
});
```

### Cloudflare Workers Proxy

For edge-deployed proxies:

```typescript
// Cloudflare Workers + MPP proxy pattern
export default {
  async fetch(request, env) {
    // MPP middleware handles 402 challenge-response
    // On successful payment, forwards to upstream
  }
};
```

### Pricing Strategies

| Strategy | Description |
|----------|-------------|
| **Flat rate** | Same price for all requests |
| **Endpoint-based** | Different prices per API route |
| **Payload-based** | Price varies by request/response size |
| **Metered** | Session-based, charged per unit consumed |
| **Tiered** | Volume discounts (first 100 at $X, next 1000 at $Y) |

### Request/Response Handling

- **Headers** — Forward client headers to upstream (strip `Authorization: Payment`)
- **Body** — Forward request body unchanged
- **Response** — Add `Payment-Receipt` header to upstream response
- **Errors** — Distinguish between payment errors (402) and upstream errors (pass through)

### Multi-Upstream Proxy

Route to different upstreams based on the path:

```typescript
const upstreams = {
  '/ai/': 'https://api.openai.com',
  '/data/': 'https://api.data-vendor.com',
  '/search/': 'https://api.search-engine.com',
};
```

### Best Practices

- Strip payment headers before forwarding to upstream
- Add service discovery (`/openapi.json`) describing proxied endpoints
- Implement caching for idempotent GET requests to reduce upstream calls
- Add response transformation if needed (but keep it minimal)
- Monitor upstream availability and return appropriate errors
- Set up health checks that verify both proxy and upstream availability
- Consider latency — the proxy adds the payment negotiation round-trip

Fetch the latest mppx proxy documentation and Cloudflare MPP integration guide for exact proxy API, configuration options, and edge deployment patterns before implementing.

Versions

The database has no other skills named mpp-proxy.

Database snapshot: 13.11.2026 · package version 3bce69a54aef (SHA-256 digest of the entire package)

Downloads in the last 30 days: 0 · ranking

Report a problem with this skill: harmful content, incorrect descriptions or an author’s removal request.

Similar skills

  • 100mpp-charge-flow
    Implement MPP one-time charge payment flows — per-request payment gates for API monetization, data access, and file downloads. Use when building pay-per-call APIs or protecting individual resources with HTTP 402 charges.
  • 100mpp-server-middleware
    Implement MPP server-side middleware for Hono, Express, Next.js, and Elysia. Use when protecting API routes with HTTP 402 payment gates, configuring payment methods, or setting up the Mppx server instance.
  • 100mpp
    Build with MPP (Machine Payments Protocol), open machine-to-machine payments over HTTP 402. Use for paid APIs, payment-gated endpoints, agent payment flows, MCP tool payments, or metered billing. Covers mppx (TS), pympp, and mpp Rust SDKs.
  • 95pay-with-any-token
    Pay HTTP 402 payment challenges using tokens via the Tempo CLI and Uniswap Trading API. Use when the user encounters a 402 Payment Required response, needs to fulfill a machine payment, mentions "MPP", "Tempo payment", "pay for API access", "HTTP 402", "x402", "machine payment…
  • 95lightning-amp-mpp
    Multi-Path Payments (MPP) — split a payment across multiple parallel routes; same payment hash, payment_secret binds parts. AMP (Atomic Multipath) — variant where each part has different hash; receiver derives shared secret. USE WHEN: implementing payment splitting, debugging…
  • 100okx-agent-payments-protocol
    Handle agent payments and paid endpoints via x402, MPP, payment links, a2a-pay, and HTTP-payment recurring or metered billing. Use for HTTP 402/payment-required; paid Agent or A2MCP endpoints; x402/Permit2; MPP channels, vouchers, or sessions; HTTP-payment subscriptions; or…

Feedback and reports

Your message goes to Bartosz Sokoliński. An email address is needed only for a reply. See the privacy policy.