Encumbra
Menu

Agent credit

Credit lines your agents can draw on

Pre-launch on Base Sepolia. Lines run on test tokens.

What your agent signs

Your agent needs three things: its own wallet, a line an owner opened for it, and a way to sign. It agrees to the line once, then signs for what it spends. It never sends a transaction to pay, and its key never leaves it.

Consent to a line OpenConsent
Opens one line with exactly these terms, for one owner, once, before its deadline (a day at most). The agent can cancel it unused.
A charge Charge
One amount on one line at the line's current nonce, for an hour by default. The provider submits it; it cannot be replayed.
A voucher Voucher
A running total for one line. The agent can never owe more than the highest total it signed, and each voucher expires.

Connect over MCP

Point any MCP client at the Encumbra server to read lines and prepare signatures and transactions. The server holds no keys: your agent's wallet signs. The 23 tools.

Anonymous
https://mcp.encumbra.ai/mcp
Signed in with GitHub
https://mcp.encumbra.ai/mcp/auth
Claude Code
# Anonymous
claude mcp add --transport http encumbra https://mcp.encumbra.ai/mcp

# Signed in: add this URL instead, then run /mcp in Claude Code to sign in with GitHub
claude mcp add --transport http encumbra https://mcp.encumbra.ai/mcp/auth
Cursor, or any client that takes a JSON server list
{
  "mcpServers": {
    "encumbra": {
      "url": "https://mcp.encumbra.ai/mcp"
    }
  }
}

For an agent: available and is_serviceable read the line, prepare_open_consent and prepare_charge_auth return the typed data it signs.

Read the line

@encumbra/sdk is a viem client for the contract. Check room before spending: a frozen, past due or full line has none. SDK reference.

Reads only; the agent's key stays with the agent.
import { createPublicClient, http } from "viem";
import { EncumbraClient } from "@encumbra/sdk";

const CHAIN_ID = 84532; // Base Sepolia
const ENCUMBRA = "0x... EncumbraLien"; // EncumbraLien
const publicClient = createPublicClient({ transport: http(process.env.RPC_URL) });
const encumbra = new EncumbraClient({ publicClient, address: ENCUMBRA, chainId: CHAIN_ID });

const LIEN_ID = 1n; // the line the owner opened for this agent
const room = await encumbra.available(LIEN_ID); // smallest units of the debt token; 0 when frozen, past due or full
const serviceable = await encumbra.isServiceable(LIEN_ID);
const nonce = await encumbra.chargeNonce(LIEN_ID); // the next per-draw authorization signs this nonce

Authorize each draw

For a provider that settles each request on the spot (x402 scheme encumbra-lien): the agent signs a Charge for the price; the provider submits chargeWithAuth. Per-draw authorization.

Sign one draw. The nonce makes it one request at a time per line.
import { createPublicClient, http, type Hex } from "viem";
import { privateKeyToAccount } from "viem/accounts";
import { EncumbraClient } from "@encumbra/sdk";

const CHAIN_ID = 84532; // Base Sepolia
const ENCUMBRA = "0x... EncumbraLien"; // EncumbraLien
const publicClient = createPublicClient({ transport: http(process.env.RPC_URL) });
// The agent's own key. Keep it in a secret store; it never leaves the agent.
const agent = privateKeyToAccount(process.env.AGENT_KEY as Hex);
const encumbra = new EncumbraClient({ publicClient, address: ENCUMBRA, chainId: CHAIN_ID });

const LIEN_ID = 1n;
const amount = 250_000n; // the provider's price, in smallest units of the debt token

// Charge(lienId, amount, nonce, deadline) at the line's current nonce, valid for an hour.
const typed = await encumbra.buildChargeAuth(LIEN_ID, amount);
const signature = await agent.signTypedData(typed);

// x402 encumbra-lien: the payment rides in the PAYMENT-SIGNATURE header. The provider checks
// it and submits chargeWithAuth(lienId, amount, deadline, signature) from its own wallet.
const payload = {
  lienId: LIEN_ID.toString(),
  nonce: typed.message.nonce.toString(),
  deadline: typed.message.deadline.toString(),
  signature,
};

Pay per request with vouchers

For metered use (scheme encumbra-voucher): one signature per request, no transaction. The provider settles the latest voucher later. Metered settlement over x402.

Sign the next voucher for each request.
import { keccak256, toHex, type Hex } from "viem";
import { privateKeyToAccount } from "viem/accounts";

const CHAIN_ID = 84532; // Base Sepolia
const ENCUMBRA = "0x... EncumbraLien"; // EncumbraLien
// The agent's own key. Keep it in a secret store; it never leaves the agent.
const agent = privateKeyToAccount(process.env.AGENT_KEY as Hex);

// Voucher(lienId, cumulativeAmount, deadline, ref), as EncumbraLien declares it.
const VOUCHER_TYPES = {
  Voucher: [
    { name: "lienId", type: "uint256" },
    { name: "cumulativeAmount", type: "uint256" },
    { name: "deadline", type: "uint256" },
    { name: "ref", type: "bytes32" },
  ],
} as const;
const domain = { name: "Encumbra", version: "1", chainId: CHAIN_ID, verifyingContract: ENCUMBRA } as const;

const LIEN_ID = 1n;
let total = 0n; // the running total this agent has signed for this line and provider

/** Signs the next voucher: the running total raised by this request's price. */
async function nextVoucher(price: bigint, requestUrl: string) {
  total += price;
  const deadline = BigInt(Math.floor(Date.now() / 1000) + 3600);
  const ref = keccak256(toHex(requestUrl)); // any 32 bytes the provider can match to the request
  const signature = await agent.signTypedData({
    domain,
    types: VOUCHER_TYPES,
    primaryType: "Voucher",
    message: { lienId: LIEN_ID, cumulativeAmount: total, deadline, ref },
  });
  // x402 encumbra-voucher payload. The agent can never owe more than the highest total it signed.
  return { lienId: LIEN_ID.toString(), cumulative: total.toString(), deadline: deadline.toString(), ref, signature };
}