Skip to content

feat(mcp): Hyperliquid MCP server — typed trading tools over the dashboard - #129

Merged
cryptolir merged 1 commit into
mainfrom
feat/hyperliquid-mcp
Aug 19, 2026
Merged

cryptolir merged 1 commit into
mainfrom
feat/hyperliquid-mcp

Conversation

@cryptolir

Copy link
Copy Markdown
Owner

The gateway half of the Hyperliquid MCP integration. Pairs with the dashboard PR that adds /api/runtime/hyperliquid/*.

Shape: copied from Rain, deliberately

A thin typed proxy. It holds no credential, never contacts api.hyperliquid.xyz, and reads AGENTGLOB_RUNTIME_URL / AGENTGLOB_RUNTIME_TOKEN from the gateway env. The Trading Key, the owner-set caps and all signing live in the dashboard.

That split is not decorative. An agent can reach those routes directly with curl, so the MCP is not a security boundary — putting the policy behind the route is what makes it real, and this server is treated as ergonomics throughout.

Five tools, grouped

hl_market_data, hl_account, hl_place_order, hl_cancel_order, hl_set_leverage.

Grouped by kind rather than one tool per endpoint — twenty near-identical tools degrade model accuracy and enlarge the review surface for no gain.

hl_account takes no address: the server binds it from the agent record, so a tool call cannot be aimed at another account.

Failure behaviour

Cap refusals surface verbatim with their code, so the model sees cap_exceeded and stops rather than retrying differently. Missing credentials fail at startup, not as a confusing 401 on the first trade — the same trap OB-28 describes, where a skill installs fine and every call 401s with an empty bearer.

A non-JSON response is treated as a failure rather than parsed optimistically: an HTML login redirect reads as success to a naive parser, which is finding #1 from the parked plan openclaw#284.

Build

Explicit tsdown entry to dist/mcp/hyperliquid/server.js, since that config enumerates entries rather than globbing.

Verified on the built artifact: refuses to start without credentials, and returns a valid tools/list with them.

Not deployable until a new gateway image ships — the server lives inside the image.

…board

A thin typed proxy over the dashboard's runtime Hyperliquid endpoints, shaped
exactly like the Rain MCP: it holds NO credential, never contacts the exchange
directly, and reads AGENTGLOB_RUNTIME_URL / AGENTGLOB_RUNTIME_TOKEN from the
gateway env. The Trading Key, the owner-set caps and all signing live in the
dashboard, which an agent can reach directly — so this server is ergonomics,
not a security boundary, and is not treated as one.

Five tools, grouped rather than one-per-endpoint so the model picks correctly
and the review surface stays small: hl_market_data, hl_account, hl_place_order,
hl_cancel_order, hl_set_leverage. Account reads carry no address — the server
binds it — so a tool call cannot point at another account.

Cap refusals surface verbatim with their code, so the model sees cap_exceeded
and stops rather than retrying differently. Missing credentials fail at startup
rather than as a confusing 401 on the first trade.

Built via an explicit tsdown entry to dist/mcp/hyperliquid/server.js, since
that config uses explicit entries rather than a glob.

Co-Authored-By: Claude Fable 5 <[email protected]>
@cryptolir
cryptolir merged commit 0f417c0 into main Aug 19, 2026
18 of 24 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants