LIVE · SDK 0.3.0

Docs · Quickstart

DOCS · QUICKSTART

Quickstart

Install the published packages, start the MCP server and verify a receipt. Simulation and receipt checks need no API key or exchange keys.

Node 22.6 or newer is requiredCheck with node -v. On Node 20 or older, or Node 22.0–22.5, the examples stop with node: bad option: --experimental-strip-types; upgrade Node to fix it. On Node 22 a harmless ExperimentalWarning: Type Stripping line is printed.

1 · Install

pip install perpbrain
npm install @perpbrain/sdk

The current release is 0.3.0 on PyPI and npm. pip install perpbrain also installs perpbrain-read. The TypeScript package is @perpbrain/sdk.

Start the MCP server with the Python CLI:

perpbrain mcp

The launcher starts the stdio MCP server. To smoke-test it, pipe an initialize request followed by tools/list into it; it lists the 14 tools. Live reads use the public Hyperliquid /info endpoint, mainnet by default. Set PERPBRAIN_HL_NETWORK=testnet for testnet.

The example commands below run from a clone of the public SDK repo, which includes the examples and fixtures. You can also verify a receipt in the browser.

git clone https://github.com/PERPBRAIN/perpbrain-sdk.git
cd perpbrain-sdk

2 · Check a receipt

node --experimental-strip-types examples/verify-receipt.ts fixtures/receipts/good
# {"dir":"fixtures/receipts/good","status":"VERIFIED","mismatches":[]}

VERIFIED means every hash re-derived from the inputs matches. Try a tampered fixture to see a precise mismatch and exit code 1:

node --experimental-strip-types examples/verify-receipt.ts fixtures/receipts/tampered-result
# "status":"MISMATCH","mismatches":["result_sha256 mismatch","result.fills[0].price mismatch"]

3 · Simulate under your limits

node --experimental-strip-types examples/guarded-simulate.ts

It simulates one decision under the Standard preset, then shows a looser 9x leverage blocked before a fill is recorded. Output is labelled SIMULATED. See owner limits.

4 · Drive the MCP handler

node --experimental-strip-types examples/mcp-fixtures.ts

It calls the read and simulation tools on recorded public data. submit_order is refused.

Work on the SDK itself

To contribute, clone the public SDK repo or the monorepo and build from source. @perpbrain/sdk 0.3.0 is already on npm, so most users should install the published package instead.

git clone https://github.com/PERPBRAIN/perpbrain-sdk.git
(cd perpbrain-sdk/sdk && npm ci && npm run build)

npm run build writes ESM and CommonJS builds to sdk/dist.

Simulation onlyResults are labelled SIMULATED and no order is placed. Limits you set; losses are still possible.