Skip to main content
Glama
lends-mcp-server

lends-mcp-server

Official

LENDS MCP Server

Local Model Context Protocol server for LENDS lending/borrowing, the leUSD PSM, and sleUSD staking.

The server exposes:

  • on-chain protocol, market, position, token, PSM, staking, unstake, and read-only liquidation-plan tools;

  • unsigned transaction construction for approvals, lending, repayment, PSM conversion, and the sleUSD stake/unstake lifecycle;

  • deterministic protocol-math tools using raw integer units.

It contains no signer, accepts no private key, never broadcasts, and exposes no admin, liquidation-execution, reserve, harvest, loss, configuration, pause, ownership, upgrade, LENDS purchase, lock, liquidity, or vesting action.

Install and run

Publish or install @lendsprotocol/sdk first, then:

npm install -g @lendsprotocol/mcp-server
LENDS_RPC_URL=https://your-rpc.example lends-mcp

LENDS_RPC_URL is read from the child process environment. It is required only for on-chain read tools; transaction builders and math tools work offline. The server uses stdio, so an MCP client starts it as a local child process—there is no HTTP API or hosted LENDS service.

Example MCP client configuration:

{
  "mcpServers": {
    "lends": {
      "command": "lends-mcp",
      "env": {
        "LENDS_RPC_URL": "https://your-rpc.example"
      }
    }
  }
}

For a local checkout, use "command": "node" and "args": ["/absolute/path/to/lends-mcp-server/dist/index.js"].

Related MCP server: DorkFiMCP

Inputs and outputs

All uint256-compatible inputs are unsigned base-10 strings, not JSON numbers. This prevents precision loss:

{
  "collateral": "0xd0601CE157Db5bdC3162BbaC2a2C8aF5320D9EEC",
  "amount": "1000000000000000000"
}

Big integers in results are also base-10 strings. Prepared transactions contain only to, data, value, and chainId; the calling wallet must review, sign, and submit them.

Development

npm ci
npm run check
npm test
npm run build

Available Tools

37 tools
lends_assert_chainLends Assert ChainA
Read-onlyIdempotent

Verify that LENDS_RPC_URL serves the configured deployment chain.

Inputs: no named parameters.

lends_get_liquidation_planLends Get Liquidation PlanA
Read-onlyIdempotent

Read liquidation eligibility and projected coverage without executing liquidation.

Inputs: owner (required), collateral (required).

lends_get_marketLends Get MarketA
Read-onlyIdempotent

Read one collateral market by token address.

Inputs: collateral (required).

lends_get_marketsLends Get MarketsA
Read-onlyIdempotent

List configured collateral markets with risk parameters and oracle state.

Inputs: no named parameters.

lends_get_positionLends Get PositionB
Read-onlyIdempotent

Read a borrower's collateral position and derived debt, health, and capacity.

Inputs: owner (required), collateral (required), timestamp.

lends_get_protocol_stateLends Get Protocol StateA
Read-onlyIdempotent

Read a block-consistent snapshot of public LENDS protocol and PSM state.

Inputs: no named parameters.

lends_get_staking_stateLends Get Staking StateA
Read-onlyIdempotent

Read public sleUSD pool, capacity, cooldown, claim, and vesting state.

Inputs: no named parameters.

lends_get_token_stateLends Get Token StateB
Read-onlyIdempotent

Read ERC-20 metadata, owner balance, total supply, and selected allowances.

Inputs: owner (required), token (required), spenders.

lends_get_unstake_requestLends Get Unstake RequestA
Read-onlyIdempotent

Read one sleUSD unstake request by unsigned request ID.

Inputs: requestId (required).

lends_math_collateral_valueLends Math Collateral ValueB
Read-onlyIdempotent

Calculate raw 6-decimal leUSD collateral value.

Inputs: priceE8 (required), collateralRaw (required), collateralDecimals (required).

lends_math_convert_decimals_exactLends Math Convert Decimals ExactA
Read-onlyIdempotent

Convert raw units between decimal scales, returning null if downscaling is inexact.

Inputs: amount (required), toDecimals (required), fromDecimals (required).

lends_math_health_factorLends Math Health FactorA
Read-onlyIdempotent

Calculate health factor in basis points; returns null when debt is zero.

Inputs: debtLeusd (required), valueLeusd (required), liquidationThresholdBps (required).

lends_math_liquidation_priceLends Math Liquidation PriceA
Read-onlyIdempotent

Calculate the 8-decimal liquidation price; returns null without debt or collateral.

Inputs: debtLeusd (required), collateralRaw (required), collateralDecimals (required), liquidationThresholdBps (required).

lends_math_max_borrowLends Math Max BorrowB
Read-onlyIdempotent

Calculate maximum raw leUSD debt at a borrow LTV.

Inputs: valueLeusd (required), borrowLtvBps (required).

lends_math_pending_vault_feeLends Math Pending Vault FeeA
Read-onlyIdempotent

Calculate projected simple vault fees with contract-equivalent floor rounding.

Inputs: debt (required), timestamp (required), lastAccrualTs (required), stabilityFeeAprBps (required).

lends_math_scale_price_to_e8Lends Math Scale Price To E8C
Read-onlyIdempotent

Normalize a positive oracle answer to 8 decimals.

Inputs: answer (required), decimals (required).

lends_math_withdrawable_collateralLends Math Withdrawable CollateralB
Read-onlyIdempotent

Calculate maximum raw collateral withdrawal while retaining borrow-LTV safety.

Inputs: priceE8 (required), debtLeusd (required), borrowLtvBps (required), collateralRaw (required), +1 more.

