Chuyển đến nội dung
Skillpedia
API và máy chủ (backend)7.0k · #13689

mppx

Skill này làm gì

Skill này bao gồm SDK TypeScript mppx cho lược đồ xác thực Payment HTTP. Nó dành cho nhà phát triển cần client của họ trả tiền cho tài nguyên hoặc server của họ thu phí.

Khi nào nên dùng

  • ✓Khi ứng dụng client của bạn nhận phản hồi 402 yêu cầu thanh toán và phải tự động trả tiền.
  • ✓Khi bạn muốn các route server thu phí truy cập bằng stablecoin Tempo hoặc Stripe.
  • ✓Khi bạn cần bọc một client hoặc server MCP để lời gọi công cụ có thể yêu cầu thanh toán.

Liên kết skill

https://github.com/internet-court/internet-court-skill/blob/main/vendored/tempo/mppx/SKILL.md

Sao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.

Cách dùng

Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.

Tin nhắn có sẵn để dán

Hãy dùng skill này để giúp tôi: https://github.com/internet-court/internet-court-skill/blob/main/vendored/tempo/mppx/SKILL.md Đọc tệp SKILL.md tại liên kết đó và làm theo hướng dẫn cho việc của tôi.
Bạn muốn AI tự tìm những skill như thế này?Cài MCP Skillpedia miễn phí: chỉ một dòng, và AI sẽ tìm trong 15.000+ skill trước mỗi việc.Cài đặt trong 1 phút →

Ví dụ cách nhờ AI

“Tôi muốn endpoint server của mình thu một khoản USDC nhỏ qua Tempo trước khi trả dữ liệu. Bạn có thể thiết lập điều này bằng mppx không?”

5 skill mới mỗi tuần. Đọc chỉ 1 phút.

Cách hoạt động

Agent thêm các helper mppx cho client hoặc server vào dự án, đặt loại tiền và số tiền, rồi gắn thử thách thanh toán vào route. Nó giữ secret key trên server và trả về biên nhận cần thiết.

Nội dung kỹ thuật (SKILL.md gốc)

Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.

mppx

TypeScript SDK for the "Payment" HTTP Authentication Scheme. Full 402 flow: challenge → credential → receipt.

What I can accomplish

  • Add 402 payment handling to a client with Fetch.polyfill or Fetch.from.
  • Protect HTTP routes with server-side MPP Challenges and Receipt responses.
  • Accept one-time Tempo stablecoin payments with tempo.charge.
  • Accept metered Tempo stablecoin payments with tempo.session.
  • Accept one-time card payments with stripe.charge.
  • Verify Credentials directly for custom transports or background workflows.
  • Wrap MCP clients and servers so tool calls can require payment.

Required inputs

  • Client integrations need a signing account and one or more client payment methods.
  • Server integrations need a recipient, currency, amount, and MPP_SECRET_KEY.
  • Tempo examples use chain ID 4217 unless a page explicitly covers Moderato testnet.
  • Stripe examples need a configured Stripe account and Shared Payment Token flow.
  • MCP integrations need the MCP client or server object to wrap.

Constraints

  • Keep MPP_SECRET_KEY server-side and out of logs.
  • Never commit private keys or wallet seeds.
  • Treat runtime 402 Challenges as authoritative for current payment terms.
  • Return id and opaque unchanged when responding to a Challenge.
  • Use USDC.e for Tempo bridged USDC examples, not generic USDC.

Client

import { Mppx, tempo } from 'mppx/client'

// Polyfills globalThis.fetch to handle 402 automatically
Mppx.create({
  methods: [tempo({ account })],
})

const res = await fetch('https://api.example.com/resource')

Without polyfilling:

const mppx = Mppx.create({
  methods: [tempo({ account })],
  polyfill: false,
})

const res = await mppx.fetch('https://api.example.com/resource')

Server

import { Mppx, Store, tempo } from 'mppx/server'
import { privateKeyToAccount } from 'viem/accounts'

const account = privateKeyToAccount('0x...')

const mppx = Mppx.create({
  methods: [
    tempo.charge({ currency: '0x...', recipient: '0x...' }),
    tempo.session({
      account,
      chainId: 4217,
      currency: '0x...',
      store: Store.memory(),
    }),
  ],
  secretKey: process.env.MPP_SECRET_KEY,
})

async function handler(request: Request): Promise<Response> {
  const result = await mppx.charge({ amount: '1.00' })(request)
  if (result.status === 402) return result.challenge
  return result.withReceipt(Response.json({ data: '...' }))
}

Methods

Method Intent Description
tempo.charge charge One-time stablecoin payment (TIP-20 token transfer on Tempo)
tempo.session session Streaming payments via payment channels on Tempo
stripe.charge charge One-time payment via Stripe

tempo() returns [tempo.charge, tempo.session] as a tuple using the current v2 Sessions implementation. Use tempo.charge() or tempo.session() individually if you only need one intent. Use tempo.sessionLegacy only for Legacy Sessions v1 compatibility.

Exports

Path Purpose
mppx Core primitives (Challenge, Credential, Method, Receipt, PaymentRequest)
mppx/client Mppx, tempo, stripe, session, Transport
mppx/server Mppx, tempo, stripe, Transport, Store, NodeListener
mppx/hono Hono middleware
mppx/express Express middleware
mppx/nextjs Next.js middleware
mppx/elysia Elysia middleware

CLI

mppx includes a CLI for making paid requests during development:

npx mppx account create        # create wallet
npx mppx mpp.dev/api/ping/paid # make paid request
npx mppx example.com -v        # verbose output

References

Câu hỏi thường gặp

Secret key được đặt ở đâu?

Skill nói MPP_SECRET_KEY nằm trên server và không xuất hiện trong log.

Skill hỗ trợ những phương thức thanh toán nào?

Skill nhắc đến thanh toán stablecoin Tempo một lần và theo mức sử dụng, cùng thanh toán thẻ qua Stripe.

Skill dùng USDC hay USDC.e?

Với ví dụ USDC bắc cầu trên Tempo, skill nói nên dùng USDC.e.

Chi tiết

Mô tả gốc của tác giả

TypeScript SDK for the Payment HTTP Authentication Scheme. Handles 402 Payment Required flows with Tempo, Stripe, and other payment methods. Use when integrating payments or mppx into a client or server application.

repo: internet-court/internet-court-skill

Độ phổ biến

Sao GitHub
7.0k
Vị trí xếp hạng
#13689
Giấy phép
—
Cập nhật
26/10/2026

Skill này có hữu ích không?

0

Đăng nhập để bình chọn.

Bình luận

  • …

Thêm skill từ kho mã này

Skill tương tự