Skip to main content
Glama
mcp-server-justlend

mcp-server-justlend

Official
by justlend

mcp-server-justlend

License: MIT TRON Network TypeScript MCP JustLend npm

A Model Context Protocol (MCP) server that enables AI agents to interact with the JustLend DAO lending protocol on TRON. Supply assets, borrow against collateral, manage positions, participate in V2 (Moolah) isolated markets and vaults, and analyze DeFi portfolios β€” all through a unified AI interface.

Beyond JustLend-specific operations, the server also exposes a full set of general-purpose TRON chain utilities β€” balance queries, block/transaction data, token metadata, TRX transfers, smart contract reads/writes, staking (Stake 2.0), multicall, and more.

Overview

JustLend DAO is the largest lending protocol on TRON. This MCP server wraps the full protocol functionality into tools and guided prompts that local MCP clients such as Claude Desktop, Codex, Claude Code, and Cursor can use.

πŸ“Œ Current Version: v1.1.3 β€” JustLend V1 + V2 (Moolah), plus TRX↔WTRX wrap/unwrap

  • JustLend V1 (Compound V2 fork): the original pool-based protocol β€” jUSDT, jTRX, jUSDD, jSUN, jWBTC, etc. Full supply / borrow / repay / withdraw / collateral management and mining rewards.

  • JustLend V2 (Moolah) (Morpho Blue fork): isolated markets with MarketParams (loanToken, collateralToken, oracle, irm, lltv) and ERC4626 vaults that auto-allocate across markets. Full vault deposit / redeem, collateral supply / borrow / repay / liquidate, and public liquidations.

Key Capabilities

JustLend V1 (pool-based, Compound V2 fork)

  • Market Data: Real-time APYs, TVL, utilization rates, prices for all markets

    • Smart fallback: contract queries first, API fallback for reliability

    • TTL caching (30–60s) to reduce RPC calls

  • Account Data: Full position analysis via Multicall3 batch queries (~2.5s vs ~8s legacy)

    • Health factor, collateral, borrow positions

    • On-chain Oracle prices with API fallback

  • Batch Wallet Balances: Query all TRC20 token balances in a single Multicall3 RPC call

  • Mining Rewards: Advanced mining reward calculation (based on justlend-app logic)

    • Detailed breakdown by market and reward token (USDD, TRX, WBTC, etc.)

    • USD value calculation with live token prices

  • Supply / Borrow / Repay / Withdraw: Full lending operations with pre-flight checks

  • Collateral Management: Enter/exit markets, manage what counts as collateral

  • Portfolio Analysis: AI-guided risk assessment, health factor monitoring, optimization

  • JST Voting / Governance: View proposals, cast votes, deposit/withdraw JST for voting power, reclaim votes

  • Energy Rental + Direct Purchase: Rent energy on-chain, or query/quote/buy energy through the separately configured direct-purchase service

  • sTRX Staking: Stake TRX to receive sTRX, unstake sTRX, claim staking rewards, check withdrawal eligibility

    • Precision-safe BigInt/string math for TRX Sun conversion and 18-decimal sTRX balances/exchange-rate display

JustLend V2 β€” Moolah (New in v1.1.0)

  • ERC4626 Vaults (TRX / USDT / USDD on mainnet; TRX + USDT on nile): auto-compounding yield with a curator that allocates deposits across isolated markets. Deposit / withdraw (by asset amount or max) / redeem (by shares) with TRC20 approvals handled as a separate tool so LLMs can reason about each step.

  • Isolated Markets: each market is a (loanToken, collateralToken, oracle, irm, lltv) tuple. Supply collateral β†’ borrow β†’ repay β†’ withdraw collateral, plus a composite moolah_borrow that handles collateral+borrow as two sequential txs. TRX routes through the TrxProviderProxy contract; TRC20 goes through MoolahProxy directly.

  • Public Liquidations: list undercollateralized positions (risk > 1.0), quote loan-token requirement for a target seize, execute liquidation. Includes an explicit approve_liquidator_token step.

  • Dashboard + History: aggregated user position, APY / TVL time-series for vaults and markets, paginated V2 transaction records.

  • Gas estimation: estimate_moolah_energy returns typical historical energy / bandwidth / TRX cost for every V2 write op.

Historical records (New in v1.1.0)

  • Paginated REST wrappers for V1 lending / sTRX / voting / energy-rental / liquidation history, plus V2 Moolah records. Each endpoint's numeric action/op codes are enriched with human-readable names (actionName / opName) client-side so MCP tools are self-describing.

Browser Wallet Signing

  • Disabled by default: the legacy tronlink-signer loopback bridge lacks request-level authentication

  • Safe current mode: use agent-wallet with AGENT_WALLET_PASSWORD; browser signing will return only after an authenticated bridge is available

General TRON Chain

  • Balances: TRX balance (with Sun/TRX conversion), TRC20/TRC1155 token balances

  • Blocks: Latest block, block by number/hash, block number, chain ID

  • Transactions: Fetch transaction details, receipts, wait for confirmation

  • Contracts: Read/write any contract, fetch on-chain ABI, multicall (v2 & v3), deploy, estimate energy

  • Token Metadata: TRC20 info (name/symbol/decimals/supply), TRC721 metadata, TRC1155 URI

  • Transfers: Send TRX, transfer TRC20 tokens, approve spenders

    • Transfer/approval paths validate recipient, token, and spender TRON addresses before signing

  • Staking (Stake 2.0): Freeze/unfreeze TRX for BANDWIDTH or ENERGY, withdraw expired unfreeze

  • Address Utilities: Hex ↔ Base58 conversion, address validation, resolution

  • Wallet: Sign messages and transactions through agent-wallet; the unauthenticated browser bridge is disabled

Related MCP server: mcp-server-tron

Supported Markets

JustLend V1 (pool-based)

The protocol currently exposes 18 active + 6 legacy = 24 markets. This roster was cross-checked against the expanded JustLend app market table and live /lend/jtoken API on 2026-08-19. Call get_supported_markets for the live list with addresses; the active markets are:

jToken

Underlying

Description

jTRX

TRX

Native TRON token

jUSDT

USDT

Tether USD

jUSDD

USDD

Decentralized USD (USDD/TRX supply‑mining rewards)

jUSD1

USD1

World Liberty Financial USD

jTUSD

TUSD

TrueUSD

jwstUSDT

wstUSDT

Wrapped staked USDT (yields underlying staking APY)

jsTRX

sTRX

Staked TRX (yields underlying staking APY)

jBTC

BTC

Bitcoin (wrapped)

jWBTC

WBTC

Wrapped Bitcoin

jETH

ETH

Ethereum β€” dApp UI displays as "ETH" (formerly "ETHOLD")

jETHB

ETHB

Bridged Ethereum β€” dApp UI displays as "ETHB" (formerly "ETH")

jSUN

SUN

SUN token

jJST

JST

JUST governance token

jWIN

WIN

WINkLink

jBTT

BTT

BitTorrent token

jNFT

NFT

APENFT

jHTX

HTX

HTX token

jU

U

U token

Paused / legacy markets (closed to new supply/borrow, queryable for read & to unwind positions): jUSDCOLD, jUSDD_OLD, jBUSDOLD, jSUNOLD, jUSDJ, jWBTT.

JustLend V2 (Moolah) β€” vaults

Vault

Underlying

Mainnet

Nile

TRX

native TRX

βœ…

βœ…

USDT

TRC20 USDT

βœ…

βœ… (different underlying address from mainnet)

USDD

TRC20 USDD

βœ…

❌ (not deployed on nile)

Markets are not enumerated here because they are created dynamically on-chain; use get_moolah_markets to list them at runtime (each market returns a marketId / id plus loanSymbol / collateralSymbol / lltv / rates).

Prerequisites

