Package Exports
- @dexterai/mpp
- @dexterai/mpp/client
- @dexterai/mpp/server
Readme
@dexterai/mpp
Managed Solana settlement for the Machine Payments Protocol. Accept MPP payments without running blockchain infrastructure.
What This Is
An MPP payment method that lets any seller accept Solana USDC payments through the Machine Payments Protocol — with Dexter handling all settlement infrastructure.
Sellers install this package and get:
- Zero blockchain operations. No RPC connections, no fee payer wallets, no SOL for gas. Dexter handles co-signing, simulation, broadcast, and confirmation.
- Gas-free for buyers. Dexter sponsors all transaction fees. Buyers only need USDC and a Solana wallet.
- Production-grade settlement. The same security validation, backpressure controls, and smart wallet support that powers 50% of daily x402 transactions — now available as an MPP method.
- Standard MPP protocol. Works with any
mppxclient. Supports HTTP and MCP transports.
The method name is dexter. Clients that support custom MPP methods will discover and use it automatically.
Quick Start
Install
npm install @dexterai/mppPeer dependencies: mppx, @solana/kit, @solana-program/token, @solana-program/compute-budget
Server
Add Solana payments to any endpoint in a few lines:
import { Mppx } from 'mppx/server';
import { charge } from '@dexterai/mpp/server';
const mppx = Mppx.create({
methods: [
charge({
recipient: 'YourSolanaWalletAddress...',
}),
],
});
export async function handler(request: Request) {
const result = await mppx.charge({
amount: '10000', // 0.01 USDC (6 decimals)
currency: 'USDC',
})(request);
if (result.status === 402) return result.challenge;
return result.withReceipt(Response.json({ data: 'premium content' }));
}That's it. No RPC URL, no private keys, no SOL balance. Dexter's settlement API handles everything.
Client
import { Mppx } from 'mppx/client';
import { charge } from '@dexterai/mpp/client';
import { createKeyPairSignerFromBytes } from '@solana/kit';
const signer = await createKeyPairSignerFromBytes(yourKeypairBytes);
Mppx.create({
methods: [charge({ signer })],
});
// 402 responses are handled automatically.
const response = await fetch('https://api.example.com/paid-endpoint');The client reads the fee payer and blockhash from the challenge — no RPC access needed.
How It Works
Client Seller Server Dexter Settlement API Solana
│ │ │ │
│ GET /resource │ │ │
│──────────────────────────>│ POST /mpp/prepare │ │
│ │────────────────────────────>│ │
│ │ { feePayer, blockhash } │ │
│ │<────────────────────────────│ │
│ 402 + Challenge │ │ │
│<──────────────────────────│ │ │
│ │ │ │
│ Build + sign tx │ │ │
│ │ │ │
│ GET /resource + cred │ │ │
│──────────────────────────>│ POST /mpp/settle │ │
│ │────────────────────────────>│ validate │
│ │ │ co-sign │
│ │ │ simulate ─────────>│
│ │ │ broadcast ────────>│
│ │ │ confirm <──────────│
│ │ { success, signature } │ │
│ │<────────────────────────────│ │
│ 200 + Receipt + content │ │ │
│<──────────────────────────│ │ │- Seller server calls Dexter's
/mpp/prepareto get the fee payer public key and a fresh blockhash - MPP sends a 402 challenge to the client with these details
- Client builds a
TransferCheckedtransaction, sets Dexter as fee payer, partially signs - Seller server forwards the signed transaction to Dexter's
/mpp/settle - Dexter validates (program allowlist, compute caps, fee payer isolation), co-signs, simulates, broadcasts, confirms, and verifies on-chain
- Seller server returns the content with an MPP receipt
Server Options
charge({
recipient: string; // Required. Solana wallet to receive payments.
apiUrl?: string; // Dexter API URL. Default: https://x402.dexter.cash
network?: string; // Solana network. Default: mainnet-beta
splToken?: string; // SPL token mint. Default: USDC
decimals?: number; // Token decimals. Default: 6
})Devnet
charge({
recipient: 'YourDevnetWallet...',
network: 'devnet',
})Custom Dexter Instance
charge({
recipient: 'YourWallet...',
apiUrl: 'http://localhost:4072',
})Client Options
charge({
signer: TransactionSigner; // Required. Any @solana/kit TransactionSigner.
computeUnitPrice?: bigint; // Priority fee in micro-lamports. Default: 1
computeUnitLimit?: number; // Compute unit limit. Default: 50,000
})Works with:
createKeyPairSignerFromBytes()from@solana/kitfor headless agents- ConnectorKit's
useTransactionSigner()for browser wallets - Any
TransactionSignerimplementation
Package Exports
// Shared schema (method name, intent, Zod schemas)
import { charge } from '@dexterai/mpp';
// Server method (delegates settlement to Dexter API)
import { charge } from '@dexterai/mpp/server';
// Client method (builds + signs Solana transactions)
import { charge } from '@dexterai/mpp/client';Dexter Settlement API
The settlement endpoints are open — no API keys, no accounts. Backpressure is tracked per recipient wallet address.
| Method | Path | Description |
|---|---|---|
| POST | /mpp/prepare |
Returns fee payer pubkey, recent blockhash, and token config |
| POST | /mpp/settle |
Full settlement: validate, co-sign, simulate, broadcast, confirm |
Production: https://x402.dexter.cash/mpp/
These endpoints run on the same infrastructure as Dexter's x402 facilitator — the same security validation, backpressure controls, and Sentry observability.
Why Not Run Settlement Yourself?
The Solana MPP SDK lets you embed settlement directly in your server. That works, but it means you operate:
- Solana RPC connections and failover
- A fee payer wallet funded with SOL
- Transaction simulation and retry logic
- Blockhash management and expiry handling
- Key security for the signing wallet
- Fee payer balance monitoring
@dexterai/mpp delegates all of that to Dexter. You install a package and set your recipient address.
Development
npm install
npm run build # Compile to dist/
npm run typecheck # TypeScript checks
npm test # Run testsRelated
- dexter-facilitator — Settlement API and x402 facilitator
- @dexterai/x402 — Full-stack x402 SDK
- MPP Protocol — Machine Payments Protocol specification
- Solana MPP SDK — Self-hosted Solana MPP (if you prefer to run your own settlement)
License
MIT — see LICENSE