XRPL Agent Wallet MCP

XRPL Agent Wallet MCP

Provides secure, policy-controlled wallet infrastructure for AI agents to autonomously manage XRP Ledger wallets and sign transactions. It features a tiered security model with encrypted key storage, a declarative policy engine, and full audit trails for compliance.

Category
访问服务器

README

XRPL Agent Wallet MCP

Build Status Coverage npm version License: MIT Node.js TypeScript

Secure, policy-controlled wallet infrastructure for AI agents operating on the XRP Ledger.

This MCP (Model Context Protocol) server enables AI agents to autonomously manage XRPL wallets and sign transactions within configurable policy boundaries. It implements a tiered security model where low-risk operations execute immediately while high-value transactions require human oversight.

Project Status: ✅ Phase 1 Implementation Complete - All core modules implemented and tested (222 tests passing) Security Status: ✅ Security Review Complete - 19 issues identified and remediated (see ADR-011) Integration Status: ✅ Escrow MCP Integration - Timing-aware parameters and escrow tracking (see ADR-012)

The Problem

AI agents need to transact on XRPL, but current approaches are insecure:

  • Raw seeds stored in environment variables
  • No policy enforcement on agent-initiated transactions
  • No human oversight for high-value operations
  • No audit trail for compliance

The Solution

A security-first MCP server that provides:

  • Encrypted key storage - Keys never exposed in plaintext
  • Policy engine - Declarative rules control what agents can do
  • Tiered approval - Human oversight scales with transaction risk
  • Full audit trail - Tamper-evident logging for compliance

Architecture Overview

┌─────────────────────────────────────────────────────────────────────┐
│                     XRPL Agent Wallet MCP Server                     │
├─────────────────────────────────────────────────────────────────────┤
│  ┌──────────────────┐  ┌──────────────────┐  ┌──────────────────┐  │
│  │ Input Validation │  │  Policy Engine   │  │ Signing Service  │  │
│  │   (Zod schemas)  │─▶│  (Tier routing)  │─▶│  (AES-256-GCM)   │  │
│  └──────────────────┘  └──────────────────┘  └──────────────────┘  │
│                              │                        │             │
│                              ▼                        ▼             │
│  ┌──────────────────┐  ┌──────────────────┐  ┌──────────────────┐  │
│  │   Rate Limiter   │  │  Audit Logger    │  │   XRPL Client    │  │
│  │  (Token bucket)  │  │  (Hash chains)   │  │    (xrpl.js)     │  │
│  └──────────────────┘  └──────────────────┘  └──────────────────┘  │
├─────────────────────────────────────────────────────────────────────┤
│                         11 MCP Tools                                 │
│  wallet_create │ wallet_sign │ wallet_balance │ wallet_policy_check │
│  wallet_rotate │ wallet_list │ wallet_history │ wallet_fund         │
│  policy_set    │ tx_submit   │ tx_decode                            │
└─────────────────────────────────────────────────────────────────────┘

Key Features

Security-First Design

Layer Protection
Transport TLS 1.3 for XRPL connections
Input Zod schema validation, injection detection
Authentication Argon2id (64MB), progressive lockout
Authorization Tool sensitivity levels, rate limiting
Policy Immutable rules engine, tier classification
Cryptographic AES-256-GCM, SecureBuffer memory handling
XRPL Native Regular Keys, Multi-Sign, network isolation
Audit HMAC-SHA256 hash-chained logs

Tiered Approval Model

Tier Criteria Agent Action Human Action
Autonomous < 100 XRP, known destination Sign immediately None
Delayed 100-1000 XRP Sign after 5-min delay Can veto
Co-Sign > 1000 XRP, new destination Request approval Must approve
Prohibited Policy violation, blocklist Reject N/A

Companion to xrpl-escrow-mcp

This wallet MCP is designed as the signing layer for xrpl-escrow-mcp:

xrpl-escrow-mcp              xrpl-wallet-mcp              XRPL Network
(builds unsigned TX)    →    (signs with policy)     →    (validates)

But it's not limited to escrow - it supports all 32 XRPL transaction types.

Quick Start

1. Install

npm install -g xrpl-agent-wallet-mcp

2. Configure Claude Desktop

Add to claude_desktop_config.json:

{
  "mcpServers": {
    "xrpl-wallet": {
      "command": "xrpl-agent-wallet-mcp",
      "env": {
        "XRPL_NETWORK": "testnet",
        "XRPL_WALLET_PASSWORD": "your-secure-password"
      }
    }
  }
}

3. Create Your First Wallet

Ask Claude: "Create a new XRPL wallet on testnet for my AI agent"

MCP Tools

Tool Purpose Sensitivity
wallet_create Create new wallet with policy HIGH
wallet_sign Sign transaction (policy-controlled) CRITICAL
wallet_balance Query balance and reserves LOW
wallet_policy_check Dry-run policy evaluation LOW
wallet_rotate Rotate regular key DESTRUCTIVE
wallet_list List managed wallets LOW
wallet_history Query transaction history LOW
wallet_fund Fund wallet from testnet/devnet faucet HIGH
policy_set Update policy configuration CRITICAL
tx_submit Submit signed transaction HIGH
tx_decode Decode transaction blob LOW

Configuration

Environment Variables