Recommended development and CI baseline: Node.js 24.22.3, pinned in .nvmrc.

Installation

git clone https://github.com/justlend/mcp-server-justlend.git
cd mcp-server-justlend
npm install

Quick Setup

For a guided setup experience (build, configure, generate .mcp.json, print Codex setup command):

bash scripts/setup-mcp-test.sh
# Add --claude-desktop to also print Claude Desktop JSON

The script checks the recommended Node.js version (24.22.3), installs dependencies, builds the project, generates local Claude Code config, and prints the local Codex registration command.

Configuration

Wallet Setup (First-Use Choice)

On first use, select agent mode via set_wallet_mode with mode="agent". Browser mode is disabled until its local bridge supports request-level authentication.

The encrypted wallet is stored in ~/.agent-wallet/. Configure AGENT_WALLET_PASSWORD so its encryption password is not persisted beside the wallet data.

You can also manage wallets via CLI or MCP tools:

CLI (agent-wallet)

# Import an existing private key or mnemonic
npx agent-wallet add

# Generate a new wallet
npx agent-wallet generate

# List all wallets
npx agent-wallet list

# Switch active wallet
npx agent-wallet activate <wallet-id>

MCP Tools (runtime)

Tool

Description

get_wallet_address

Shows current address, or returns first-use wallet selection guidance

connect_browser_wallet

Returns a safety notice while the unauthenticated browser bridge is disabled

set_wallet_mode

Select supported agent signing (browser currently returns an error)

get_wallet_mode

Show current signing mode and addresses

list_wallets

List all wallets with IDs, types, addresses

set_active_wallet

Switch active wallet by ID

Importing an existing private key is intentionally not exposed as an MCP tool because MCP arguments can be logged by clients and transports. Use the CLI instead:

npx agent-wallet import
# (Optional) For automated/CI setups, set the wallet password
export AGENT_WALLET_PASSWORD="your_wallet_password"

# Strongly recommended β€” avoids TronGrid 429 rate limiting on mainnet
export TRONGRID_API_KEY="your_trongrid_api_key"

Energy direct-purchase API

Direct purchase uses the official production endpoint from the app release by default: https://tegrow.ablesdxd.link. Limits, durations, prices, payment address, and pool capacity are still loaded live; no economic values are hard-coded. Set JUSTLEND_ENERGY_API_URL only to override the production service. Custom/test endpoints require an explicit trust opt-in:

export JUSTLEND_ENERGY_API_URL="https://energy-api.example" # optional override
export JUSTLEND_ALLOW_UNTRUSTED_HOSTS=1 # temporary/custom endpoints only

Recommended tool sequence:

  1. get_energy_purchase_config β€” load live limits, durations, prices, and pool capacity.

  2. quote_energy_purchase β€” obtain an authoritative read-only quote.

  3. Show the exact payer, receivers, duration, and TRX amount to the user.

  4. buy_energy_direct β€” set confirmPayment=true only after explicit user confirmation.

  5. get_energy_purchase_order β€” track a token-bearing result.

  6. get_energy_purchase_history β€” recover accepted/in-progress orders by payer when a retry has no token.

  7. get_energy_payment_risk β€” reconcile any remaining ambiguous payment before signing again.

The server signs the native TRX payment but never broadcasts it locally. The configured backend validates and may broadcast the signed transaction. Ambiguous submissions retry only the same signed transaction. For ambiguous submissions, the exact signed request (including the signature and raw transaction) is stored locally with 0600 permissions under ~/.mcp-server-justlend/energy-payment-risks.json. It remains broadcastable until transaction expiry, is redacted from MCP output, and is removed only after public purchase history confirms the payment/order or the backend deterministically rejects it before broadcast. Use get_energy_payment_risk before any new payment when a previous result is uncertain. Risk reconciliation reports chainStatus as observed/included from FullNode first and solidified only after SolidityNode finality; RPC errors or a missing transaction never authorize a newly signed payment.

Client Configuration

Build the local server first:

npm run build

All local client examples below use the built stdio entrypoint:

node /absolute/path/to/mcp-server-justlend/build/index.js

Claude Desktop

Add to ~/Library/Application Support/Claude/claude_desktop_config.json:

{
  "mcpServers": {
    "justlend": {
      "command": "node",
      "args": ["/absolute/path/to/mcp-server-justlend/build/index.js"],
      "env": {
        "TRONGRID_API_KEY": "SET_VIA_SYSTEM_ENV"
      }
    }
  }
}

Codex

Recommended: register the local stdio server with codex mcp add:

codex mcp add justlend --env TRONGRID_API_KEY=your_trongrid_api_key -- \
  node /absolute/path/to/mcp-server-justlend/build/index.js

If you do not want to set a TronGrid key yet, omit the --env flag:

codex mcp add justlend -- node /absolute/path/to/mcp-server-justlend/build/index.js

Useful maintenance commands:

codex mcp list
codex mcp get justlend
codex mcp remove justlend

Claude Code

Add to .mcp.json in the project root:

{
  "mcpServers": {
    "justlend": {
      "command": "node",
      "args": ["/absolute/path/to/mcp-server-justlend/build/index.js"],
      "env": {
        "TRONGRID_API_KEY": "SET_VIA_SYSTEM_ENV"
      }
    }
  }
}

Cursor

Add to .cursor/mcp.json:

{
  "mcpServers": {
    "justlend": {
      "command": "node",
      "args": ["/absolute/path/to/mcp-server-justlend/build/index.js"],
      "env": {
        "TRONGRID_API_KEY": "SET_VIA_SYSTEM_ENV"
      }
    }
  }
}

Usage

The server supports two transport modes. Both share the same Tools, Resources, and wallet initialization β€” the difference is how clients connect.

Stdio Mode (Local AI Clients)

npm start

The server communicates via stdin/stdout. This is the standard mode for local MCP clients like Claude Desktop, Codex, Claude Code, and Cursor, which launch the server as a child process.

HTTP/SSE Mode (Remote / Multi-Client)

MCP_API_KEY=my-secret-key npm run start:http

The server starts an Express HTTP service with Server-Sent Events (SSE) transport. Suitable for web applications, remote clients, or scenarios where multiple clients need to connect concurrently.

HTTP mode is fail-closed: MCP_API_KEY is required, the server binds to 127.0.0.1 by default, and CORS is disabled unless you explicitly set MCP_CORS_ORIGIN.

Endpoint

Method

Description

/sse

GET

SSE connection endpoint β€” returns a sessionId

/messages?sessionId=xxx

POST

Send MCP messages for a session

/health

GET

Health check (no auth required)

Environment variables:

Variable

Default

Description

PORT

3001

HTTP listen port

MCP_HOST

127.0.0.1

HTTP listen host. Keep the default unless you intentionally want remote exposure.

MCP_API_KEY

(required)

Bearer token for authentication. HTTP mode refuses to start without it.

MCP_CORS_ORIGIN

(disabled)

Allowed CORS origin. If unset, no CORS headers are sent.

MCP_MAX_SESSIONS

100

Maximum concurrent SSE sessions

MCP_SESSION_TIMEOUT_MS

1800000

Session idle timeout in ms (default: 30 min)

Example with authentication:

MCP_API_KEY=my-secret-key PORT=8080 npm run start:http
# Connect from client
curl -H "Authorization: Bearer my-secret-key" http://localhost:8080/sse

Development

npm run dev          # Stdio with auto-reload
npm run dev:http     # HTTP/SSE with auto-reload

API Reference

Machine-readable tool catalog for AI agents: mcp-api-list.md β€” a complete, offline-loadable list of every tool with its input schema (parameter / type / required / default), common output schema, MCP side-effect annotations (read-only vs. on-chain write / destructive) and HITL guidance. It is generated from source (npm run gen:api-list, see scripts/gen-mcp-api-list.ts) so it never drifts from the actual tool definitions. Agents can load it to plan tool routing without connecting to the server.

