> For the complete documentation index, see [llms.txt](https://docs.libre.org/libre-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.libre.org/libre-docs/for-developers/overview/mcp-server.md).

# MCP Server

mcp.libre.org exposes Libre's lending, DEX and account operations as typed tools for AI agents and any HTTP client — without ever holding a key.

[`mcp.libre.org`](https://mcp.libre.org) puts the whole protocol behind a set of typed tools. An agent can read market, price, account and loan state, and compose transactions, without knowing Libre's table layouts or memo formats.

**It holds no keys and signs nothing.** Composing tools hand back an unsigned proposal; signing stays with you.

## Connecting

Over MCP, in Claude Desktop or any MCP client:

```json
{ "mcpServers": { "libre": {
    "type": "streamable-http",
    "url": "https://mcp.libre.org/mcp"
} } }
```

Or over plain HTTP — one path per tool, arguments as a JSON body:

```bash
curl -X POST https://mcp.libre.org/v1/tools/get_btc_price \
  -H 'content-type: application/json' -d '{}'

curl -X POST https://mcp.libre.org/v1/tools/get_orderbook \
  -H 'content-type: application/json' -d '{"pair":"btcusdt"}'
```

Machine-readable descriptions: [OpenAPI 3.1](https://mcp.libre.org/openapi.json) · [llms.txt](https://mcp.libre.org/llms.txt)

Every tool takes an optional `network`: `"mainnet"` (default, real funds) or `"testnet"`.

## What's available

**Read** — free, no key, no signature. Chain info, account balances and permissions, BTC deposit addresses, the DEX orderbook, trades and open orders, lending pool state, loans, vaults, the redemption queue, the oracle price, and a raw table-row escape hatch.

**Compose** — returns unsigned actions plus an [ESR](https://github.com/greymass/eosio-signing-request) link. Place and cancel DEX orders, transfer tokens, withdraw BTC, create a vault, borrow, repay, withdraw collateral, lend, redeem.

**Submit** — `push_transaction` relays a transaction you already signed.

The full list with argument schemas is at [mcp.libre.org](https://mcp.libre.org).

## Prices

`get_btc_price` reads the `oracle` contract's aggregated price — the average of a round of at least three feeders agreeing within 10% — and reports how old it is, marking anything past five minutes as `stale` with a warning. That is the same price the `loan` contract uses for LTV and liquidation.

Use it rather than an exchange quote, and don't compute collateral values from a feed the tool flags as stale — the contract itself won't.

## Signing

A compose tool returns `{actions, esr, expires}`. From there:

* **A bot** signs `actions` with its own key (WharfKit) and calls `push_transaction`. Give it a `linkauth`-restricted child permission scoped to the actions it needs — never the account's owner or active key.
* **A person** opens the `esr` link in [Bitcoin Libre](https://www.bitcoinlibre.io/) or [Anchor](https://www.greymass.com/anchor), reviews the transaction there, and signs it.

Proposals expire ten minutes after they're composed.

{% hint style="warning" %}
The server never asks for a private key, and no tool accepts one. Anything claiming otherwise is not Libre.
{% endhint %}

## Rate limits

Per source IP: read tools 300/minute, compose tools 60/minute, and `push_transaction` and `request_account` 10/minute. Exceeding a limit returns `429`.

## Account safety

`get_account` reports whether an account's key appears on the list of keys known to have been generated with weak randomness by old wallet software. An agent should refuse to operate an account flagged `affected_set: true`, and treat `affected_set_checked: false` as unknown rather than safe.
