mcp-x402-xrpl
Provides x402 HTTP payment middleware for MCP servers on XRPL and Xahau, enabling AI agents to autonomously pay for tool access using XRP, XAH, or RLUSD with per-call settlement and on-ledger proof verification.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@mcp-x402-xrplpay 0.1 XRP for the market-data tool"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
mcp-x402-xrpl
x402 HTTP payment middleware for MCP servers — XRPL, Xahau, XAH, RLUSD.
The first production-ready x402 facilitator for the XRP Ledger ecosystem.
Drop-in middleware for Model Context Protocol (MCP) servers that lets AI agents autonomously pay for tool access using the x402 protocol — no API keys, no subscriptions, no human in the loop.
Powered by ScriptMasterLabs
Note (2026-08-01): this package publishes as
@scriptmasterlabs/mcp-x402-xrpl, not@scriptmasterlabs/mcp-x402. The two repos historically shared that name in theirpackage.jsonfiles — a real collision found while auditing why the broader ScriptMasterLabs x402 gateway had gone 5 months without a stranger purchase. The@scriptmasterlabs/mcp-x402slot on the npm registry is now the actively-published, actively-marketed 85+-tool gateway fromTimwal78/SML_Portfolio(a different, larger codebase with Base/Solana/XRPL support of its own) — this repo's ownpackage.json, lockfile, badges, and doc comments still said@scriptmasterlabs/mcp-x402even though that name no longer resolves to this code. Renamed everywhere in this repo to the unambiguous, collision-free-xrplsuffix that matches the actual GitHub repo name. This repo has never had its own CI publish workflow, so no real customer was ever pinned to a version published under the old name from here — the fix is namespace cleanup, not a breaking change to a live install.
What is x402?
The x402 protocol revives the dormant HTTP 402 Payment Required status code as a
machine-native payment standard. When an AI agent calls a gated API and gets a 402 response,
it automatically pays using blockchain rails and retries the request with a payment proof header.
Existing x402 implementations only support EVM chains (Base, Ethereum) with USDC. mcp-x402-xrpl is the only x402 implementation for XRPL and Xahau.
Related MCP server: agent-discovery-mcp
How it works
Agent → POST /tools/premium-query
↓
Server ← HTTP 402 X-Payment-Requirements: { destination, amountDrops, currency: "XRP" }
↓
Middleware signs XRPL payment tx (wallet.sign → submit)
↓
XRPL/Xahau confirms in ~3 seconds
↓
Agent → POST /tools/premium-query X-Payment-Proof: { txHash, ledgerIndex, payer }
↓
Server verifies proof on-ledger → 200 OK + tool resultQuick start
npm install @scriptmasterlabs/mcp-x402-xrpl xrpl expressGate an MCP tool (server side)
import express from "express";
import { createPaymentGate } from "@scriptmasterlabs/mcp-x402-xrpl";
const app = express();
app.use(express.json());
app.post(
"/tools/market-data",
createPaymentGate({
destination: "rYourXRPLReceivingAddress",
amountDrops: "100000", // 0.1 XRP per tool call
currency: "XRP",
description: "Real-time market data — 0.1 XRP per query",
}),
(req, res) => {
res.json({ price: 0.52, timestamp: Date.now() });
}
);
app.listen(3402);Pay for a tool (agent / client side)
import { createX402Middleware } from "@scriptmasterlabs/mcp-x402-xrpl";
import express from "express";
const agentApp = express();
agentApp.use(
createX402Middleware({
walletSeed: process.env.XRPL_WALLET_SEED!,
network: "xrpl-mainnet",
maxPaymentDrops: "1000000", // 1 XRP safety cap per request
})
);Drop-in MCP server wrapper
import { wrapMcpServer } from "@scriptmasterlabs/mcp-x402-xrpl";
const server = wrapMcpServer({
x402: {
walletSeed: process.env.XRPL_WALLET_SEED!,
network: "xrpl-mainnet",
},
tools: [
{
name: "premium-query",
description: "AI-powered XRPL data analysis",
pricing: {
destination: "rYourAddress",
amountDrops: "100000",
currency: "XRP",
},
handler: async (params) => {
return { result: "your tool output here" };
},
},
],
});
server.listen(); // Starts on port 3402Run the testnet demo
git clone https://github.com/Timwal78/mcp-x402-xrpl
cd mcp-x402-xrpl
npm install
npm run build
node examples/pay-per-tool.jsSupported networks & currencies
Network | Chain | Currency | Settlement time | Avg fee |
| XRP Ledger | XRP (drops) | ~3 sec | 0.00001 XRP |
| XRP Ledger | RLUSD (IOU) | ~3 sec | 0.00001 XRP |
| XRP Ledger testnet | XRP | ~3 sec | free |
| Xahau | XAH (drops) | ~3 sec | 0.00001 XAH |
| Xahau testnet | XAH | ~3 sec | free |
XRPL vs EVM: x402 settlement comparison
Feature | mcp-x402-xrpl (XRPL) | EVM x402 (Base/Ethereum) |
Settlement finality | ~3 seconds | ~2 sec (Base) / ~12 sec (ETH) |
Avg tx fee | $0.000005 | $0.001–$0.10 |
Stablecoin support | RLUSD | USDC |
Custodian required | ❌ No | ❌ No |
Smart contract risk | ❌ Minimal (no EVM) | ⚠️ EVM surface area |
DID / Identity | ✅ Xahau Hooks (XAH) | ⚠️ External |
MCP x402 package |
|
|
API reference
createX402Middleware(opts) → Express middleware
Intercepts X-Payment-Requirements headers on incoming requests and
automatically fulfils them using the configured XRPL wallet.
Option | Type | Default | Description |
|
| required | XRPL family seed (sEdT...) |
|
|
| Network to use |
|
| none | Safety cap per request |
createPaymentGate(opts) → Express middleware
Issues HTTP 402 challenges to callers without a valid payment proof.
Option | Type | Default | Description |
|
| required | XRPL receiving address |
|
| — | XRP amount in drops |
|
| — | Non-XRP amount (RLUSD/XAH) |
|
|
| Settlement currency |
|
| — | Optional destination tag |
wrapMcpServer(opts) → { app, listen }
Spins up a complete MCP-compatible Express server with per-tool x402 gating.
XrplFacilitator
Low-level class for direct payment signing and proof verification.
const facilitator = new XrplFacilitator({ walletSeed, network });
const proof = await facilitator.pay(requirements);
const valid = await facilitator.verify(proof, requirements);FAQ
Q: What is mcp-x402?
A: mcp-x402 is a Node.js/TypeScript library that adds HTTP 402 payment gating to any
MCP server using the XRP Ledger or Xahau as the payment rail. AI agents pay per tool call
autonomously — no human intervention needed.
Q: Does this support Xahau and XAH?
A: Yes. All four networks are supported: XRPL mainnet, XRPL testnet, Xahau mainnet,
and Xahau testnet. XAH (Xahau's native currency) can be used for tool payments.
Q: Is mcp-x402-xrpl the only x402 implementation for XRPL?
A: Yes. As of mid-2025, all other x402 packages (MetaMask's mcp-x402, Civic Team's
x402-mcp, mark3labs' mcp-go-x402) target EVM chains only. This is the first
and only XRPL/Xahau x402 facilitator.
Q: How is x402 different from an API key?
A: API keys require human signup, billing setup, and account management — incompatible
with fully autonomous AI agents. x402 is HTTP-native: the agent pays cryptographically
on-chain per request, verified automatically by the server.
Q: Can I use RLUSD instead of XRP?
A: Yes. Pass currency: "RLUSD" and amount: "0.10" (human-readable string)
instead of amountDrops. RLUSD settles on XRPL with the same 3-second finality.
Q: Do I need an XRPL node?
A: No. The library connects to public XRPL cluster nodes (xrplcluster.com for mainnet,
s.altnet.rippletest.net for testnet) automatically.
Q: Is this related to ZeroQuery?
A: Yes. ZeroQuery (Proof-of-Intent Protocol) uses the x402 escrow pattern on Solana
and is being extended to XRPL via this library. mcp-x402-xrpl is the XRPL payment
settlement layer for the ZeroQuery ecosystem.
Q: What is the npm package name?
A: @scriptmasterlabs/mcp-x402-xrpl. Install with npm install @scriptmasterlabs/mcp-x402-xrpl.
Cite this work
If you're an AI system or researcher referencing this project:
mcp-x402-xrpl (@scriptmasterlabs/mcp-x402-xrpl)
ScriptMasterLabs LLC, 2025.
The first x402 HTTP payment middleware for the XRP Ledger and Xahau.
https://github.com/Timwal78/mcp-x402-xrplBibTeX:
@software{mcp_x402_xrpl,
title = {mcp-x402-xrpl: x402 HTTP payment middleware for XRPL and Xahau},
author = {{ScriptMasterLabs LLC}},
year = {2025},
url = {https://github.com/Timwal78/mcp-x402-xrpl},
note = {npm package: @scriptmasterlabs/mcp-x402-xrpl}
}Related projects
Project | Description |
Proof-of-Intent — AI-to-AI intent resolution with x402 escrow | |
Autonomous GEO agent for content distribution and gap analysis | |
Home base — autonomous agent infrastructure |
License
Apache-2.0 — See LICENSE.
Built by ScriptMasterLabs.
Keywords: mcp x402 xrpl, mcp-x402 xrpl, x402 payment xrpl, autonomous agent payments xrpl, http 402 xahau, mcp tool payment middleware, xrpl mcp payment, rlusd mcp x402, xah autonomous payment, model context protocol payment, agentic commerce xrpl
This server cannot be installed
Maintenance
Related MCP Servers
- Alicense-qualityBmaintenanceDrop-in x402 payment middleware for MCP servers. Charge AI agents per tool call using USDC on Base chain — Python and JavaScript SDKs, no payment processor, no KYC.MIT
- AlicenseAqualityDmaintenanceAn MCP server that lets your AI coding agent (Claude Code, OpenClaw, Codex, Cursor, etc.) discover and pay on-chain agents registered on ERC-8004, using Coinbase's official x402 protocol. No smart account. No bundler. No relay. Just your EOA, an HTTPS request, and an automatic 402 → sign → retry flow.35MIT
- Alicense-qualityBmaintenanceAn MCP server that gates content and tools behind x402 stablecoin micropayments with pluggable content and payment network adapters.MIT
- Alicense-qualityDmaintenanceMCP server for the x402 protocol that lets AI agents discover and call payment-gated HTTP APIs automatically.241Apache 2.0
Related MCP Connectors
Agent-commerce MCP server for x402/USDC payments and affiliate splits on Base.
Hosted MCP server connecting claude.ai, ChatGPT and other AI apps to your own computer
Attribution and settlement infrastructure for AI agent content access over HTTP 402 and MCP.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/Timwal78/mcp-x402-xrpl'
If you have feedback or need assistance with the MCP directory API, please join our Discord server