Structured output contract

All 104 tools declare an MCP outputSchema. Successful calls preserve the existing text content for older clients and also return a versioned envelope in structuredContent:

{
  "schemaVersion": "1.0.0",
  "tool": "get_supported_markets",
  "result": {}
}

Schema-aware clients should consume structuredContent; consumers should pin the schema major. Tool-specific payloads live under result. Error calls preserve isError: true and the existing JSON error body with errorCode, retryable, and hint when classified.

Tools (104 total)

The full, authoritative per-tool catalog β€” every tool's input and output schema, side-effect class (read-only / on-chain write / destructive) and HITL guidance β€” lives in mcp-api-list.md, generated from source (npm run gen:api-list) so it never drifts. Counts by category:

Category

Tools

Covers

Wallet & Network

10

wallet selection, signing mode (browser/agent), active wallet, network

Market Data

13

per-market & protocol APY/TVL/rates (contract query + API fallback)

Lending Operations

10

supply / borrow / repay / withdraw / collateral / approve (V1 jTokens)

JST Voting / Governance

10

proposals, vote status, WJST approve / vote / withdraw

Energy

15

rental dashboard and writes; direct-purchase config, quote, history, order/risk, confirmed buy

sTRX Staking

7

sTRX dashboard & account, stake / unstake / claim / withdraw

WTRX Wrap / Unwrap

2

wrap_trx (TRX→WTRX 1:1) / unwrap_trx (WTRX→TRX 1:1)

JustLend V2 (Moolah) β€” Vaults

6

ERC4626 vault read + deposit / withdraw / redeem / approve

JustLend V2 (Moolah) β€” Markets

8

isolated markets: supply-collateral / borrow / repay / approve

JustLend V2 (Moolah) β€” Liquidation

5

pending liquidations, quote, liquidate, approve

JustLend V2 (Moolah) β€” Dashboard & History

6

portfolio, positions, dashboard & history

JustLend V2 (Moolah) β€” Mining, Rewards & Estimator

5

mining APY / accrual, claim, gas estimate

Historical Records (V1 + airdrop) β€” mainnet-only

7

transaction / vote / reward history, claimable airdrops

Every write / destructive tool is marked destructiveHint: true and must be gated behind host-side human confirmation (HITL); see mcp-api-list.md for the exact per-tool side-effect class.

Architecture

mcp-server-justlend/
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ core/
β”‚   β”‚   β”œβ”€β”€ chains.ts          # Network configs + V1 jTokens + V2 Moolah addresses (mainnet + nile)
β”‚   β”‚   β”œβ”€β”€ abis.ts            # jToken, Comptroller, Oracle, TRC20 + 4 Moolah ABIs
β”‚   β”‚   β”œβ”€β”€ tools/             # MCP tool registrations (104 tools)
β”‚   β”‚   β”‚   β”œβ”€β”€ index.ts                      # Barrel: registers all 13 tool modules with structured outputs
β”‚   β”‚   β”‚   β”œβ”€β”€ wallet-tools.ts               # Wallet, network, transfer
β”‚   β”‚   β”‚   β”œβ”€β”€ market-tools.ts               # V1 market data, balance, mining
β”‚   β”‚   β”‚   β”œβ”€β”€ lending-tools.ts              # V1 supply / borrow / repay / collateral / approve / estimate
β”‚   β”‚   β”‚   β”œβ”€β”€ voting-tools.ts               # V1 governance proposals & voting
β”‚   β”‚   β”‚   β”œβ”€β”€ energy-tools.ts               # Energy rental + direct purchase
β”‚   β”‚   β”‚   β”œβ”€β”€ staking-tools.ts              # sTRX staking
β”‚   β”‚   β”‚   β”œβ”€β”€ wtrx-tools.ts                 # TRX ↔ WTRX
β”‚   β”‚   β”‚   β”œβ”€β”€ moolah-vault-tools.ts         # V2 vault (6 tools)
β”‚   β”‚   β”‚   β”œβ”€β”€ moolah-market-tools.ts        # V2 market (8 tools)
β”‚   β”‚   β”‚   β”œβ”€β”€ moolah-liquidation-tools.ts   # V2 liquidation (5 tools)
β”‚   β”‚   β”‚   β”œβ”€β”€ moolah-dashboard-tools.ts     # V2 dashboard + history + estimator (6 tools)
β”‚   β”‚   β”‚   β”œβ”€β”€ moolah-mining-tools.ts        # V2 mining / rewards (5 tools)
β”‚   β”‚   β”‚   β”œβ”€β”€ records-tools.ts              # V1 + airdrop records (7 tools, mainnet-only)
β”‚   β”‚   β”‚   β”œβ”€β”€ structured-output.ts          # Common MCP outputSchema + structuredContent
β”‚   β”‚   β”‚   └── shared.ts                     # Shared helpers
β”‚   β”‚   β”œβ”€β”€ prompts.ts         # AI-guided workflow prompts (14: 10 V1-era + 4 V2 Moolah)
β”‚   β”‚   β”œβ”€β”€ resources.ts       # Static protocol info resource
β”‚   β”‚   β”œβ”€β”€ browser-signer.ts  # fail-closed compatibility shim; legacy bridge disabled
β”‚   β”‚   └── services/
β”‚   β”‚       β”œβ”€β”€ # β€” Global + utilities β€”
β”‚   β”‚       β”œβ”€β”€ global.ts     # Global state: network, wallet mode
β”‚   β”‚       β”œβ”€β”€ clients.ts    # TronWeb client factory (cached)
β”‚   β”‚       β”œβ”€β”€ wallet.ts     # Wallet routing: browser / agent-wallet signing
β”‚   β”‚       β”œβ”€β”€ cache.ts      # TTL cache layer (30–60s) for prices, markets, sTRX
β”‚   β”‚       β”œβ”€β”€ http.ts       # fetchWithTimeout
β”‚   β”‚       β”œβ”€β”€ utils.ts      # toSun/fromSun, formatJson, hexToNumber, isAddress, …
β”‚   β”‚       β”œβ”€β”€ bigint-math.ts# BigInt helpers: divRound, formatPercentRatio, USD cent math
β”‚   β”‚       β”œβ”€β”€ resource-prices.ts # Energy / bandwidth prices in sun
β”‚   β”‚       β”œβ”€β”€ # β€” JustLend V1 β€”
β”‚   β”‚       β”œβ”€β”€ price.ts      # On-chain Oracle prices with API fallback
β”‚   β”‚       β”œβ”€β”€ markets.ts    # APY, TVL, utilization β€” contract + API fallback
β”‚   β”‚       β”œβ”€β”€ account.ts    # User positions via Multicall3 batch queries
β”‚   β”‚       β”œβ”€β”€ lending.ts    # V1 supply / borrow / repay / withdraw / collateral / estimator
β”‚   β”‚       β”œβ”€β”€ rewards.ts    # Mining reward calculation (USDD, TRX, WBTC)
β”‚   β”‚       β”œβ”€β”€ voting.ts     # JST governance: proposals, cast vote, deposit/withdraw WJST
β”‚   β”‚       β”œβ”€β”€ energy-rental.ts # Energy rental: query, calculate, rent, return
β”‚   β”‚       β”œβ”€β”€ energy-purchase.ts # Explicit API client, sign-only payment, idempotent submit, risk recovery
β”‚   β”‚       β”œβ”€β”€ strx-staking.ts  # sTRX staking: stake, unstake, rewards, withdrawal check
β”‚   β”‚       β”œβ”€β”€ records.ts    # V1 + cross-cutting paginated REST history + airdrop scan
β”‚   β”‚       β”œβ”€β”€ # β€” JustLend V2 (Moolah) β€”
β”‚   β”‚       β”œβ”€β”€ moolah-backend.ts    # REST wrapper for zenvora.ablesdxd.link
β”‚   β”‚       β”œβ”€β”€ moolah-query.ts      # On-chain view reads (market state, vault totalAssets, health, etc.)
β”‚   β”‚       β”œβ”€β”€ moolah-vault.ts      # Vault write ops (deposit / withdraw / redeem / approve)
β”‚   β”‚       β”œβ”€β”€ moolah-market.ts     # Market write ops (supply collateral / borrow / repay / composite)
β”‚   β”‚       β”œβ”€β”€ moolah-liquidation.ts# liquidate + approveLiquidatorToken
β”‚   β”‚       β”œβ”€β”€ moolah-dashboard.ts  # Aggregated dashboard + history helpers
β”‚   β”‚       β”œβ”€β”€ moolah-estimate.ts   # Typical energy / bandwidth for all V2 write ops
β”‚   β”‚       β”œβ”€β”€ # β€” General TRON chain β€”
β”‚   β”‚       β”œβ”€β”€ address.ts     # Hex ↔ Base58 conversion, validation
β”‚   β”‚       β”œβ”€β”€ balance.ts     # TRX balance (rich), TRC20/TRC1155 balances
β”‚   β”‚       β”œβ”€β”€ blocks.ts      # Block queries, block number, chain ID
β”‚   β”‚       β”œβ”€β”€ transactions.ts# getTransaction, getTransactionInfo, waitForTransaction
β”‚   β”‚       β”œβ”€β”€ transfer.ts    # transferTRX, transferTRC20, approveTRC20
β”‚   β”‚       β”œβ”€β”€ tokens.ts      # TRC20/TRC721/TRC1155 metadata
β”‚   β”‚       β”œβ”€β”€ contracts.ts   # readContract, writeContract, multicall, estimateEnergy + callValueToSafeNumber
β”‚   β”‚       β”œβ”€β”€ multicall-abi.ts # Multicall2 & Multicall3 ABIs
β”‚   β”‚       └── staking.ts     # Stake 2.0: freeze, unfreeze, withdrawExpireUnfreeze
β”‚   β”œβ”€β”€ server/
β”‚   β”‚   β”œβ”€β”€ server.ts          # MCP server init
β”‚   β”‚   β”œβ”€β”€ http-server.ts     # Express HTTP/SSE transport (uses auth.ts for Bearer check)
β”‚   β”‚   └── auth.ts            # Constant-time Bearer-token comparison (crypto.timingSafeEqual)
β”‚   └── index.ts               # Stdio entry point
β”œβ”€β”€ bin/cli.js                 # CLI entry for npx
β”œβ”€β”€ scripts/
β”‚   └── setup-mcp-test.sh      # Quick setup: build + generate .mcp.json config
└── tests/
    └── core/
        β”œβ”€β”€ chains.test.ts
        └── services/
            β”œβ”€β”€ services.test.ts        # Client cache, legacy balance tests
            β”œβ”€β”€ address.test.ts         # Pure: address format conversion (16 tests)
            β”œβ”€β”€ utils.test.ts           # Pure: unit conversions, formatters (26 tests)
            β”œβ”€β”€ cache.test.ts           # Unit: TTL cache behavior
            β”œβ”€β”€ price.test.ts           # Unit: price service fallback logic
            β”œβ”€β”€ markets-fallback.test.ts # Unit: market data fallback chain
            β”œβ”€β”€ strx-fallback.test.ts   # Unit: sTRX dashboard fallback
            β”œβ”€β”€ account-multicall.test.ts # Unit: Multicall3 account queries
            β”œβ”€β”€ balance.test.ts         # Integration: TRX & TRC20 balances
            β”œβ”€β”€ blocks.test.ts          # Integration: block queries
            β”œβ”€β”€ contracts.test.ts       # Mixed: pure ABI helpers + integration reads
            β”œβ”€β”€ tokens.test.ts          # Integration: TRC20 token metadata
            β”œβ”€β”€ transactions.test.ts    # Integration: transaction fetch
            β”œβ”€β”€ transfer.test.ts        # Write: skipped by default (TEST_TRANSFER=1)
            β”œβ”€β”€ staking.test.ts         # Write: skipped by default (TEST_STAKING=1)
            β”œβ”€β”€ energy-rental.test.ts   # Integration: energy rental queries; Write: skipped (TEST_ENERGY_RENTAL=1)
            β”œβ”€β”€ strx-staking.test.ts    # Integration: sTRX queries; Write: skipped (TEST_STRX_STAKING=1)
            └── wallet.test.ts          # Unit: agent-wallet integration tests

