Link your agent
everything here runs from the npm package @esseyonsui/sui-mcp; no repository checkout.
Bring your own agent: its key is made on the machine it runs on and never leaves it. You approve it once on your phone with your passkey, and that one approval creates its account, sets its rules and, for a borrower, moves in its collateral.
No phone or passkey? The owner can approve from a plain wallet key with the SDK alone: see Approve from a wallet key.
1. Run init on the agent's machine#
Install @esseyonsui/sui-mcp@0.1.16 from the package.json in Install, including "overrides": { "underscore": "1.13.8" }. A bare npm install of the package prints the three high underscore advisories that page explains.
curl -s https://sui-agent-prototype-production.up.railway.app/v1/config > essey-testnet.json
npx essey-sui-init \
--api https://sui-agent-prototype-production.up.railway.app \
--network testnet \
--deployment essey-testnet.json \
--key ~/.config/essey/agent.env \
--side borrowernpx essey-sui-init --help prints the options.
| Option | What it is |
|---|---|
--api | The Essey self-serve API. |
--network | testnet (or localnet). |
--deployment | The deployment JSON: GET /v1/config saved to a file, as above. |
--key | The agent's key file. Created with mode 600 if it does not exist; reused if it does. |
--side | borrower or lender. |
--site | The site the link opens; defaults to https://essey.xyz. |
--out | Where the MCP settings go; defaults to the key file plus .mcp.env. |
--wait-s | How long init waits for your approval; 900 by default. |
--rpc | A node URL for the network, still checked against it; written to the settings as ESSEY_RPC_URL. |
Init prints the agent's address, a link and the same link as a QR code. The link works once, for 15 minutes: the code in it (what EsseyService.startSetup returns to a script) is the whole approval, the server keeps only its hash, and the first claim spends it. Keep the link out of logs and shared channels until you have claimed it.
2. Approve on your phone#
Open the link (or scan the QR). The page shows the agent's address: check that its first and last characters match what init printed. Sign in with your passkey, name the agent, pick a strategy and set its rules. Then approve: one passkey prompt. It opens the account (two for a borrower), gives the agent a key that works only inside it, writes your rules on chain and, for a borrower, moves the collateral and the interest float in from your wallet. Essey pays the gas.
3. Init writes the settings#
When the account is on chain, init checks that you hold every OwnerCap and the agent holds only its caps, then writes the MCP settings file:
ESSEY_NETWORK=testnet
ESSEY_DEPLOYMENT=…
ESSEY_AGENT_KEY_FILE=…
ESSEY_TREASURY=0x…
ESSEY_AGENT_CAP=0x…
ESSEY_CASH_TREASURY=0x… (borrower)
ESSEY_CASH_CAP=0x… (borrower)4. Add it to Claude Code#
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. The --key path from init is that file. 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.
Pass each line of the settings file as -e, as in Run it with Claude:
claude mcp add essey-sui \
-e ESSEY_NETWORK=testnet \
-e ESSEY_DEPLOYMENT=… -e ESSEY_AGENT_KEY_FILE=… \
-e ESSEY_TREASURY=0x… -e ESSEY_AGENT_CAP=0x… \
-e ESSEY_CASH_TREASURY=0x… -e ESSEY_CASH_CAP=0x… \
-- npx essey-sui-mcpAdd -e ESSEY_PRIVATE=essey-private.json (the file saved from GET /v1/private/config) for the private-flow tools.
The agent pays its own gas from SUI at its address (ESSEY_GAS, coins by default for the MCP server): in coins mode, one SUI coin object of at least 50,000,000 MIST. The public Sui testnet faucet credits the address balance, not a coin object: set ESSEY_GAS=address-balance to pay from that balance as it is, or have the owner send a coin with fundGas. The ways to fund it are in Approve from a wallet key. Approved on the phone, a lender's account starts empty: fund it from its page on the site, or over the API with the deposit action. Approved from a wallet key, create can carry the first deposit: see Fund the treasury.