Quigles1337/RGB-MCP-SERVERv2
If you are the rightful owner of RGB-MCP-SERVERv2 and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.
RGB MCP Server v1 is a Model Context Protocol server designed to facilitate RGB smart contracts with trustlines protocol and XRPL bridge functionality.
RGB MCP Server v1
A Model Context Protocol (MCP) server for RGB smart contracts with trustlines protocol and XRPL bridge functionality
š Overview
RGB MCP Server v1 is a comprehensive MCP server that brings RGB smart contract functionality to AI assistants like Claude, with advanced features including:
- RGB Smart Contracts: Issue, transfer, and manage RGB assets on Bitcoin/Lightning
- Bilateral Credit Lines (Trustlines): Enable credit-based transfers without immediate asset movement
- Payment Channels: Bidirectional channels for off-chain RGB asset transfers
- XRPL Bridge: Cross-chain bridge between RGB and XRP Ledger via payment channels
- Full MCP Integration: 18+ tools for complete RGB ecosystem interaction
šļø Architecture
RGB Assets (Bitcoin/Lightning)
ā
Trustlines Protocol (Credit Lines)
ā
Payment Channels (Off-Chain)
ā
XRPL Bridge (Cross-Chain)
ā
XRPL Ledger (IOUs)
Key Components
- RGB Service: Interface for RGB protocol operations (asset issuance, transfers, validation)
- Trustlines Service: Bilateral credit line protocol ported from Stacks implementation
- Payment Channels Service: Bidirectional channels for RGB assets
- Bridge Service: RGB ā XRPL cross-chain bridge using payment channels
- XRPL Service: Integration with XRP Ledger for IOU minting/burning
š¦ Installation
Prerequisites
- Node.js >= 18.0.0
- RGB node (for production use)
- Bitcoin node (testnet/mainnet)
- Lightning node (optional, for Lightning Network RGB)
- XRPL node access (or use public nodes)
Setup
# Clone the repository
git clone https://github.com/Quigles1337/RGB-MCP-SERVERv1.git
cd RGB-MCP-SERVERv1
# Install dependencies
npm install
# Build TypeScript
npm run build
# Or run in development mode
npm run dev
Configuration
Create a .env
file (see .env.example
):
# RGB Configuration
RGB_NETWORK=testnet
RGB_NODE_URL=http://localhost:3000
# Bitcoin Configuration
BITCOIN_NETWORK=testnet
BITCOIN_RPC_URL=http://localhost:18332
BITCOIN_RPC_USER=user
BITCOIN_RPC_PASSWORD=password
# XRPL Configuration
XRPL_NETWORK=testnet
XRPL_NODE_URL=wss://s.altnet.rippletest.net:51233
# Bridge Configuration
BRIDGE_ENABLED=true
BRIDGE_FEE_PERCENT=0.3
BRIDGE_MIN_AMOUNT=10
BRIDGE_MAX_AMOUNT=100000
# Trustlines Configuration
TRUSTLINES_ENABLED=true
TRUSTLINES_DEFAULT_LIMIT=1000000
# Payment Channels Configuration
PAYCHAN_ENABLED=true
PAYCHAN_EXPIRY_BLOCKS=1440
PAYCHAN_MIN_DEPOSIT=1000
š§ MCP Integration
Cursor IDE
Create .cursor/mcp.json
:
{
"mcpServers": {
"rgb-mcp-server": {
"command": "node",
"args": ["C:/Users/YourName/RGB-MCP-SERVERv1/dist/server.js"],
"env": {
"RGB_NETWORK": "testnet",
"XRPL_NETWORK": "testnet",
"BRIDGE_ENABLED": "true",
"TRUSTLINES_ENABLED": "true"
}
}
}
}
Or for development:
{
"mcpServers": {
"rgb-mcp-server": {
"command": "npx",
"args": ["tsx", "C:/Users/YourName/RGB-MCP-SERVERv1/src/server.ts"]
}
}
}
Claude Desktop
Add to claude_desktop_config.json
:
{
"mcpServers": {
"rgb-mcp-server": {
"command": "node",
"args": ["/path/to/RGB-MCP-SERVERv1/dist/server.js"]
}
}
}
š ļø Available Tools
RGB Smart Contract Tools (5 tools)
rgb_issue_asset
Issue a new RGB fungible asset.
{
ticker: "RGB", // Asset ticker (max 10 chars)
name: "RGB Token", // Full name
description: "...", // Description
precision: 8, // Decimal places
supply: "1000000000", // Initial supply in base units
seal: "txid:vout" // Bitcoin UTXO that owns the asset
}
rgb_transfer_asset
Transfer RGB asset to another owner.
{
assetId: "...", // RGB asset contract ID
amount: "1000", // Amount in base units
recipientBlindedUtxo: "...", // Recipient blinded UTXO
changeUtxo: "..." // Optional change UTXO
}
rgb_get_asset_info
Get detailed information about an RGB asset.
rgb_get_balance
Get RGB asset balance (available, pending, total).
rgb_validate_contract
Validate RGB contract for correctness.
Trustlines Tools (5 tools)
trustline_create
Create bilateral credit line between two participants.
{
assetId: "...", // RGB asset ID
participant1: "...", // First participant address
participant2: "...", // Second participant address
limit1: "10000", // Credit limit P1 ā P2
limit2: "10000" // Credit limit P2 ā P1
}
trustline_transfer_credit
Transfer credit through trustline (off-chain, instant).
{
trustlineId: "...",
from: "...",
to: "...",
amount: "100"
}
trustline_settle
Settle trustline exposure with RGB asset transfer (on-chain).
{
trustlineId: "...",
from: "...", // Debtor
to: "...", // Creditor
amount: "100" // Amount to settle
}
trustline_get_info
Get detailed trustline information including exposures.
trustline_list
List trustlines filtered by participant and/or asset.
Payment Channels Tools (1 tool shown)
paychan_open
Open bidirectional payment channel for RGB asset.
{
assetId: "...",
participant1: "...",
participant2: "...",
deposit1: "1000", // P1's deposit
deposit2: "1000", // P2's deposit
expiryBlocks: 1440 // Optional: blocks until expiry
}
Bridge Tools (3 tools)
bridge_to_xrpl
Swap RGB asset for XRPL IOU (backed 1:1 by actual RGB).
How it works: User transfers RGB to operator, receives XRPL IOU from operator's inventory.
{
rgbAssetId: "...", // RGB asset to swap
amount: "100", // Amount to swap
rgbSender: "...", // Your RGB address
xrplDestination: "rAddress...", // Your XRPL address
xrplIssuer: "rIssuer..." // Bridge operator's XRPL address
}
bridge_to_rgb
Swap XRPL IOU back for RGB asset (from operator's inventory).
How it works: User sends IOU to operator, receives actual RGB asset from operator's inventory.
{
xrplCurrency: "RGB", // XRPL IOU currency code
xrplIssuer: "rIssuer...", // Bridge operator's address
amount: "100", // Amount to swap
xrplSender: "rAddress...", // Your XRPL address
rgbDestination: "..." // Your RGB address
}
bridge_get_status
Get status of bridge operation.
XRPL Tools (2 tools)
xrpl_create_account
Create new XRPL account with optional testnet funding.
{
fundTestnet: true // Optional: auto-fund from faucet
}
xrpl_set_trustline
Set XRPL trust line to receive bridged RGB assets as IOUs.
{
walletSecret: "s...",
currency: "RGB",
issuer: "rIssuer...",
limit: "1000000"
}
š” Use Cases
1. RGB Asset Management
Issue RGB asset ā Transfer to users ā Validate contracts
2. Credit-Based Transfers (Trustlines)
Create trustline ā Transfer credit (off-chain, instant) ā Settle later with RGB
Benefits:
- Instant transfers without blockchain transactions
- Credit lines enable liquidity
- Settlement only when needed
- Reduces on-chain fees
3. Payment Channels
Open channel ā Update state off-chain ā Close when done
Benefits:
- Off-chain RGB transfers
- Near-instant finality
- Minimal fees
- Bridge to XRPL via channels
4. Cross-Chain Bridge (RGB ā XRPL)
RGB Asset ā Lock in vault ā Mint IOU on XRPL ā Trade on XRPL DEX
XRPL IOU ā Burn ā Unlock RGB Asset
Benefits:
- Access XRPL's 3-5 second finality
- Trade RGB assets on XRPL DEX
- Cross-chain liquidity
- Payment channels facilitate bridge
š Bridge Architecture v2.0
ā ļø IMPORTANT: RGB is a PROTOCOL, not a network! There is no "RGB token" to mint or burn.
Liquidity Pool + Trustlines Model
The bridge uses a swap-based model where the bridge operator acts as a market maker:
RGB ā XRPL Flow (Swap Operation)
1. User transfers RGB asset to bridge operator
2. Trustline established for credit buffer
3. Operator swaps from XRPL IOU inventory
4. User receives XRPL IOU (backed 1:1 by actual RGB)
XRPL ā RGB Flow (Reverse Swap)
1. User sends XRPL IOU to bridge operator
2. Trustline settles credit exposure
3. Operator transfers RGB from inventory
4. User receives actual RGB asset
Key Principles
- ā No Token Minting: Uses actual RGB assets, not synthetics
- ā 1:1 Backing: Every XRPL IOU backed by real RGB in operator inventory
- ā Swap, Not Lock/Mint: Bridge operator is market maker, not custodian
- ā Trustlines: Provide credit buffer for timing mismatches
- ā Auditable: Anyone can verify reserves
Bridge Security
- Liquidity Pools: Operator maintains RGB inventory on Bitcoin/Lightning
- Trustlines: Credit-based buffer for instant bridging
- Proof of Reserves: Verifiable 1:1 backing
- Market Making: Natural economic incentives
š Full Architecture: See for complete details
š Example Workflows
Complete RGB Asset Lifecycle
// 1. Issue RGB asset
Issue asset "MyToken" (MTK) with 1M supply
// 2. Get asset info
Get info for asset abc123
// 3. Transfer to user
Transfer 1000 MTK to user's blinded UTXO
// 4. Check balance
Get balance for asset abc123
Trustlines Workflow
// 1. Create trustline between Alice & Bob
Create trustline for asset abc123 between Alice and Bob with 10,000 limit each
// 2. Alice sends credit to Bob (instant, off-chain)
Transfer 500 credit from Alice to Bob via trustline
// 3. Bob settles debt with RGB asset
Settle 500 from Bob to Alice via trustline xyz
// 4. Check trustline status
Get trustline info for xyz
Bridge Workflow
// 1. Create XRPL account
Create XRPL account with testnet funding
// 2. Set trust line for bridged asset
Set XRPL trustline for currency "RGB" from issuer rXXX with limit 100000
// 3. Bridge RGB to XRPL
Bridge 100 RGB from Alice's address to rXRPL_Address
// 4. Check bridge status
Get bridge status for operation op123
// 5. Bridge back to RGB
Bridge 50 RGB IOU from rXRPL_Address back to Alice
š Security Considerations
RGB Security
- Client-side validation ensures trustless operation
- Bitcoin blockchain provides final settlement
- Blinded UTXOs provide privacy
Trustlines Security
- Credit limits prevent unlimited exposure
- Frozen state for dispute resolution
- On-chain settlement available anytime
Payment Channels Security
- Cryptographic signatures prevent cheating
- Dispute period allows challenge
- Final state committed on-chain
Bridge Security
- ā ļø TESTNET ONLY: Not production-ready
- Requires professional audit before mainnet
- Multi-sig vault (planned)
- Proof verification system (planned)
š Development
Project Structure
RGB-MCP-SERVERv1/
āāā src/
ā āāā server.ts # Main MCP server
ā āāā config.ts # Configuration
ā āāā services/ # Core services
ā ā āāā RGBService.ts
ā ā āāā TrustlinesService.ts
ā ā āāā PaychanService.ts
ā ā āāā BridgeService.ts
ā ā āāā XRPLService.ts
ā āāā tools/ # MCP tools
ā ā āāā rgb/
ā ā āāā trustlines/
ā ā āāā paychan/
ā ā āāā bridge/
ā ā āāā xrpl/
ā āāā utils/ # Utilities
āāā contracts/ # Smart contracts
āāā integration_guides/ # Integration docs
āāā scripts/ # Helper scripts
Building
# Clean build
npm run clean
npm run build
# Development with auto-reload
npm run watch
# Start server
npm start
# Development mode
npm run dev
Testing
# Test RGB service
Issue test asset
# Test trustlines
Create test trustline
# Test bridge (testnet only)
Bridge test asset to XRPL testnet
š Resources
š¤ Contributing
Contributions are welcome! Please:
- Fork the repository
- Create feature branch (
git checkout -b feature/amazing-feature
) - Commit changes (
git commit -m 'Add amazing feature'
) - Push to branch (
git push origin feature/amazing-feature
) - Open Pull Request
š License
This project is licensed under the Apache-2.0 License - see the LICENSE file for details.
š Acknowledgments
- RGB Protocol team for the RGB smart contract system
- Ripple for the XRPL ledger
- Anthropic for the Model Context Protocol
- Stacks community for trustlines protocol inspiration
ā ļø Disclaimer
This software is provided "as is" without warranty. The bridge functionality is experimental and NOT audited. DO NOT USE ON MAINNET UNTIL AUDIT IS COMPLETE. Only use on testnet for development and testing.
Built by Quigles1337 | 2025
Repository: https://github.com/Quigles1337/RGB-MCP-SERVERv1