Testing

# Run all tests (pure/unit tests always pass; integration tests need network)
npm test

# Run individual test files (recommended to avoid TronGrid rate limits)
npx vitest run tests/core/services/utils.test.ts
npx vitest run tests/core/services/address.test.ts
npx vitest run tests/core/services/balance.test.ts
npx vitest run tests/core/services/blocks.test.ts
npx vitest run tests/core/services/contracts.test.ts
npx vitest run tests/core/services/transactions.test.ts
npx vitest run tests/core/services/tokens.test.ts

# Energy rental & sTRX staking read tests
npx vitest run tests/core/services/energy-rental.test.ts
npx vitest run tests/core/services/strx-staking.test.ts

# Enable write/staking tests (uses real funds β€” use Nile testnet!)
# Requires agent-wallet to be configured: npx agent-wallet start
TEST_TRANSFER=1 npx vitest run tests/core/services/transfer.test.ts
TEST_STAKING=1 npx vitest run tests/core/services/staking.test.ts
TEST_ENERGY_RENTAL=1 npx vitest run tests/core/services/energy-rental.test.ts
TEST_STRX_STAKING=1 npx vitest run tests/core/services/strx-staking.test.ts

# Moolah V2 end-to-end write-path test on nile (vault deposit/withdraw +
# market supply-collateral/borrow/repay). Requires a funded nile wallet:
# see forTest/docs/v1.1.0/nile-write-path-runbook.md for the runbook.
TEST_MOOLAH_WRITE=1 npx vitest run tests/integration/moolah-writes.nile.test.ts

Rate limiting: Integration tests make real RPC calls to TronGrid. Without TRONGRID_API_KEY the free tier limits to a few requests per second. Run test files individually, or set TRONGRID_API_KEY to avoid 429 errors.

Troubleshooting

Symptom

Likely cause

Fix

MCP client doesn't list any tools (stdio)

Server not launched, or wrong command/path in client config

Verify the client command/args point to this server (npx @justlend/mcp-server-justlend or tsx src/index.ts). Check the client's MCP logs for a spawn error.

429 Too Many Requests / slow market reads on mainnet

TronGrid free-tier rate limit

Set TRONGRID_API_KEY (strongly recommended for mainnet). Avoid tight polling; use get_wallet_balances/get_all_markets batch tools instead of per-token loops.

HTTP/SSE returns 401 Unauthorized

Missing/wrong Authorization header in HTTP mode

HTTP mode is fail-closed: set MCP_API_KEY on the server and send Authorization: Bearer <key> from the client. /health is the only unauthenticated path.

Server refuses to start: MCP_API_KEY is required in HTTP mode

HTTP/SSE transport started without an API key

Set MCP_API_KEY (e.g. openssl rand -base64 32). stdio mode does not require it.

503 Too many active sessions (HTTP)

Concurrent SSE sessions exceed MCP_MAX_SESSIONS (default 100)

Close idle clients or raise MCP_MAX_SESSIONS. Stale sessions are swept every 60s.

Write tool errors with "no wallet" / wallet selection guide

No wallet mode chosen yet

