Docs · MCP usage
DOCS · MCP
MCP usage
The SDK ships an stdio MCP server built on the official @modelcontextprotocol/sdk. Any agent can read public Hyperliquid data, simulate against a supplied book and check receipts. It is keyless and has no order tool.
The 14 tools
Registered tool names, in list order:
| Tool | What it does |
|---|---|
markets | List perpetual markets from the public info endpoint. |
order_book | Read a capped order book and its data age. |
funding | Read funding, mark and open interest for one coin. |
positions | Read positions for one address. |
fees | Read the address fee rates and their data age. |
simulate | Simulate a closed-bar decision on a supplied book. Result is SIMULATED. |
funding_extremes | Z-score of the public hourly funding rate against a trailing window. |
book_imbalance | Bid depth divided by ask depth inside a public-book band. |
get_limits | Read the owner limits and the remaining headroom. |
trigger_kill_switch | Latch the kill switch. A tool call cannot clear it. |
get_cost_breakdown | Recompute the execution-cost breakdown from a simulation receipt. Result is SIMULATED. |
paper | Read the live public book and funding for one coin, then run the guarded simulator. Result is SIMULATED; no keys, no order. |
link_fills | Link an account's real fills (by order id, fill hash or client order id) to a simulation receipt. Gives back a hash-bound link record with fill ratio, slippage and fee drag against the simulation. Reads public fill history only. |
holding_receipt | Build a holding-period receipt for one coin from supplied fills and funding rows: entry and exit fill linkage plus an account-level funding sum. Tamper-evidence only: the rows are not authenticated to the venue or account, and the simulation receipt is not verified here, so the record is capped at PROVISIONAL. Read-only, no keys, no orders. |
submit_order and any other order tool is refused.
Connect a client
No API key, wallet or secret is required. The examples below start the published 0.3.0 server over stdio. Use uvx perpbrain==0.3.0 mcp (Python) or npx -y -p @perpbrain/sdk perpbrain-mcp (Node). Optional: set PERPBRAIN_HL_NETWORK to testnet; it defaults to mainnet public data. There is no order tool.
PerpBrain is listed in the official MCP Registry as io.github.PERPBRAIN/perpbrain, with the PyPI package perpbrain and the npm package @perpbrain/sdk. Each release is listed automatically.
Claude Desktop
Open claude_desktop_config.json (macOS: ~/Library/Application Support/Claude/claude_desktop_config.json) and add:
{
"mcpServers": {
"perpbrain": {
"command": "uvx",
"args": ["perpbrain==0.3.0", "mcp"]
}
}
}Cursor
Create .cursor/mcp.json in your project, or add a server under Cursor Settings → MCP, with the same shape:
{
"mcpServers": {
"perpbrain": {
"command": "uvx",
"args": ["perpbrain==0.3.0", "mcp"]
}
}
}To use the npm launcher instead, set command to npx and args to ["-y", "-p", "@perpbrain/sdk", "perpbrain-mcp"].
Claude Code
claude mcp add perpbrain -- uvx perpbrain==0.3.0 mcpVS Code / GitHub Copilot
Add a server in .vscode/mcp.json:
{
"servers": {
"perpbrain": {
"command": "uvx",
"args": ["perpbrain==0.3.0", "mcp"]
}
}
}Cline, Windsurf and other stdio MCP clients
Use the same command as Claude Desktop: a stdio server with command uvx and args ["perpbrain==0.3.0", "mcp"], and no secrets. Windsurf uses ~/.codeium/windsurf/mcp_config.json; Cline uses its MCP settings JSON. The 14 tools are reads and simulations only.
From a clone, you can still run cd ts/mcp-server && npm ci (Node 22.6 or newer) and point command at node with args ["/absolute/path/to/perpbrain-sdk/bin/perpbrain-mcp.mjs"].
A first prompt flow
- Call
get_limitsand note the headroom. - Call
simulateon a supplied book. The result is labelledSIMULATED. - Call
get_cost_breakdownon the receipt for fees, slippage and funding. - Call
verify_receipt. A match reportsVERIFIED.
The offline version of this flow is node --experimental-strip-types examples/mcp-fixtures.ts.