Repository navigation
feat(mcp): Hyperliquid MCP server — typed trading tools over the dashboard - #129
Merged
Merged
Conversation
…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]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 readsAGENTGLOB_RUNTIME_URL/AGENTGLOB_RUNTIME_TOKENfrom 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
kindrather than one tool per endpoint — twenty near-identical tools degrade model accuracy and enlarge the review surface for no gain.hl_accounttakes 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_exceededand 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
tsdownentry todist/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/listwith them.Not deployable until a new gateway image ships — the server lives inside the image.