Skip to main content
Glama
LendsProtocol

lends-mcp-server

Official
README.md
# 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:

```bash
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:

```json
{
  "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"]`.

## Inputs and outputs

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

```json
{
  "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

```bash
npm ci
npm run check
npm test
npm run build
```

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

ActivityStale
ResponsivenessNo issues