Configuration
The server is configured only through environment variables.
| Variable | |
|---|---|
ESSEY_NETWORK | localnet or testnet (the value mainnet exists; Essey has no mainnet deployment). Required. |
ESSEY_DEPLOYMENT | Path to the deployment JSON: GET /v1/config saved to a file, or a record of the same shape. Required. |
ESSEY_AGENT_KEY_FILE | The 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_CAP | Optional. 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_CAP | A borrower's cash treasury and cap: both together, and only with the two above. |
ESSEY_GAS | coins (default) or address-balance. |
ESSEY_BORROW_ALLOWANCE | A 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_URL | Optional overrides, still checked against the network. |
ESSEY_REPAY_LEAD_MS | Upkeep: how long before an offer loan matures it is repaid, in milliseconds. Default and minimum: the hosted borrower's margin. |
ESSEY_AUTO_TOP_UP | Upkeep: on or off (default off). Adds spare SUI to a loan near its safety line. |
ESSEY_AUTO_CLAIM | Upkeep: on (default) or off. Brings home what a closed loan left. |
ESSEY_PRIVATE | Path 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_STATE | Optional 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_STATE | Optional 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:
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 containsOWNER— 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_STATEandESSEY_STATEare in it, so setting them does not stop the server. Names that do not start withESSEY_are not inspected; - any
ESSEY_*value holds a private key (suiprivkey…orPRIVATE_KEY) — the key goes only in its file; theESSEY_PRIVATEfile 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
localnetortestnetsetting); - 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.