Run npx agent-wallet start or select agent mode, and configure AGENT_WALLET_PASSWORD. Then retry.

Write tool fails with a pre-flight REVERT on mainnet

The transaction would revert on-chain (fail-closed by design)

Read the returned revert reason; fix the precondition (e.g. call approve_underlying before supply, enter_market before borrowing). The server does not broadcast simulated-revert txs on mainnet.

approval_required returned from supply/repay

TRC20 allowance below the amount

Call approve_underlying first (prefer an exact amount; max is opt-in and grants unlimited allowance).

Wrong network / unexpected addresses

Active network not set as intended

Check with get_network; switch with set_network (mainnet / nile). Nile is the testnet for safe write testing.

Amounts look off by 6–18 orders of magnitude

Double-applying token decimals

Balance/amount tool outputs are already human-readable (decimals applied) and carry decimals + _unit; do not divide again. See mcp-api-list.md for each tool's output units.

For deeper inspection, run the server under the MCP Inspector and watch stderr β€” startup diagnostics, auth failures, and schema errors are logged there (stdout is reserved for the MCP protocol frames in stdio mode).

Security Considerations

  • Private keys are managed by @bankofai/agent-wallet β€” never stored in environment variables or exposed via MCP tools

  • Wallet encryption: Keys are stored in ~/.agent-wallet/ with password-based encryption

  • Write operations are clearly marked with destructiveHint: true in MCP annotations

  • Transaction summaries before signing: contract write paths pass signer-facing summaries with network, contract, function, arguments, callValue, feeLimit, and simulation status

  • Address validation before signing: transfer and approval services reject invalid recipient/token/spender addresses before contract loading or wallet signing

  • Precision-safe value handling: sTRX staking uses string/BigInt parsing for TRX Sun conversion and 18-decimal sTRX display/estimates

  • Self-describing amounts: balance/amount fields return human-readable values with explicit _unit + decimals (and raw where applicable) so agents never re-apply decimals or misjudge magnitude. New tools should build amounts with describeAmount(raw, decimals, unit) from core/services/bigint-math.ts.

  • Health factor checks in prompts prevent dangerous borrowing

  • Always test on Nile testnet before mainnet operations

  • Be cautious with unlimited approvals (approve_underlying with max)

Example Conversations

"What are the best supply rates on JustLend right now?" β†’ AI calls get_all_markets, sorts by supplyAPY, presents ranking

"I want to supply 10,000 USDT to earn interest" β†’ AI uses supply_assets prompt: checks balance β†’ approves USDT β†’ supplies β†’ verifies

"Am I at risk of liquidation?" β†’ AI calls get_account_summary, analyzes health factor, warns if < 1.5

"Borrow 500 USDT against my TRX collateral" β†’ AI uses borrow_assets prompt: checks collateral β†’ calculates new health factor β†’ executes if safe

"What is the TRX balance of address TXxx...?" β†’ AI calls the general-purpose TRX balance tool, returns balance in both TRX and Sun

"Freeze 100 TRX for ENERGY" β†’ AI calls staking service to freeze via Stake 2.0, returns transaction hash

"Show me the latest governance proposals" β†’ AI calls get_proposal_list, displays proposals sorted by ID with status and vote counts

"I want to vote for proposal #425 with 1000 JST" β†’ AI checks get_vote_info β†’ if no votes, suggests approve_jst_for_voting + deposit_jst_for_votes β†’ then cast_vote

"Withdraw my votes from completed proposals" β†’ AI calls get_user_vote_status to find withdrawable proposals β†’ calls withdraw_votes_from_proposal for each

"How much does it cost to rent 300,000 energy for 7 days?" β†’ AI calls calculate_energy_rental_price with energyAmount=300000, durationHours=168, returns cost breakdown

"Rent 500,000 energy to address TXxx... for 14 days" β†’ AI uses rent_energy prompt: checks balance β†’ checks rental status β†’ calculates price β†’ rents energy β†’ verifies

"Cancel my energy rental to TXxx..." β†’ AI calls get_energy_rent_info to verify active rental β†’ calls return_energy_rental β†’ confirms refund

"Stake 1000 TRX to earn sTRX rewards" β†’ AI uses stake_trx prompt: checks balance β†’ checks exchange rate & APY β†’ stakes TRX β†’ verifies sTRX received

"Do I have any sTRX rewards to claim?" β†’ AI calls get_strx_account to check claimable rewards β†’ calls claim_strx_rewards if available

"Can I withdraw my unstaked TRX?" β†’ AI calls check_strx_withdrawal_eligibility to check unbonding status and completed withdrawal rounds

"Deposit 500 USDT into the JustLend V2 vault" (Moolah) β†’ AI uses moolah_supply prompt: lists vaults with APY β†’ selects USDT β†’ checks allowance β†’ calls approve_moolah_vault β†’ calls moolah_vault_deposit β†’ verifies shares via get_moolah_vault

"What's my risk on the TRXβ†’USDT market?" (Moolah) β†’ AI calls get_moolah_user_position for the market, interprets the risk ratio (0–1 where 1.0 = liquidatable), warns at >0.85

"Find me a liquidation opportunity" (Moolah) β†’ AI calls get_moolah_pending_liquidations with minRiskLevel=1.0 β†’ for a target, calls get_moolah_liquidation_quote β†’ estimates profit β†’ if viable, guides through approve_liquidator_token + moolah_liquidate

"How much did I supply to JustLend in the last month?" β†’ AI calls get_lending_records paginated and filters action type 1 (supply) from the returned actionName

Changelog

See CHANGELOG.md for the per-version history (Keep a Changelog format, SemVer).

License

MIT License Copyright (c) 2026 JustLend SPDX-License-Identifier: MIT

Available Tools

73 tools
approve_jst_for_votingA
Idempotent

Approve JST token for the WJST voting contract. Required before depositing JST to get voting power. Pass the EXACT amount you intend to deposit (recommended). Pass amount='max' for unlimited approval ONLY when the user explicitly opts in β€” it lets the WJST contract spend the user's entire JST balance, present and future, until revoked.

Inputs: amount (required), network.

approve_liquidator_tokenA
Idempotent

Approve loan token spending for the Moolah public liquidator contract. Required before calling moolah_liquidate. Pass the EXACT amount you intend to use (recommended). Pass amount='max' for unlimited approval ONLY when the user explicitly opts in β€” it lets the liquidator contract spend the user's entire balance, present and future, until revoked (amount='0').

Inputs: amount (required), tokenSymbol (required), tokenAddress (required), tokenDecimals (required), +1 more.

approve_moolah_proxyA
Idempotent

Approve TRC20 token spending for the Moolah core contract before supplying collateral or repaying. Not needed for TRX operations. Pass the EXACT amount you intend to use (recommended). Pass amount='max' for unlimited approval ONLY when the user explicitly opts in β€” it lets the Moolah proxy spend the user's entire balance, present and future, until revoked (amount='0').

Inputs: amount (required), tokenSymbol (required), tokenAddress (required), tokenDecimals (required), +1 more.

approve_moolah_vaultA
Idempotent

Approve TRC20 token spending for a Moolah vault before depositing. Not needed for TRX vaults. Pass the EXACT amount you intend to deposit (recommended). Pass amount='max' for unlimited approval ONLY when the user explicitly opts in β€” it lets the vault contract spend the user's entire balance, present and future, until revoked (amount='0').

Inputs: amount (required), vaultSymbol (required), network.

approve_underlyingA
Idempotent

Approve the jToken contract to spend your underlying TRC20 tokens. Required before supply() or repay() for TRC20-backed markets (not needed for jTRX). Pass the EXACT amount you intend to use (recommended). Pass amount='max' for unlimited approval ONLY when the user explicitly opts in β€” it lets the jToken contract spend the user's entire balance, present and future, until revoked. Typical cost: ~23,000 energy + ~265 bandwidth.

