When to use MPP vs x402
| x402 | MPP | |
|---|---|---|
| Best for | Occasional, one-off paid API calls | High-frequency or streaming micropayments |
| On-chain transactions | One per request | Two total (open + close) |
| Setup required | None | Open a channel first |
| Per-request cost | Full Stellar transaction fee | Near zero (off-chain commitments) |
| Settling | Automatic per call | Explicit mpp_close_session |
| Spending limit check | Per call | On open (full budget) |
x402_fetch when you need to call a paid API once or occasionally. Switch to MPP when you expect to make many requests to the same endpoint in a session — the cost and latency savings are significant.
Starting an MPP session
Open a session with a USDC budget
Tell your agent to open a payment channel with a total budget in USDC. All funds are deposited on-chain at this step and reserved against your spending limits.You can also specify a recipient address directly if you are not using the Nebula deploys a one-way payment channel Soroban contract and deposits your budget. The tool returns the channel contract address and session details.
MPP_RECIPIENT env var:The full
budget amount is checked against your MAX_PER_CALL and MAX_PER_DAY limits when the session opens. Individual mpp_fetch calls within the session are not separate spending-limit checks — they draw down the pre-approved budget.Make requests against the channel
Once a session is open, use You can call this as many times as needed. Nebula rejects any request that would push the cumulative commitment over the session budget.
mpp_fetch to call any MPP-gated URL. Each call signs a cumulative off-chain commitment — no per-request on-chain transaction is broadcast.Check session status
At any point during the session, inspect the channel balance to see how much of your budget you have committed and how much remains:The response shows the channel contract address, total budget, committed spend so far, and remaining balance.
What happens when you close
mpp_close_session broadcasts a close() call to the channel contract on Stellar. The contract:
- Verifies the final cumulative commitment signed by your agent.
- Transfers the committed USDC to the recipient.
- Refunds any remaining deposit to your funding wallet.
Configuring a default recipient
If you frequently pay the same recipient, setMPP_RECIPIENT in your MCP config so you do not need to pass it every time:
MPP_RECIPIENT is set, mpp_open_session uses it automatically unless you supply a recipient argument explicitly.
Spending limits and MPP
The budget you pass tompp_open_session is the only step subject to your spending caps. The full budget amount counts against both MAX_PER_CALL and the rolling MAX_PER_DAY window at the moment the channel opens. After that, individual mpp_fetch calls are purely off-chain and do not trigger additional limit checks.
This means you should size your budget carefully:
- Too small — you may exhaust the session budget mid-workflow and need to open a new channel.
- Too large — you lock up more USDC in the channel than needed (unused funds are refunded on close, but they are unavailable until then).
x402 Payments
Pay per-request with x402 when you only need occasional API calls.
On-Chain Policy
Lock in spending caps with a Soroban contract so limits cannot be bypassed.