β MBSS v3.0 Compliant - A comprehensive Model Context Protocol (MCP) server for XRP Ledger (XRPL) testnet integration with AI systems.
- Tool Count: 52 tools (25 MBSS mandatory + 27 XRP-specific)
- Network: XRP Ledger Testnet (testnet-only server)
- Architecture: MBSS v3.0 Unified Standard compliant
- Test Coverage: 95%+ enforced with security & chaos testing
- Help System: Interactive tool discovery and guidance
- Performance: Production-ready with proper error handling
graph TB
A[AI Assistant] --> B[MCP Server]
B --> C[XRP Ledger Client]
C --> D[XRP Ledger Node]
B --> E[Help System]
B --> F[Tool Registry]
E --> G[Tool Discovery]
F --> H[Tool Execution]
subgraph "Core Components"
B
E
F
end
subgraph "External Services"
C
D
G
H
end
Component Legend:
- MCP Server: Main server handling MCP protocol
- XRP Ledger Client: XRPL network interaction via WebSocket
- XRP Ledger Node: Blockchain node for data queries
- Help System: Interactive tool discovery and guidance
- Tool Registry: Centralized tool metadata management
- Chain Information - Network statistics, health, and configuration details
- Balance Queries - XRP balances with formatted and raw values
- Transaction Lookup - Detailed transaction analysis with fee data
- Block Information - Ledger data with transaction counts and timestamps
- Address Validation - Format validation and network verification
- Wallet Creation - Generate new wallets (development/testing only)
- Wallet Import - Import from seed phrases or keys
- Account Information - Comprehensive wallet details and settings
- Balance Monitoring - Real-time balance tracking
- XRP Payments - Send XRP with path finding and fee estimation
- DEX Trading - Order book management and trade execution
- Fee Estimation - Smart fee calculation for different transaction types
- Testnet Funding - Automated test XRP requests for development
- xrp_get_amm_info - Query AMM pool details β
- xrp_create_trustline - Establish trust line for token β
- xrp_remove_trustline - Remove trust line (set limit to 0) β
- xrp_get_trustlines - Get all trustlines for account β
- xrp_send_token - Send issued tokens β
- xrp_create_escrow - Create time/conditional escrow β
- xrp_finish_escrow - Complete escrow with fulfillment β
- xrp_cancel_escrow - Cancel expired escrow β
- xrp_get_escrows - List account escrows β
- xrp_mint_nft - Create NFT (basic) β
- xrp_mint_nft_with_ipfs - Create NFT with IPFS storage (Pinata/Web3.Storage) β π
- xrp_burn_nft - Destroy NFT β
- xrp_create_nft_offer - Create sell/buy offers β
- xrp_accept_nft_offer - Accept NFT offer β
- xrp_get_nfts - List account NFTs β
- xrp_get_conversation_guidance - Contextual prompts for guided agent flows β
- xrp_generate_nft_image - IPFS-ready image generation helper for NFT minting β
- xrp_get_ledger - Ledger information β
- xrp_get_transaction - Transaction details β
- xrp_get_server_info - Network status β
- xrp_get_ledger_entry - Get specific ledger entry β
- xrp_get_account_objects - Get account-owned objects β
- xrp_subscribe - Real-time ledger updates β
- xrp_decode_transaction - Decode transaction blob β
- β 40 tools fully implemented and tested
- π All core XRPL features supported
- π Complete with examples and documentation
- Node.js: v18.0.0 or higher
- npm: Latest stable version
- Git: For cloning repository
# Clone the repository
git clone https://github.com/your-repo/xrp-testnet-mcp-server.git
cd xrp-testnet-mcp-server
# Install dependencies
npm install
# Build the server
npm run build
# Run with MCP Inspector for testing
npm run inspectCreate a .env file in the root directory:
# Network Configuration
XRP_NETWORK=testnet
RPC_URL=wss://s.altnet.rippletest.net:51233
CHAIN_ID=NA
# Optional: IPFS configuration for NFT operations
PINATA_API_KEY=your_pinata_api_key
PINATA_SECRET_KEY=your_pinata_secret_key
IPFS_SERVICE=pinataAdd to your Claude Desktop configuration (~/Library/Application Support/Claude/claude_desktop_config.json):
{
"mcpServers": {
"xrp-testnet": {
"command": "node",
"args": ["/path/to/xrp-testnet-mcp-server/dist/index.js"],
"cwd": "/path/to/xrp-testnet-mcp-server",
"env": {
"XRP_NETWORK": "testnet"
}
}
}
}# Build Docker image
docker build -t xrp-testnet-mcp-server .
# Run container
docker run -p 3000:3000 xrp-testnet-mcp-server{
"tool": "xrp_get_chain_info",
"arguments": {}
}{
"tool": "xrp_get_balance",
"arguments": {
"address": "rN7n7otQDd6FczFgLdSqtcsAUxDkw6fzRH"
}
}{
"tool": "xrp_create_wallet",
"arguments": {}
}- Check balance:
{
"tool": "xrp_get_balance",
"arguments": {
"address": "rN7n7otQDd6FczFgLdSqtcsAUxDkw6fzRH"
}
}- Send payment:
{
"tool": "xrp_send_transaction",
"arguments": {
"to": "rB7ASwFaJ2ryXUDUN8ViiVWba1ikXcqFxB",
"amount": "10",
"seed": "your_wallet_seed"
}
}{
"tool": "xrp_help",
"arguments": {
"topic": "balance_queries"
}
}{
"tool": "xrp_search_tools",
"arguments": {
"query": "balance"
}
}Get comprehensive XRP Ledger network information.
Purpose: Network health, statistics, and configuration details
Parameters: None
Returns:
{
"network": "string",
"ledgerVersion": "number",
"fee": "string",
"reserves": "object",
"validatedLedger": "object",
"serverInfo": "object"
}Get XRP balance for an address.
Purpose: Query account balances with formatted and raw values
Parameters:
address(string, required): XRP Ledger address
Returns:
{
"address": "string",
"balance": "string",
"balanceRaw": "string",
"symbol": "XRP",
"reserves": "string"
}Get detailed transaction information by hash.
Purpose: Transaction analysis with fee and validation data
Parameters:
hash(string, required): Transaction hash
Returns:
{
"hash": "string",
"validated": "boolean",
"ledgerIndex": "number",
"account": "string",
"destination": "string",
"amount": "string",
"fee": "string",
"meta": "object"
}- xrp_mint_nft: Create basic NFT
- xrp_mint_nft_with_ipfs: Create NFT with IPFS storage
- xrp_burn_nft: Destroy NFT
- xrp_create_nft_offer: Create sell/buy offers
- xrp_accept_nft_offer: Accept NFT offer
- xrp_get_nfts: List account NFTs
- xrp_create_trustline: Establish trust line for token
- xrp_remove_trustline: Remove trust line
- xrp_get_trustlines: Get all trustlines for account
- xrp_send_token: Send issued tokens
- xrp_create_escrow: Create time/conditional escrow
- xrp_finish_escrow: Complete escrow with fulfillment
- xrp_cancel_escrow: Cancel expired escrow
- xrp_get_escrows: List account escrows
- xrp_place_order: Create buy/sell orders
- xrp_cancel_order: Cancel existing orders
- xrp_get_orderbook: Get order book data
- xrp_get_order_history: Get trading history
- xrp_get_amm_info: Query AMM pool details
- xrp_get_ledger: Ledger information
- xrp_get_server_info: Network status
- xrp_get_ledger_entry: Get specific ledger entry
- xrp_get_account_objects: Get account-owned objects
- xrp_subscribe: Real-time ledger updates
- xrp_decode_transaction: Decode transaction blob
- xrp_request_faucet: Request testnet XRP
- xrp_get_conversation_guidance: Contextual prompts for guided flows
- xrp_generate_nft_image: IPFS-ready image generation helper
- xrp_get_account_info: Comprehensive account details
- XRP Ledger Testnet (Chain ID: N/A)
- Purpose: Primary XRP Ledger test network for development and testing
- Block Time: ~3-5 seconds
- Consensus: Ripple Protocol Consensus Algorithm (RPCA)
- Native Token: XRP (Ripple)
- XRP Ledger Devnet: Alternative testing network with controlled features
- Official XRPL Faucet: https://faucet.altnet.rippletest.net/
- XRPL Dev Portal: https://xrpl.org/xrp-testnet-faucet.html
- Primary: wss://s.altnet.rippletest.net:51233
- Backup: wss://testnet.xrpl-labs.com
- WebSocket: wss://s.altnet.rippletest.net:51233
XRP_NETWORK- Set totestnetordevnet(defaults to testnet)PINATA_API_KEY- Pinata API key for IPFS uploadsPINATA_SECRET_KEY- Pinata secret key for IPFS uploadsIPFS_SERVICE- IPFS service to use (pinata | web3Storage | nftStorage)
- Testnet Explorer: https://testnet.xrpl.org/
- Testnet WebSocket: wss://s.altnet.rippletest.net:51233
- Devnet Explorer: https://devnet.xrpl.org/
- XRPL Dev Tools: https://xrpl.org/dev-tools.html
The server now supports decentralized NFT storage via IPFS using Pinata, Web3.Storage, or NFT.Storage.
-
Get a Pinata Account (Recommended)
- Sign up at pinata.cloud
- Get 1GB free storage (50% off with code NFTSTORAGE50)
- Create API keys in dashboard
-
Configure Environment
# .env file PINATA_API_KEY=your_api_key PINATA_SECRET_KEY=your_secret_key IPFS_SERVICE=pinata -
Use the Enhanced NFT Tool
// Tool #37: xrp_mint_nft_with_ipfs { "seed": "your_wallet_seed", "name": "My NFT", "description": "NFT with IPFS storage", "imageUrl": "https://example.com/image.jpg", "attributes": [ { "trait_type": "Rarity", "value": "Legendary" } ], "flags": 8, // 8 = transferable "transferFee": 1000 // 1% royalty }
- β Permanent, decentralized storage
- β No single point of failure
- β Content-addressed (tamper-proof)
- β Globally accessible via any IPFS gateway
- β Metadata and images stored separately
User: "Create an NFT called 'Majestic Eagle' with a bald eagle image"
Assistant: "I'll create that NFT for you. Let me use a stock image of a bald eagle:"
// Uses Unsplash or similar stock photo
await xrp_mint_nft_with_ipfs({
seed: "your_wallet_seed",
name: "Majestic Eagle",
description: "A powerful bald eagle soaring through the sky",
imageUrl: "https://images.unsplash.com/photo-[eagle-id]",
attributes: [
{ trait_type: "Species", value: "Bald Eagle" },
{ trait_type: "Rarity", value: "Legendary" }
]
})User: "I have an image at https://mysite.com/art.jpg - make it an NFT with cool metadata"
Assistant: "I'll mint that as an NFT with enhanced metadata:"
await xrp_mint_nft_with_ipfs({
seed: "your_wallet_seed",
name: "Custom Artwork",
imageUrl: "https://mysite.com/art.jpg",
// Auto-generates rich metadata
})User: "Create an NFT of a cyberpunk dragon with these traits: Element=Fire, Rarity=Mythic, Power=9000"
Assistant: "I'll create that NFT with all specified traits:"
- Finds appropriate dragon image from stock photos
- Uploads to IPFS via Pinata
- Creates metadata with all traits
- Mints on XRP Ledger
- Returns IPFS links and transaction hash
-
Stock Photo APIs (current):
- Unsplash: Free, high-quality photos
- Pexels: Free stock photos
- Pixabay: Free images and illustrations
-
User-Provided URLs:
- Any public image URL
- Cloud storage links (Dropbox, Google Drive public links)
- IPFS URLs (already decentralized)
-
Future Enhancements:
- AI image generation (DALL-E, Stable Diffusion)
- Direct file uploads
- Image search integration
Query account details and balances on testnet.
Parameters:
address(string): XRP Ledger address
Example:
{
"address": "rN7n7otQDd6FczFgLdSqtcsAUxDkw6fzRH"
}Send XRP or tokens on testnet.
Parameters:
destination(string): Recipient addressamount(string): Amount to sendcurrency(string, optional): Currency code (default: XRP)
Example:
{
"destination": "rN7n7otQDd6FczFgLdSqtcsAUxDkw6fzRH",
"amount": "10",
"currency": "XRP"
}Create buy/sell orders on the testnet DEX.
Parameters:
side(string): "buy" or "sell"amount(string): Order amountprice(string): Order pricepair(string): Trading pair
Example:
{
"side": "buy",
"amount": "100",
"price": "0.5",
"pair": "USD/XRP"
}For complete tool documentation with parameters and examples, use the MCP Inspector or refer to the source code.
- Native DEX Testing: Test the world's oldest DEX operating since 2012
- Native AMM: Test protocol-level automated market makers
- Built-in Escrow: Test time-based and conditional escrow without smart contracts
- Payment Channels: Test micropayment infrastructure for high-frequency transactions
- Fast Settlement: 3-5 seconds for rapid development iteration
- Low Fees: Fraction of a cent per transaction (even lower on testnet)
- Energy Efficient: Minimal environmental impact for extensive testing
- Multi-signing: Test native multi-signature support
Unlike Ethereum-based chains that require smart contracts, XRPL testnet provides:
- Built-in DEX with auto-bridging for comprehensive testing
- Native AMM functionality without external protocols
- Escrow system without contract deployment
- Payment channels for micropayment testing
- Multi-signature transactions for security testing
- Token issuance and management with native commands
- No Real Value: Testnet tokens have no monetary value
- Network Resets: Testnet may be reset, wiping all data
- Experimental Features: Latest features may be unstable
- Rate Limits: Testnet servers may have stricter rate limits
- Test All Features: Thoroughly test DEX, AMM, and escrow functionality
- Account Management: Test both funded and unfunded account scenarios
- Transaction Fees: Monitor fee escalation during network stress
- Sequence Numbers: Test transaction ordering and ticket usage
- Trust Lines: Test token issuance and trust relationships
# Development mode
npm run dev
# Build TypeScript
npm run build
# Run tests
npm test- Language: TypeScript
- Framework: xrpl.js v4.4.0
- Architecture: MCP Server Protocol
- Networks: Testnet/Devnet support
- Performance: 1,500 TPS, 3-5 second settlement
- Consensus: Unique consensus algorithm (not PoW or PoS)
- Environment: Testnet/Development only
- Testnet Only: This server is configured for XRP Ledger testnet only
- No Private Key Storage: Server never stores private keys or seeds
- Development Tools: Wallet creation tools are for development/testing only
- Network Verification: Always verify network before transactions
- Input Validation: All inputs validated with Zod schemas
- Error Sanitization: Error messages don't expose sensitive data
- Rate Limiting: Built-in rate limiting protection
- Multi-network Isolation: Testnet/devnet/mainnet environment separation
- Security Testing: Comprehensive injection and XSS protection
- Chaos Testing: Fault tolerance and failure recovery testing
- Private Key Protection: No private key storage or logging
- Test First: Always test transactions on testnet
- Verify Addresses: Double-check recipient addresses
- Fee Management: Monitor transaction fees and reserves
- Backup Recovery: Keep wallet seeds secure
- Network Selection: Use appropriate network for your use case
- Private Key Exposure: Never share or log private keys or seeds
- Faucet Limits: Testnet faucets have rate limits
- Transaction Confirmation: Wait for ledger validation before considering transactions final
- Trust Line Risks: Verify issuer addresses before creating trust lines
Problem: "Failed to connect to XRP Ledger" Solution:
- Verify WebSocket URL in environment variables
- Check network connectivity
- Try alternative XRP Ledger nodes
- Ensure testnet node is accessible
Problem: "Unknown tool: xrp_tool_name" Solution:
- Verify tool name spelling
- Check MBSS naming convention
- Use
xrp_helpfor tool discovery - Update MCP server configuration
Problem: "Balance shows 0 for valid address" Solution:
- Verify address format and network
- Check if address is activated (20 XRP reserve)
- Use testnet faucet if needed
- Wait for ledger synchronization
Problem: "Account not found error" Solution:
- Account may not be activated
- Fund account with at least 20 XRP
- Use
xrp_request_faucetfor testnet XRP - Verify address format
Invalid address format: Check address format and networkAccount not activated: Fund account with minimum reserve (20 XRP)Insufficient XRP balance: Add funds to wallet or use faucetTrust line not found: Create trust line before token operationsFee exceeds available balance: Ensure sufficient XRP for transaction fees
- Use
xrp_helpfor interactive assistance - Use
xrp_search_toolsto find relevant tools - Check this README for examples
- Review error logs in server output
- Language: TypeScript with strict type checking
- Framework: Model Context Protocol (MCP) SDK
- Validation: Zod schema validation for all inputs
- Testing: Jest with 95%+ coverage, security & chaos tests
- Build System: TypeScript compiler with ES2022 target
- Architecture: MBSS v3.0 compliant modular design
{
"@modelcontextprotocol/sdk": "^1.0.0",
"zod": "^3.22.0",
"xrpl": "^4.4.0",
"axios": "^1.7.0",
"uuid": "^10.0.0"
}src/
βββ index.ts # Main server entry point
βββ client.ts # XRP Ledger client abstraction
βββ constants.ts # Configuration constants
βββ logger.ts # MBSS-compliant logging
βββ types.ts # TypeScript type definitions
βββ tools/ # Organized tool modules
β βββ core/ # MBSS v3.0 mandatory tools (25)
β βββ wallet/ # Wallet management tools
β βββ tokens/ # Token operations
β βββ nft/ # NFT operations
β βββ escrow/ # Escrow operations
β βββ dex/ # DEX trading tools
β βββ amm/ # AMM operations
β βββ advanced/ # Advanced features
β βββ special/ # AI utilities
β βββ help/ # Help system tools
βββ utils/ # Shared utilities
- Response Time: <5 seconds for standard operations
- Concurrent Requests: Up to 10 simultaneous requests
- Memory Usage: ~50MB base + ~10MB per active connection
- Network: Optimized WebSocket connections with reconnection
- Test Coverage: 95%+ enforced with comprehensive testing
- Security: Input validation, injection protection, chaos testing
- Ledger Settlement: 3-5 seconds for transaction validation
- Consensus: Unique RPCA algorithm (not PoW or PoS)
MIT