Inputs: amount (required), market (required), network.

calculate_energy_rental_priceA
Read-only

Calculate the cost to rent a specific amount of energy for a given duration. Returns TRX amount needed, rental rate, fee, total prepayment, security deposit, and daily cost. For NEW rentals: provide energyAmount and durationHours. For RENEWALS: provide energyAmount and receiverAddress. The tool auto-detects existing rentals and calculates the incremental cost (subtracting existing security deposit). durationHours is optional for renewals (defaults to 0 = no additional time).

Inputs: energyAmount (required), network, durationHours, receiverAddress.

cast_voteA
Destructive

Cast a vote on a governance proposal. You must have available votes (deposit JST first if needed). Support: true = vote FOR, false = vote AGAINST. You can add more votes to a proposal you already voted on.

Inputs: votes (required), support (required), proposalId (required), network.

check_jst_allowance_for_votingA
Read-onlyIdempotent

Check if JST has been approved for the WJST voting contract. Must be approved before depositing JST to get votes.

Inputs: address, network.

check_strx_withdrawal_eligibilityA
Read-only

Check if user has TRX available to withdraw after sTRX unstaking unbonding period. Shows staked amount, claimable rewards, pending/completed unstake rounds, and withdrawal status.

Inputs: address, network.

claim_moolah_mining_periodA
Destructive

Claim a single V2 mining airdrop round via multiClaim() on the Moolah merkle distributor. Pass periodKey from get_moolah_pending_mining_periods (preferred) or supply merkleIndex / index / amounts / proof directly. Pre-checks isClaimed() and merkleRoots() on-chain so the wallet does not pay gas for a guaranteed-revert tx. Mainnet currently errors with 'distributor not configured' until the V2 contract ships β€” nile testnet works.

Inputs: index, proof, address, amounts, +3 more.

claim_rewardsA

Claim accrued JustLend mining rewards for the configured wallet. Typical cost: ~60,000 energy + ~330 bandwidth.

Inputs: network.

claim_strx_rewardsA
Destructive

Claim all available sTRX staking rewards. Pre-checks: verifies there are claimable rewards before executing.

Inputs: network.

claim_v1_mining_periodA
Destructive

Claim a single V1 mining airdrop round via multiClaim() on the appropriate merkle distributor. Pass key from get_claimable_rewards (preferred) or supply merkleIndex / index / amount / proof directly. Routing matches the front-app: amount[] β†’ multi-merkle distributor (multi-token leaf); single + USDD β†’ USDDNEW distributor; single + other β†’ main distributor. Mainnet-only.

Inputs: key, index, proof, amount, +7 more.

deposit_jst_for_votesA
Destructive

Deposit JST into the WJST contract to get voting power. Requires prior approval of JST for the WJST contract (use approve_jst_for_voting first). 1 JST = 1 Vote. Deposited JST can be withdrawn back after voting.

Inputs: amount (required), network.

enter_marketA
Idempotent

Enable a jToken market as collateral. Required before borrowing against supplied assets. Once entered, your supply in this market counts towards your borrowing capacity. Typical cost: ~80,000 energy + ~300 bandwidth.

Inputs: market (required), network.

estimate_lending_energyA
Read-onlyIdempotent

Estimate energy, bandwidth, and TRX cost for any JustLend operation BEFORE executing it. Covers ALL operations: supply, withdraw, withdraw_all, borrow, repay, approve, enter_market, exit_market, claim_rewards. Tries on-chain simulation first; falls back to historical typical values if simulation fails. Returns per-step breakdown (e.g. approve + mint for supply), total energy, total bandwidth, and estimated TRX cost. For supply/repay: automatically checks current allowance β€” if sufficient, the approve step is skipped. For approve: supports custom spender address (not just jToken). Use this tool whenever the user asks about gas/energy/cost for any lending operation.

Inputs: market (required), operation (required), amount, address, +2 more.

estimate_moolah_energyA
Read-onlyIdempotent

Estimate energy, bandwidth, and TRX cost for a JustLend V2 (Moolah) write operation BEFORE executing it. Returns historical typical values (on-chain simulation for Moolah's tuple-args ops is not yet wired). Set isTRX=true when the underlying / loan / collateral token is native TRX (TrxProviderProxy route). Covers: vault_deposit, vault_withdraw, vault_redeem, approve_vault, supply_collateral, withdraw_collateral, borrow, repay, approve_proxy, liquidate, approve_liquidator.

Inputs: operation (required), isTRX, address, network.

exit_marketA
Destructive

Disable a jToken market as collateral. Pre-checks: 1) market must have no outstanding borrows; 2) remaining collateral must still cover all borrows. Typical cost: ~50,000 energy + ~280 bandwidth.

Inputs: market (required), network.

get_claimable_rewardsA
Read-onlyIdempotent

Scan all JustLend V1 merkle airdrop distributors for a user's unclaimed rewards. Returns a map keyed by round; each entry includes the merkleIndex, index, amount(s), token symbol/address, and proof. Feed any returned key into claim_v1_mining_period to submit the on-chain multiClaim. Mainnet-only.

Inputs: address (required), network.

get_energy_rental_dashboardA
Read-onlyIdempotent

Get JustLend energy rental market dashboard data including TRX price, exchange rate, total APY, energy per TRX, total supply, and other market parameters.

Inputs: network.

get_energy_rental_paramsA
Read-onlyIdempotent

Get on-chain energy rental parameters: liquidation threshold, fee ratio, min fee, total delegated/frozen TRX, max rentable amount, rent paused status, usage charge ratio.

Inputs: network.

get_energy_rental_rateA
Read-only

Get the current energy rental rate for a given TRX amount. Returns rental rate, stable rate, and effective rate (max of both).

Inputs: trxAmount (required), network.

get_energy_rental_recordsA
Read-onlyIdempotent

Get a user's JustLend energy-rental history: rent, extend, rent_more, end, recycle actions. Distinct from get_user_energy_rental_orders which returns current active on-chain orders β€” this one returns the full historical action log. Paginated. Mainnet-only.

Inputs: address (required), page, network, pageSize.

get_energy_rent_infoA
Read-only

Get on-chain energy rental info for a specific renter-receiver pair. Returns security deposit, rent balance, and whether an active rental exists.

Inputs: receiverAddress (required), network, renterAddress.

get_lending_recordsA
Read-onlyIdempotent

Get a user's V1 JustLend transaction history: supply, withdraw, borrow, repay, and collateral enable/disable. Paginated. Each record includes actionType (1-11), actionName (human-readable), token, amount, USD value, and txId. Mainnet-only.

Inputs: address (required), page, network, pageSize.

get_liquidation_recordsA
Read-onlyIdempotent

Get a user's V1 JustLend liquidation history β€” both positions the user liquidated and positions where the user was liquidated. Distinct from get_moolah_liquidation_records which covers V2 Moolah liquidations. Paginated. Mainnet-only.

Inputs: address (required), page, network, pageSize.

get_locked_votesB
Read-onlyIdempotent

Get the number of votes a user has locked in a specific proposal.

Inputs: proposalId (required), address, network.

get_market_dataA
Read-onlyIdempotent

Get detailed market data for a specific JustLend market: supply/borrow APY, TVL, utilization, collateral factor, price, and status. Use jToken symbol like 'jUSDT' or 'jTRX'.

Inputs: market (required), network.

get_moolah_dashboardA
Read-onlyIdempotent

JustLend V2 (Moolah) protocol overview: top vaults (APY, TVL) and top markets (borrow/supply rates). If address is provided, also includes the user's aggregated V2 position (total supply, borrow, health factor).

Inputs: address, network, depositToken, collateralToken.

get_moolah_historyB
Read-onlyIdempotent

