Transport.mcp
MCP transport for payments
Choose a signing account
Create a server-only wallet.ts module, then import account wherever an example creates a local signing account.
wallet.ts
import { privateKeyToAccount } from 'viem/accounts'
export const account = privateKeyToAccount(process.env.PRIVATE_KEY as `0x${string}`)MCP transport for client-side payment handling.
Usage
import { } from 'accounts'
import { , , } from 'mppx/client'
const = .({ : false }) // Avoid double 402 handling; mppx is configured below.
await .({ : 'wallet_connect' })
const = .({
: [({
: .({ : true }),
: .,
})],
: .(),
})import { , , } from 'mppx/client'
import { } from 'viem/accounts'
const = ('0x...')
const = .({
: [({ })],
: .(),
})Behavior
- Detects payment Challenges using error codes
-32042and-32043 - Extracts Challenges from
error.data.challenges[0] - Sends Credentials using
_meta["org.paymentauth/credential"]
Automatic JSON and SSE response inspection stops after 1 MiB. Larger responses remain available to the caller, but mppx doesn't inspect them for payment Challenges.
Return type
type McpTransport = Transport<Mcp.Request, Mcp.Response>Parameters
None.