Variable Required Default Description
XRPL_NETWORK Yes - mainnet, testnet, or devnet
XRPL_WALLET_PASSWORD Yes - Master encryption password
XRPL_WALLET_KEYSTORE_PATH No ~/.xrpl-wallet-mcp Keystore location
XRPL_WALLET_POLICY No Built-in Path to policy JSON
LOG_LEVEL No info debug, info, warn, error

Policy Configuration

Policies are JSON files controlling agent behavior:

{
  "version": "1.0.0",
  "name": "conservative",
  "network": "testnet",
  "tiers": {
    "autonomous": { "max_amount_drops": "100000000" },
    "delayed": { "max_amount_drops": "1000000000", "delay_seconds": 300 },
    "cosign": { "quorum": 2 }
  },
  "limits": {
    "daily_volume_drops": "1000000000",
    "max_tx_per_hour": 10
  },
  "destinations": {
    "mode": "allowlist",
    "addresses": ["rKnownExchange...", "rTrustedPartner..."]
  },
  "blocklist": {
    "addresses": [],
    "memo_patterns": ["ignore previous", "system prompt"]
  }
}

Security Model

XRPL Native Security

  • Regular Keys: Agent signs with rotatable key; master key stays cold
  • Multi-Sign: Tier 3 transactions require human co-signature (2-of-N)
  • Network Isolation: Separate keystores per network prevent accidents

Key Protection

User Password
     │
     ▼ Argon2id (64MB, 3 iterations)
Master Key
     │
     ▼ AES-256-GCM
Encrypted Wallet Keys
     │
     ▼ File (0600 permissions)
~/.xrpl-wallet-mcp/{network}/wallets/

Prompt Injection Defense

The policy engine includes defenses against prompt injection:

  • Memo field pattern matching blocks common attack vectors
  • Policy rules are immutable at runtime (agent cannot self-modify)
  • Context field sanitized before audit logging

Escrow Integration (v0.2.0)

Enhanced support for working with xrpl-escrow-mcp and other MCP servers:

Enhancement Tool Description
Timing-Aware Funding wallet_fund wait_for_confirmation parameter with retry logic (15 attempts, 2s intervals)
Balance Propagation wallet_balance wait_after_tx parameter (0-30000ms) ensures accurate balance after transactions
Escrow Tracking tx_submit Returns tx_type, sequence_used, and escrow_reference for complete escrow lifecycle
Ledger Consistency All tools ledger_index in responses enables consistency verification

Important: Testnet/devnet faucets now provide ~100 XRP (previously 1000 XRP). Use initial_balance_drops from wallet_fund response instead of hardcoding amounts.

See Network Timing Reference for detailed timing considerations.

Sequence Race Condition Fix (v0.2.1)

Resolved tefPAST_SEQ errors in rapid multi-transaction workflows (escrow create → finish):

Component Fix Description
SequenceTracker New class Tracks signed sequences per address with 60-second TTL
wallet_sign auto_sequence Uses MAX(ledger_sequence, last_signed + 1) to prevent stale sequences
tx_submit next_sequence Returns next sequence to use, tracks after successful submission
Debug Logging Built-in Sequence calculations logged for troubleshooting

Key principle: Never rely solely on ledger queries for sequence after submitting a transaction. The ledger may return stale data before the ledger closes (~3-5 seconds on testnet).

See ADR-013: Sequence Autofill for technical details.

Security Hardening (v0.1.1)

Following a comprehensive security review, the following hardening measures were implemented:

Area Improvement
Environment Required XRPL_WALLET_PASSWORD - fail-fast on missing config
Key Storage Consistent seed format (UTF-8) prevents cryptographic failures
Multi-Sign Cryptographic signature verification using ripple-keypairs
Audit Logs Fixed hash chain integrity for tamper detection
Key Rotation Regular keys now persisted and preferred over master key
Rate Limiting Lockout state persists across server restarts
ReDoS Pattern analysis prevents regex denial-of-service
Production Stack traces and logs sanitized for production deployment

See ADR-011 for complete details.

Documentation

Architecture (Arc42)

Security

API Reference

User Guides (Diataxis)

Development

Prerequisites

  • Node.js 22+
  • npm 10+

Setup

git clone https://github.com/9RESE/xrpl-agent-wallet-mcp.git
cd xrpl-agent-wallet-mcp
npm install
npm run build

Testing

npm test                    # Watch mode
npm run test:run           # Single run
npm run test:coverage      # Coverage report (90% target)
npm run test:security      # Security tests

Test Coverage Requirements

Module Target
src/keystore/ 95%
src/policy/ 95%
src/signing/ 95%
src/validators/ 95%
Overall 90%

Roadmap

Phase Scope Status
1 (MVP) Local keystore, policy engine, 11 MCP tools Complete
2 Cloud KMS (AWS/GCP), HSM integration Planned
3 TEE deployment (AWS Nitro), KYA identity Future

Contributing

See CONTRIBUTING.md for guidelines.

Security vulnerabilities: See SECURITY.md - do NOT open public issues.

License

MIT License - see LICENSE

Acknowledgments

Project Maintainers

This project is created and maintained by 9 RESE' LLC.

Community Support

Special thanks to the $POSSE XRPL community project for their support in initiating and maintaining this open source wallet infrastructure for AI agents on the XRP Ledger.

Built With


Contact

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选