本文へスキップ
Skillpedia
APIとサーバー(バックエンド)7.0k · #13689

mppx

できること

このスキルは、Payment HTTP認証の方式のためのmppx TypeScript SDKを扱います。リソースに支払う必要があるクライアントや、リソースに課金するサーバーを作る開発者向けです。

使う場面

  • ✓クライアントアプリが402の支払い要求の応答を受け、自動で支払う必要があるとき。
  • ✓Tempoのステーブルコインか、Stripeでサーバーのルートへのアクセスに課金したいとき。
  • ✓MCPのクライアントやサーバーを包み、ツールの呼び出しに支払いを求めたいとき。

スキルのリンク

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

コピーしてAI(Claude、ChatGPT、Cursor)に貼り付け、指示に従うよう頼んでください。

使い方

いちばん簡単な方法:メッセージをコピーしてAIに貼り付けるだけ。AIがスキルを読んで指示に従います。

貼り付け用メッセージ

このスキルを使って手伝ってください:https://github.com/internet-court/internet-court-skill/blob/main/vendored/tempo/mppx/SKILL.md このリンクのSKILL.mdファイルを読んで、私の作業でその指示に従ってください。
こういうスキルを、AIが自分で見つけてくれたら?無料のSkillpedia MCPをインストール。1行で、作業の前に15,000+のスキルから探してくれます。1分でインストール →

AIへの頼み方の例

“サーバーのエンドポイントが、データを返す前にTempoを通じて少額のUSDCの支払いを求めるようにしたいです。mppxで設定してもらえますか?”

毎週5つの新しいスキル。1分で読めます。

仕組み

エージェントは、mppxのクライアントまたはサーバーのヘルパーをプロジェクトに追加し、通貨と金額を設定して、支払いのチャレンジをルートに組み込みます。秘密鍵はサーバーに保ち、必要な領収書を返します。

技術的な内容(元のSKILL.md)

作者による元のテキスト(英語)をGitHubからそのまま表示しています。

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

よくある質問

秘密鍵はどこに置きますか?

MPP_SECRET_KEYはサーバーに保ち、ログに出さないとしています。

どの支払い方法に対応していますか?

Tempoの一回払いと従量のステーブルコインの支払い、およびStripeのカード払いに言及しています。

USDCかUSDC.eか?

Tempoのブリッジ済みUSDCの例では、USDC.eを使うとしています。

詳細

作者による元の説明

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

人気

GitHubのスター
7.0k
ランキング
#13689
ライセンス
—
更新日
2026/10/26

このスキルは役に立ちますか?

0

ログイン して投票しましょう。

コメント

  • …

このリポジトリの他のスキル

似ているスキル