mcp-server-TLD
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@mcp-server-TLD check my health factor on JustLend"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
mcp-server-TLD
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, 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, based on the Compound V2 architecture. This MCP server wraps the full protocol functionality into tools and guided prompts that AI agents (Claude Desktop, Cursor, etc.) can use.
š Current Version: JustLend V1
This MCP server currently supports JustLend V1 protocol. All contract addresses, ABIs, calculation functions, and lending operations are for V1.
Key Capabilities
JustLend Protocol
Market Data: Real-time APYs, TVL, utilization rates, prices for all markets
Direct contract queries for on-chain accuracy
API-based queries for comprehensive market data (more stable, includes historical data and mining rewards)
Account Data: Full position analysis with API support
Contract-based: Health factor, collateral, borrow positions
API-based: Enhanced data with mining rewards, historical trends, risk metrics
Mining Rewards: Advanced mining reward calculation (based on justlend-app logic)
Detailed breakdown by market and reward token (USDD, TRX, WBTC, etc.)
Separates new period vs. last period rewards
USD value calculation with live token prices
Mining status tracking (ongoing/paused/ended) and period end times
Supply: Deposit TRX or TRC20 tokens to earn interest (mint jTokens)
Borrow: Borrow assets against your collateral with health factor monitoring
Repay: Repay outstanding borrows with full or partial amounts
Withdraw: Redeem jTokens back to underlying assets
Collateral Management: Enter/exit markets, manage what counts as collateral
Portfolio Analysis: AI-guided risk assessment, health factor monitoring, optimization
Token Approvals: Manage TRC20 approvals for jToken contracts
JST Voting / Governance: View proposals, cast votes, deposit/withdraw JST for voting power, reclaim votes
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
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, sign typed data (EIP-712), HD wallet derivation from mnemonic
Related MCP server: mcp-server-tron
Supported Markets
jToken | Underlying | Description |
jTRX | TRX | Native TRON token |
jUSDT | USDT | Tether USD |
jUSDC | USDC | USD Coin |
jBTC | BTC | Bitcoin (wrapped) |
jETH | ETH | Ethereum (wrapped) |
jSUN | SUN | SUN token |
jWIN | WIN | WINkLink |
jTUSD | TUSD | TrueUSD |
Prerequisites
Node.js 20.0.0 or higher
Optional: TronGrid API key for reliable mainnet access (strongly recommended)
Installation
git clone https://github.com/your-org/mcp-server-TLD.git
cd mcp-server-TLD
npm installConfiguration
Environment Variables
SECURITY: Never save private keys in config files. Use environment variables.
# Required for write operations (supply, borrow, transfer, stake, etc.)
export TRON_PRIVATE_KEY="your_private_key_hex"
# OR use a mnemonic phrase
export TRON_MNEMONIC="word1 word2 ... word12"
export TRON_ACCOUNT_INDEX="0" # Optional HD wallet account index, default: 0
# Strongly recommended ā avoids TronGrid 429 rate limiting on mainnet
export TRONGRID_API_KEY="your_trongrid_api_key"Client Configuration
Claude Desktop
Add to ~/Library/Application Support/Claude/claude_desktop_config.json:
{
"mcpServers": {
"justlend": {
"command": "npx",
"args": ["tsx", "/path/to/mcp-server-TLD/src/index.ts"],
"env": {
"TRONGRID_API_KEY": "your_key"
}
}
}
}Cursor
Add to .cursor/mcp.json:
{
"mcpServers": {
"justlend": {
"command": "npx",
"args": ["tsx", "/path/to/mcp-server-TLD/src/index.ts"]
}
}
}Usage
# Stdio mode (for MCP clients)
npm start
# HTTP/SSE mode (for remote clients)
npm run start:http
# Development with auto-reload
npm run devAPI Reference
Tools (34 total)
Wallet & Network
Tool | Description | Write? |
| Show configured wallet address | No |
| List available networks | No |
| List all jToken markets with addresses | No |
Market Data
Tool | Description | Write? |
| Detailed data for one market (APY, TVL, rates) - Contract query | No |
| Overview of all markets - Contract query | No |
| Comptroller config & protocol parameters - Contract query | No |
| [API] All market data with mining rewards & trends | No |
| [API] Protocol-level statistics (TVL, users, etc.) | No |
| [API] Detailed jToken info with interest rate model | No |
Account & Balances
Tool | Description | Write? |
| Full position: supplies, borrows, health factor - Contract query | No |
| [API] Enhanced account data with mining rewards & trends | No |
| Check TRC20 approval for jToken | No |
| TRX balance | No |
| TRC20 token balance | No |
Lending Operations
Tool | Description | Write? |
| Deposit assets to earn interest | Yes |
| Withdraw supplied assets | Yes |
| Withdraw all from a market | Yes |
| Borrow against collateral | Yes |
| Repay outstanding borrows | Yes |
| Enable market as collateral | Yes |
| Disable market as collateral | Yes |
| Approve TRC20 for jToken | Yes |
| Claim mining rewards | Yes |
JST Voting / Governance
Tool | Description | Write? |
| List all governance proposals with status and vote counts | No |
| User's voting history: voted proposals, withdrawable votes | No |
| Voting power: JST balance, available votes, locked votes | No |
| Votes locked in a specific proposal | No |
| Check JST approval for WJST voting contract | No |
| Approve JST for the WJST voting contract | Yes |
| Deposit JST to get voting power (1 JST = 1 Vote) | Yes |
| Withdraw WJST back to JST | Yes |
| Cast for/against votes on a proposal | Yes |
| Reclaim votes from completed proposals | Yes |
Prompts (AI-Guided Workflows)
Prompt | Description |
| Step-by-step supply with balance checks and approval |
| Safe borrowing with risk assessment and health factor checks |
| Guided repayment with verification |
| Comprehensive portfolio analysis with risk scoring |
| Find best supply/borrow opportunities |
Architecture
mcp-server-TLD/
āāā src/
ā āāā core/
ā ā āāā chains.ts # Network configs + JustLend contract addresses
ā ā āāā abis.ts # jToken, Comptroller, Oracle, TRC20 ABIs
ā ā āāā tools.ts # MCP tool registrations
ā ā āāā prompts.ts # AI-guided workflow prompts
ā ā āāā resources.ts # Static protocol info resource
ā ā āāā services/
ā ā āāā # ā JustLend-specific ā
ā ā āāā clients.ts # TronWeb client factory (cached)
ā ā āāā wallet.ts # Key/mnemonic management, signMessage, signTypedData
ā ā āāā markets.ts # APY, TVL, utilization, prices
ā ā āāā account.ts # User positions, liquidity, allowances
ā ā āāā lending.ts # supply, borrow, repay, withdraw, collateral
ā ā āāā voting.ts # JST governance: proposals, cast vote, deposit/withdraw WJST
ā ā āāā # ā 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, deploy, estimateEnergy
ā ā āāā multicall-abi.ts # Multicall2 & Multicall3 ABIs
ā ā āāā staking.ts # Stake 2.0: freeze, unfreeze, withdrawExpireUnfreeze
ā ā āāā utils.ts # toSun/fromSun, formatJson, hexToNumber, isAddress, ā¦
ā āāā server/
ā ā āāā server.ts # MCP server init
ā ā āāā http-server.ts # Express HTTP/SSE transport
ā āāā index.ts # Stdio entry point
āāā bin/cli.js # CLI entry for npx
āāā 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)
āāā 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)
āāā wallet.test.ts # Unit: skipped without TRON_PRIVATE_KEYTesting
# 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
# Enable write/staking tests (uses real funds ā use Nile testnet!)
TRON_PRIVATE_KEY=xxx TEST_TRANSFER=1 npx vitest run tests/core/services/transfer.test.ts
TRON_PRIVATE_KEY=xxx TEST_STAKING=1 npx vitest run tests/core/services/staking.test.tsRate limiting: Integration tests make real RPC calls to TronGrid. Without
TRONGRID_API_KEYthe free tier limits to a few requests per second. Run test files individually, or setTRONGRID_API_KEYto avoid 429 errors.
Security Considerations
Private keys are read from environment variables only, never exposed via MCP tools
Write operations are clearly marked with
destructiveHint: truein MCP annotationsHealth factor checks in prompts prevent dangerous borrowing
Always test on Nile testnet before mainnet operations
Be cautious with unlimited approvals (
approve_underlyingwithmax)Never share your
claude_desktop_config.jsonif it contains keys
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
License
MIT
Available Tools
37 toolsapprove_jst_for_votingAIdempotent
Approve JST token for the WJST voting contract. Required before depositing JST to get voting power. Use amount='max' for unlimited approval.
Inputs: amount, network.
approve_underlyingAIdempotent
Approve the jToken contract to spend your underlying TRC20 tokens. Required before supply() or repay() for TRC20-backed markets (not needed for jTRX). Use amount='max' for unlimited approval. Typical cost: ~23,000 energy + ~265 bandwidth.
Inputs: market (required), amount, network.
borrowADestructive
Borrow assets from a JustLend market against your collateral. You must have entered a market as collateral (enter_market) and have sufficient liquidity. Check your account_summary and health_factor before borrowing. Typical cost: ~100,000 energy + ~313 bandwidth.
Inputs: amount (required), market (required), network.
cast_voteADestructive
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_allowanceARead-onlyIdempotent
Check if the underlying TRC20 token has been approved for a jToken market. Must be approved before supply() or repay() for TRC20 markets. Not needed for jTRX.
Inputs: market (required), address, network.
check_jst_allowance_for_votingARead-onlyIdempotent
Check if JST has been approved for the WJST voting contract. Must be approved before depositing JST to get votes.
Inputs: address, network.
claim_rewardsA
Claim accrued JustLend mining rewards for the configured wallet. Typical cost: ~60,000 energy + ~330 bandwidth.
Inputs: network.
deposit_jst_for_votesADestructive
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_marketAIdempotent
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_energyARead-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.
exit_marketADestructive
Disable a jToken market as collateral. Will fail if doing so would make your account undercollateralized. Check account_summary first to ensure safety. Typical cost: ~50,000 energy + ~280 bandwidth.
Inputs: market (required), network.
get_account_data_from_apiARead-onlyIdempotent
Get user account data from JustLend API. More stable and comprehensive than contract queries. Returns lending positions, balances, mining rewards, health factor, etc.
Inputs: address, network.
get_account_summaryARead-onlyIdempotent
Get a comprehensive view of a user's JustLend positions: supply balances, borrow balances, collateral status, health factor, liquidation risk, and USD values for each market.
Inputs: address, network.
get_all_marketsARead-onlyIdempotent
Get overview data for ALL JustLend markets including supply APY, borrow APY, mining rewards APY, underlying staking yield, total supply APY, and TVL. Mining APY is calculated from on-chain supply mining programs (USDD/TRX dual mining, WBTC mining, etc.). totalSupplyAPY = base supply APY + underlying staking APY + mining APY.
Inputs: network.
get_dashboard_from_apiARead-onlyIdempotent
Get JustLend protocol dashboard from API. Returns protocol-level statistics: total supply, total borrow, TVL, number of suppliers/borrowers, etc.
Inputs: network.
get_jtoken_details_from_apiBRead-onlyIdempotent
Get detailed jToken information from API. Returns comprehensive market details including interest rate model, reserve info, etc.
Inputs: jtokenAddr (required), network.
get_locked_votesARead-onlyIdempotent
Get the number of votes a user has locked in a specific proposal.
Inputs: proposalId (required), address, network.
get_market_dataARead-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_markets_from_apiARead-onlyIdempotent
Get all market data from JustLend API. More stable than contract queries. Returns comprehensive market data including APY, TVL, utilization, prices, mining rewards, etc.
Inputs: network.
get_mining_rewardsARead-onlyIdempotent
Get mining rewards for supply markets (USDD, WBTC, etc.). Returns unclaimed rewards, mining APY, and reward breakdown from API.
Inputs: address, network.
get_proposal_listARead-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_protocol_summaryARead-onlyIdempotent
Get JustLend protocol-level info: Comptroller config, close factor, liquidation incentive, total markets.
Inputs: network.
get_supported_marketsARead-onlyIdempotent
List all available JustLend lending markets (jTokens) with their addresses and underlying assets.
Inputs: network.
get_supported_networksARead-onlyIdempotent
List all supported TRON networks for JustLend.
Inputs: no named parameters.
get_token_balanceARead-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_trx_balanceBRead-onlyIdempotent
Get TRX balance for an address.
Inputs: address, network.
get_usdd_mining_configARead-onlyIdempotent
Get USDD mining configuration including mining periods, reward tokens (USDD/TRX dual mining), and schedule.
Inputs: no named parameters.
get_user_vote_statusARead-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_infoARead-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_wallet_addressARead-onlyIdempotent
Get the configured wallet address. This wallet is used for all lending operations.
Inputs: no named parameters.
get_wbtc_mining_configBRead-onlyIdempotent
Get WBTC mining configuration and supply mining activity details.
Inputs: no named parameters.
repayADestructive
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.
supplyADestructive
Supply (deposit) assets into a JustLend market to earn interest. For TRC20 markets, you must first call approve_underlying. For jTRX, TRX is sent directly. Returns a jToken balance representing your deposit. Typical cost: ~100,000 energy + ~310 bandwidth for TRC20, ~80,000 energy + ~280 bandwidth for TRX. Use estimate_lending_energy tool for precise estimates before executing.
Inputs: amount (required), market (required), network.
withdrawADestructive
Withdraw (redeem) supplied assets from a JustLend market. Specify the amount in underlying units. May fail if assets are used as collateral for active borrows. Typical cost: ~90,000 energy + ~300 bandwidth.
Inputs: amount (required), market (required), network.
withdraw_allADestructive
Withdraw ALL supplied assets from a JustLend market by redeeming all jTokens. Typical cost: ~90,000 energy + ~300 bandwidth.
Inputs: market (required), network.
withdraw_votes_from_proposalADestructive
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_jstADestructive
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.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelogā¦
TDQS
Scored across 37 tools
Most tools have distinct purposes, but there is some overlap among data retrieval tools like get_market_data, get_all_markets, and get_markets_from_api, which provide similar market information from different sources. Descriptions help differentiate, but an agent might still select the wrong one without careful analysis.
Tool names consistently follow a verb_noun pattern with underscores (e.g., get_wallet_address, approve_underlying, cast_vote). Even longer names like get_markets_from_api and get_jtoken_details_from_api maintain this pattern, making the naming predictable and easy to understand.
With 37 tools, the set is somewhat large for a single lending protocol. While many are necessary for comprehensive coverage (including governance and helper tools), some like the multiple market data tools could be consolidated, making the count feel slightly excessive for the apparent scope.
The tool set covers all core lending operations (supply, withdraw, borrow, repay, collateral management, approvals) plus governance (voting, depositing votes) and utility tools (balance checks, energy estimation). There are no obvious gaps for a user interacting with JustLend protocol.
Related MCP Connectors
TRON Energy marketplace + DEX swap aggregator for AI agents. 27 MCP tools.
TRON energy exchange for AI agents. 54 tools, 30 prompts, 21 resources. A2A + ACP.
MCP server connecting AI agents to non-custodial staking data across 130+ networks.
MCP server for the Z1N Protocol - on-chain identity for AI agents on Polygon
Related MCP Servers
- AlicenseAqualityDmaintenanceTRON Energy & Bandwidth marketplace for AI agents ā 27 MCP tools for buying/selling resources, DEX swaps, and automated energy management via Streamable HTTP.272MIT
- AlicenseBqualityCmaintenanceA comprehensive MCP server that enables AI agents to interact with the TRON blockchain, including tools for blockchain data, token transfers, smart contracts, staking, and wallet management.9764 npm27MIT

mcp-server-justlendofficial
AlicenseBqualityBmaintenanceAn MCP server enabling AI agents to interact with JustLend DAO on TRON for lending, borrowing, and portfolio management, plus general TRON chain utilities.9873 npm3MIT- AlicenseCqualityDmaintenanceMCP server for TRON blockchain integration, enabling AI assistants to check balances, manage transactions, interact with smart contracts, and access real-time blockchain data.332MIT