SDK/MCP

Configuration

PREVIEW

The server is configured only through environment variables.

Variable
ESSEY_NETWORKlocalnet or testnet (the value mainnet exists; Essey has no mainnet deployment). Required.
ESSEY_DEPLOYMENTPath to the deployment JSON: GET /v1/config saved to a file, or a record of the same shape. Required.
ESSEY_AGENT_KEY_FILEThe agent's key file, mode 600. Required, with no default path. The only key setting. Loaded before the server starts, including tools/list.
ESSEY_TREASURY, ESSEY_AGENT_CAPOptional. The agent's treasury and cap: both, or neither. With neither, only the private tools run. Lending tools refuse until the owner has set up the account.
ESSEY_CASH_TREASURY, ESSEY_CASH_CAPA borrower's cash treasury and cap: both together, and only with the two above.
ESSEY_GAScoins (default) or address-balance.
ESSEY_BORROW_ALLOWANCEA borrower's borrowing allowance, a whole number in the loan coin's smallest unit. essey_owner_deposit puts it in the borrow rules it builds; it is never a tool input, and a borrower deposit with collateral is refused without it.
ESSEY_RPC_URL, ESSEY_GRAPHQL_URLOptional overrides, still checked against the network.
ESSEY_REPAY_LEAD_MSUpkeep: how long before an offer loan matures it is repaid, in milliseconds. Default and minimum: the hosted borrower's margin.
ESSEY_AUTO_TOP_UPUpkeep: on or off (default off). Adds spare SUI to a loan near its safety line.
ESSEY_AUTO_CLAIMUpkeep: on (default) or off. Brings home what a closed loan left.
ESSEY_PRIVATEPath to the private-flow ids: GET /v1/private/config saved to a file (whole, or its private field), or the flat ids file (packages, Access, PassKey, coin types, loanMarkets). With it set, the server adds the private-flow tools.
ESSEY_SHIELDED_STATEOptional path to the shielded seed file. Unset or empty is null, and a shielded tool asks you to set it before essey_shielded_init. That tool writes { "v": 1, "seed": "<64 hex characters>" } there, mode 600, and never returns the seed. A later init keeps the file that is already there. A file that is not that v1 shape is refused when a tool reads it.
ESSEY_STATEOptional path. Unset or empty is null. essey_owner_setup_result writes the owner-setup env lines there, mode 600: ESSEY_TREASURY, ESSEY_AGENT_CAP, and for a borrower ESSEY_CASH_TREASURY and ESSEY_CASH_CAP. The running server does not read or reload that file. Restart with those lines in the environment.

The server requires an agent key file before it starts, even to list its tools. It reads the path only from ESSEY_AGENT_KEY_FILE. That variable is required and has no default. From the project that installed the packages, this writes a mode-600 testnet file and prints the new address:

Shell
node --input-type=module -e "import { createAgentKeyFile } from '@esseyonsui/sui-sdk'; console.log(createAgentKeyFile('agent.env', 'testnet'))"

Point the server at it with ESSEY_AGENT_KEY_FILE=agent.env. essey-sui-init --key writes the same kind of file when that path is missing.

A process with no ESSEY_TREASURY has no lending account. It can still run the private tools when ESSEY_PRIVATE is set. Shielded tools also need ESSEY_SHIELDED_STATE. ESSEY_STATE is only the file the setup result is written to.

What stops the server#

Before it serves anything, the server refuses to start — writes the reason to stderr and exits with status 1 — if:

  • an ESSEY_* name contains OWNER — there is no owner setting, and this is checked before the known list;
  • any other ESSEY_* name is not in the known list: ESSEY_NETWORK, ESSEY_RPC_URL, ESSEY_GRAPHQL_URL, ESSEY_DEPLOYMENT, ESSEY_AGENT_KEY_FILE, ESSEY_TREASURY, ESSEY_AGENT_CAP, ESSEY_CASH_TREASURY, ESSEY_CASH_CAP, ESSEY_GAS, ESSEY_BORROW_ALLOWANCE, ESSEY_REPAY_LEAD_MS, ESSEY_AUTO_TOP_UP, ESSEY_AUTO_CLAIM, ESSEY_PRIVATE, ESSEY_SHIELDED_STATE, ESSEY_STATE. A name outside that list is refused. ESSEY_SHIELDED_STATE and ESSEY_STATE are in it, so setting them does not stop the server. Names that do not start with ESSEY_ are not inspected;
  • any ESSEY_* value holds a private key (suiprivkey… or PRIVATE_KEY) — the key goes only in its file; the ESSEY_PRIVATE file is refused the same way if it holds key material;
  • a required variable is missing, or a pair is half set;
  • the network refuses (wrong host, wrong chain, or a node answering for mainnet on a localnet or testnet setting);
  • the key file is refused;
  • the key-separation check fails.

Every signing tool runs the key-separation check again before it signs, and every owner tool reads the OwnerCaps from it.

On a good start it writes one line to stderr — essey-sui-mcp: agent <address> on <network>, keys separate — and keeps stdout for MCP only.

The upkeep settings are the owner's choice. The agent can only ask essey_upkeep for a dry run.