lends_prepare_accrue_feeLends Prepare Accrue FeeB
Read-onlyIdempotent

Construct a permissionless vault fee-accrual transaction.

Inputs: borrower (required), collateral (required).

lends_prepare_approveLends Prepare ApproveB
Read-onlyIdempotent

Construct an exact ERC-20 approval transaction; amount 0 revokes approval.

Inputs: token (required), amount (required), spender (required).

lends_prepare_approve_collateralLends Prepare Approve CollateralC
Read-onlyIdempotent

Construct collateral approval for the LENDS protocol.

Inputs: amount (required), collateral (required).

lends_prepare_approve_leusd_for_psmLends Prepare Approve Leusd For PsmA
Read-onlyIdempotent

Construct leUSD approval for a PSM swap out to USDG.

Inputs: amount (required).

lends_prepare_approve_leusd_for_repayLends Prepare Approve Leusd For RepayA
Read-onlyIdempotent

Construct leUSD approval for protocol repayment.

Inputs: amount (required).

lends_prepare_approve_leusd_for_stakingLends Prepare Approve Leusd For StakingA
Read-onlyIdempotent

Construct leUSD approval for sleUSD staking.

Inputs: amount (required).

lends_prepare_approve_usdg_for_psmLends Prepare Approve Usdg For PsmA
Read-onlyIdempotent

Construct USDG approval for a PSM swap into leUSD.

Inputs: amount (required).

lends_prepare_borrowLends Prepare BorrowB
Read-onlyIdempotent

Construct a leUSD borrowing transaction against collateral.

Inputs: amount (required), collateral (required).

lends_prepare_cancel_expired_unstakeLends Prepare Cancel Expired UnstakeA
Read-onlyIdempotent

Construct a transaction to recover shares from an expired unstake request.

Inputs: requestId (required).

lends_prepare_complete_unstakeLends Prepare Complete UnstakeB
Read-onlyIdempotent

Construct a transaction to complete a claimable unstake request.

Inputs: requestId (required).

lends_prepare_depositLends Prepare DepositA
Read-onlyIdempotent

Construct a collateral deposit transaction.

Inputs: amount (required), collateral (required).

lends_prepare_psm_swap_inLends Prepare Psm Swap InB
Read-onlyIdempotent

Construct an exact USDG-to-leUSD PSM transaction.

Inputs: usdgAssets (required).

lends_prepare_psm_swap_outLends Prepare Psm Swap OutB
Read-onlyIdempotent

Construct an exact leUSD-to-USDG PSM transaction.

Inputs: leusdAmount (required).

lends_prepare_repayLends Prepare RepayA
Read-onlyIdempotent

Construct a leUSD repayment transaction with a maximum raw amount.

Inputs: maxAmount (required), collateral (required).

lends_prepare_request_unstakeLends Prepare Request UnstakeC
Read-onlyIdempotent

Construct an sleUSD unstake-request transaction.

Inputs: shares (required).

lends_prepare_stakeLends Prepare StakeB
Read-onlyIdempotent

Construct a leUSD stake transaction with an explicit minimum sleUSD share output.

Inputs: amount (required), minSharesOut (required).

lends_prepare_withdrawLends Prepare WithdrawB
Read-onlyIdempotent

Construct a collateral withdrawal transaction.

Inputs: amount (required), collateral (required).

lends_quote_psm_swap_inLends Quote Psm Swap InB
Read-onlyIdempotent

Quote exact USDG-to-leUSD PSM conversion and current availability.

Inputs: usdgAssets (required).

lends_quote_psm_swap_outLends Quote Psm Swap OutA
Read-onlyIdempotent

Quote exact leUSD-to-USDG PSM conversion and current availability.

Inputs: leusdAmount (required).

lends_quote_stakeLends Quote StakeA
Read-onlyIdempotent

Preview sleUSD shares for a raw leUSD amount using current pool state.

Inputs: amount (required).

Tool Schema Changelog

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

    TDQS

    B3.3/5.0

    Scored across 37 tools

    Disambiguation4/5

    Tools are grouped by category (math/get/quote/prepare/assert) and mostly map to distinct resources and actions. Some overlap exists between the generic approve tool and the five purpose-specific approval tools, but descriptions are clear enough to disambiguate.

    Naming Consistency5/5

    All tools share the lends_ prefix and follow a consistent lends_<category>_<action/noun> snake_case pattern. Even long names remain predictable and readable.

    Tool Count2/5

    At 37 tools, the surface is well above the 25-tool threshold and feels heavy, especially with six approval variants and eight math helpers. The protocol scope is broad, but consolidation would make the set more manageable.

    Completeness3/5

    Core user lifecycle operations for collateral, borrowing, PSM swaps, staking, and unstaking are well covered. However, there is no prepare or execute liquidation transaction despite the presence of get_liquidation_plan, leaving a notable gap in the liquidation workflow.

    Maintenance

    ActivityInactive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • F
      license
      Not graded
      quality
      D
      maintenance
      Enables read and write access to the Celo blockchain including balance checks, token transfers, swaps, agent identity (ERC-8004), and x402 micropayments, returning unsigned transactions for user signing.
      -
    • A
      license
      A
      quality
      D
      maintenance
      Enables interaction with the DorkFi lending protocol on Voi and Algorand, supporting market discovery, position queries, liquidation scanning, and transaction preparation without signing or broadcasting.
      10
      MIT
    • A
      license
      Not graded
      quality
      B
      maintenance
      Enables agents to interact with the Pons launchpad on Robinhood Chain, providing live protocol data, token launch, trading, and wallet operations through a read-only default with explicit signing opt-in.
      56 npm
      MIT