Get a user's JustLend V2 position history (net worth, supply, borrow over time) and recent transaction records (supply, borrow, repay, etc.).

Inputs: address, network, timeFilter.

get_moolah_liquidation_quoteA
Read-onlyIdempotent

Estimate the loan token cost to liquidate a position. Provide either seizedAssets (collateral to take) OR repaidShares (borrow shares to repay), not both. Returns the exact loan token amount needed. Use this before calling moolah_liquidate.

Inputs: marketId (required), network, repaidShares, seizedAssets.

get_moolah_liquidation_recordsB
Read-onlyIdempotent

Historical liquidation events on Moolah β€” both bot-executed and public liquidations.

Inputs: page, type, network, pageSize, +2 more.

get_moolah_marketA
Read-onlyIdempotent

Get full details for a single Moolah market by its marketId (bytes32 hex). Includes APY, LLTV, utilization, total supply/borrow, and vaults supplying to this market. Use get_moolah_markets to find marketIds.

Inputs: marketId (required), network.

get_moolah_market_historyA
Read-onlyIdempotent

Time series of a V2 Moolah market's borrow/supply APY, utilization, and totals. Returns current totalBorrow/totalCollateral + borrowApy/supplyApy + list[] of historical points. Use marketId (bytes32 hex) from get_moolah_markets.

Inputs: marketId (required), network.

get_moolah_marketsA
Read-onlyIdempotent

List JustLend V2 (Moolah) markets with borrow/supply APY, LLTV, utilization, and liquidity. Markets are isolated β€” each has its own loan token, collateral token, oracle, and LLTV.

Inputs: network, pageSize, depositToken, collateralToken.

get_moolah_mining_accruingA
Read-onlyIdempotent

Get a user's accruing & settling V2 mining rewards across vaults. accruingUsd = current round still emitting; settlingUsd = previous round in the brief settlement window (miningStatus=2, currRewardStatus=1) β€” excluded otherwise so it doesn't double-count with already-published merkle airdrops. globalSettlementStatus=true means the backend reports any token in flux; treat per-token amounts as provisional.

Inputs: address, network.

get_moolah_mining_resolverA
Read-onlyIdempotent

Map every Moolah vault with active mining to its USDD / TRX APY split. Used by the dashboard to prefetch fire-icon eligibility in one round-trip. Vaults with zero mining APY are excluded from the response.

Inputs: network.

get_moolah_pending_liquidationsA
Read-onlyIdempotent

List Moolah positions eligible or approaching liquidation. riskLevel > 1.0 means the position is liquidatable right now. Use minRiskLevel=0.9 to find positions near the threshold.

Inputs: page, network, pageSize, debtToken, +3 more.

get_moolah_pending_mining_periodsA
Read-onlyIdempotent

Get a user's claimable V2 mining airdrop rounds (already settled and merkle-published). Each period includes merkleIndex, index, per-token amounts (raw + decimal-shifted), the merkle proof, and a USD total. Feed a periodKey directly into claim_moolah_mining_period to submit the on-chain multiClaim. Set includeClaimed=true to also return rounds the indexer marks as already claimed (default false matches the rewards card behaviour).

Inputs: address, network, includeClaimed.

get_moolah_recordsA
Read-onlyIdempotent

Get a user's paginated V2 (Moolah) transaction history β€” supply, withdraw, borrow, repay, liquidate events. Distinct from get_moolah_history (which returns position curves + a small recent-txs preview) β€” this one is the full paginated record list. Works on both mainnet and nile.

Inputs: pageNo, address, network, pageSize.

get_moolah_user_positionA
Read-onlyIdempotent

Get a user's position in a specific Moolah market: collateral, borrow amount, lltv, and risk ratio. risk close to 1.0 means the position is near liquidation β€” consider repaying or adding collateral.

Inputs: marketId (required), address, network.

get_moolah_vaultA
Read-onlyIdempotent

Get detailed info for a single Moolah vault: APY, TVL, allocation, and the user's share balance if address is provided. vaultSymbol is 'TRX', 'USDT', or 'USDD'.

Inputs: vaultSymbol (required), address, network.

get_moolah_vault_historyA
Read-onlyIdempotent

Time series of a V2 Moolah vault's APY, TVL, and supply mining data. Returns currentSupplyUsd, supplyBaseApy, supplyMiningApy, and a historyRecords array. Use vaultAddress from get_moolah_vaults or chains.ts vault map.

Inputs: vaultAddress (required), network.

get_moolah_vault_mining_apyA
Read-onlyIdempotent

Get V2 mining APY for a single Moolah vault. Returns the USDD / TRX APY split and total (encoded as a fraction, e.g. 0.123 = 12.3%). enabled=true means the vault is active in mining and qualifies for the fire-icon UI hint.

Inputs: vaultAddress (required), network.

get_moolah_vaultsA
Read-onlyIdempotent

List all JustLend V2 (Moolah) vaults with APY, TVL, and underlying token. Vaults are ERC4626 β€” deposit tokens to earn auto-compounding yield allocated across Moolah markets.

Inputs: network, depositToken.

get_proposal_listA
Read-onlyIdempotent

Get the list of JustLend DAO governance proposals. Returns proposals with their status (Active, Passed, Defeated, etc.), vote counts, and details. Sorted by newest first.

Inputs: limit, network.

get_return_rental_infoA
Read-only

Get estimated refund info for returning/canceling an energy rental. Shows how much TRX would be refunded (estimatedRefundTrx), remaining rent, security deposit, usage rental cost, unrecovered energy, and daily rent cost.

Inputs: receiverAddress (required), network, renterAddress.

get_strx_accountA
Read-only

Get user's sTRX staking account info including staked amount, income, claimable rewards, withdrawn amount, and rental energy amount.

Inputs: address, network.

get_strx_balanceA
Read-only

Get the sTRX token balance for an address.

Inputs: address, network.

get_strx_recordsA
Read-onlyIdempotent

Get a user's sTRX staking history: stake, unstake, withdraw (after unbonding), and sTRX transfers. Each record has opType (1-6) and a human-readable opName. Paginated. Mainnet-only.

Inputs: address (required), page, network, pageSize.

get_token_balanceA
Read-onlyIdempotent

Get TRC20 token balance for an address. You can pass either a token symbol (e.g. 'USDD', 'USDT', 'ETH') or a contract address. When using a symbol, it resolves to the correct contract address from JustLend markets automatically. IMPORTANT: Always prefer using token symbols over raw addresses to avoid using outdated/wrong contract addresses. For example, use 'USDD' instead of a raw address β€” the old USDD (TPYmHEhy5n8TCEfYGqW2rPxsghSfzghPDn) is deprecated. The returned balance is already formatted in human-readable token units (decimals already applied). Do NOT divide the balance by decimals again.

Inputs: token, address, network, tokenAddress.

get_user_energy_rental_ordersA
Read-only

Get a user's energy rental orders from JustLend. Can filter by role: 'renter' (orders where user is renting out), 'receiver' (orders where user receives energy), or 'all'.

Inputs: page, type, address, network, +1 more.

get_user_vote_statusA
Read-onlyIdempotent

Get a user's voting status across all governance proposals. Shows which proposals the user has voted on, their vote amounts (for/against/abstain), and which proposals have withdrawable votes.

Inputs: address, network.

get_vote_infoA
Read-onlyIdempotent

Get voting power info for a user: JST wallet balance, available (surplus) votes, total deposited votes, and votes currently cast in proposals. This is the key tool to check before voting β€” it shows how many votes are available to use.

Inputs: address, network.

get_vote_recordsA
Read-onlyIdempotent

Get a user's governance voting history: get_vote (JST β†’ WJST deposits), votes cast for/against proposals, vote withdrawals, and JST conversions back. Each record has opType (1-6), opName, amount, and proposalId (for votes and withdrawals). Use get_user_vote_status for real-time current voting power. Mainnet-only.

Inputs: address (required), page, network, pageSize.

get_wallet_addressA
Read-onlyIdempotent

Get the active wallet address. Returns browser wallet address if in browser mode, agent-wallet address if agent mode is selected, or a first-use wallet selection guide if no wallet mode has been chosen yet.

Inputs: no named parameters.

moolah_borrowA
Destructive

Flexible Moolah borrow entry point. Provide collateralAmount only β†’ supply collateral without borrowing. Provide borrowAmount only β†’ borrow against existing collateral. Provide both β†’ supply collateral then borrow in two sequential transactions. Collateral must cover the borrow at the market's LLTV or the borrow tx reverts.

Inputs: marketId (required), network, borrowAmount, collateralAmount.

moolah_liquidateA
Destructive

Liquidate an undercollateralized Moolah position. You must hold the loan token and have approved it via approve_liquidator_token. Provide EITHER seizedAssets (collateral to seize) OR repaidShares (borrow shares to repay), not both. Use get_moolah_liquidation_quote first to estimate the required loan token amount.

Inputs: borrower (required), marketId (required), network, repaidShares, +1 more.

moolah_repayA
Destructive

Repay a Moolah market loan. Use amount='max' to repay the full outstanding borrow (uses shares math for exact settlement). For TRC20 loan tokens, call approve_moolah_proxy first. For TRX loans, TRX is sent directly.

Inputs: amount (required), marketId (required), network.

moolah_supply_collateralA
Destructive

Supply collateral into a Moolah market to enable borrowing. For TRC20 collateral, call approve_moolah_proxy first. For TRX collateral, TRX is sent directly with no prior approval.

Inputs: amount (required), marketId (required), network.

moolah_vault_depositA
Destructive

Deposit assets into a Moolah ERC4626 vault to earn yield. For TRC20 vaults (USDT, USDD), call approve_moolah_vault first. Returns vault shares representing your deposit.

Inputs: amount (required), vaultSymbol (required), network.

moolah_vault_redeemA
Destructive

Redeem vault shares to receive underlying assets. Use shares='max' to redeem all shares. No approval needed.

Inputs: shares (required), vaultSymbol (required), network.

moolah_vault_withdrawA
Destructive

Withdraw underlying assets from a Moolah vault by specifying the asset amount. Use amount='max' to withdraw everything. No approval needed.

Inputs: amount (required), vaultSymbol (required), network.

moolah_withdraw_collateralA
Destructive

Withdraw collateral from a Moolah market. Use amount='max' to withdraw all collateral (only allowed when no active borrows). Withdrawing too much while borrowing will revert β€” check health factor first.

Inputs: amount (required), marketId (required), network.

rent_energyA
Destructive

Rent energy from JustLend for a specified receiver address. Automatically calculates TRX needed based on energy amount. For NEW rentals: durationHours is required (minimum 1 hour), minimum energy is 300,000. For RENEWALS (existing active rental to the same receiver): durationHours is NOT needed β€” the remaining duration from the existing order is used automatically. Minimum energy for renewal is 50,000. Pre-checks: rental not paused, amount within limits, sufficient TRX balance.

Inputs: energyAmount (required), receiverAddress (required), network, durationHours.

repayA
Destructive

Repay borrowed assets to a JustLend market. For TRC20 markets, must have approved underlying first. Use amount='max' to repay the full outstanding borrow. Typical cost: 80,00090,000 energy + 280320 bandwidth (TRX costs less than TRC20).

Inputs: amount (required), market (required), network.

stake_trx_to_strxA
Destructive

Stake TRX via JustLend to receive sTRX tokens. sTRX earns staking rewards (vote APY + energy rental income). Pre-checks: sufficient TRX balance for staking amount + gas.

Inputs: amount (required), network.

transfer_trxA

Transfer TRX to another TRON address. Checks balance sufficiency (including gas) before sending. Typical cost: ~0 energy + ~270 bandwidth.

Inputs: to (required), amount (required), network.

unstake_strxA
Destructive

Unstake sTRX to receive TRX back. Note: unstaked TRX has an unbonding period (typically 14 days) before withdrawal. Pre-checks: sufficient sTRX balance.

Inputs: amount (required), network.

unwrap_trxA
Destructive

Unwrap WTRX (Wrapped TRX) back into native TRX at a 1:1 rate via the WTRX contract's withdraw(uint256). No approval is needed β€” you burn your own WTRX. Reverses wrap_trx (1:1). Pre-checks: sufficient WTRX balance and native TRX for gas.

Inputs: amount (required), network.

withdraw_votes_from_proposalA
Destructive

Withdraw (reclaim) votes from a completed or canceled proposal. Only works for proposals that are no longer active. After withdrawing, the votes become available again for other proposals or can be converted back to JST.

Inputs: proposalId (required), network.

withdraw_votes_to_jstA
Destructive

Withdraw WJST back to JST. Can only withdraw votes that are not currently locked in active proposals. Use get_vote_info to check your surplus (available) votes before withdrawing.

Inputs: amount (required), network.

wrap_trxA
Destructive

Wrap native TRX into WTRX (Wrapped TRX) at a 1:1 rate by sending TRX to the WTRX contract's payable deposit(). WTRX is a TRC20 representation of TRX used by DeFi protocols that can't hold native TRX (e.g. JustLend V2 / Moolah markets quoting WTRX). Reversible: unwrap_trx converts WTRX back to TRX 1:1. Pre-checks: sufficient TRX balance for the wrap amount + gas.

Inputs: amount (required), network.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    B3.4/5.0

    Scored across 73 tools

    Disambiguation3/5

    Many tools are explicitly disambiguated in their descriptions (e.g., get_moolah_history vs get_moolah_records), but there are still fuzzy clusters such as claim_rewards vs claim_v1_mining_period, moolah_vault_withdraw vs moolah_vault_redeem, and several overlapping vote/mining status getters. The detailed descriptions help, but the sheer number of similar-sounding getters makes misselection likely.

    Naming Consistency4/5

    The server mostly follows a verb_noun snake_case pattern with useful domain prefixes like moolah_, strx_, and energy_rental. However, there are inconsistencies such as moolah_vault_deposit instead of deposit_moolah_vault, generic claim_rewards alongside claim_v1_mining_period, and unprefixed enter_market/exit_market. Overall it is predictable but not perfectly uniform.

    Tool Count1/5

    73 tools is far beyond the well-scoped 3-15 range and even beyond the 25+ 'too many' threshold. The server bundles V1 lending, V2 Moolah, sTRX staking, energy rental, and governance, which explains the count, but an MCP surface this large is an extreme mismatch for agent usability.

    Completeness2/5

    The server covers many domains, but V1 JustLend is missing its core write actions: there is no supply, withdraw, or borrow tool for V1 markets, only repay, collateral entry/exit, approvals, and estimates. This is a major gap that will prevent agents from completing basic lending workflows, and governance also lacks proposal creation.

    Maintenance

    ActivityNo data
    ResponsivenessOutdated data

    Related MCP Connectors

    Related MCP Servers

    • F
      license
      A
      quality
      D
      maintenance
      First-party MCP server for Kaskad Protocol β€” a DeFi lending protocol on Igra L2 (Kaspa). Enables AI agents to autonomously supply, borrow, repay, withdraw, and stake. Includes 16 tools covering live market reads, governance params, health factor monitoring, emission state, and full write access to on-chain lending operations. Compatible with Claude, OpenClaw, and any MCP-compatible client.
      17
      -
    • A
      license
      A
      quality
      D
      maintenance
      An MCP server for AI agents to interact with the JustLend DAO lending protocol on TRON, plus general TRON chain utilities like balances, transfers, and staking.
      37
      MIT