MCP server
@tria-sdk/api-trading-mcp puts Tria's trading SDK behind the Model Context Protocol so Claude, Cursor, Continue, or any MCP-compatible agent can trade Hyperliquid + Decibel on the operator's behalf — with the same builder-fee attribution and thin-shim guarantee as the underlying SDK.
Why MCP instead of the raw SDK?
| Direct SDK | MCP server |
|---|---|
You write code that calls client.placeOrder(...) | You describe what you want in English; the agent picks the tool |
| Your code is a script | Your "code" is a chat session that adapts mid-flow |
| Streams via callbacks | Streams via start_stream → drain at your own pace |
| Best for deterministic bots | Best for exploratory, multi-step, agentic flows |
If you're writing a deterministic bot, use the SDK directly. If you want an LLM driving the account, use this server.
Thin-shim guarantee. Every MCP tool body is ~5 lines: zod-validate input,
call the matching TriaClient method, return JSON. No business logic lives in
the MCP layer — it cannot do anything the SDK can't. Credentials are read once
at startup and never reach the LLM.
What it exposes
- 25 trading tools in the
tria_trade_*namespace — orders, positions, account, market data, risk, helpers, and streams. See Tools & resources. - 8 resources (
tria://markets|account|positions|open-orders/{venue}) that clients like Claude Desktop and Cursor auto-include in context — the agent "just knows" your account state without spending a tool call. - Provisioning tools (gated) — a read-only
provision_inspectalways available, and a master-key-gatedprovisionwrite tool that only registers whenTRIA_TRADE_HL_MASTER_KEYis present.
Architecture
AI agent (Claude Desktop / Cursor / Continue / custom)
│ MCP over stdio (JSON-RPC 2.0)
▼
@tria-sdk/api-trading-mcp — tools + resources + stream-handle manager
│ workspace dep
▼
@tria-sdk/api-trading — TriaClient + HlVenue + DecibelVenue
│ signed L1 actions / Aptos txs
▼
HL + Decibel venues (mainnet)
Status: stdio transport only; SSE/HTTP transport and npm publish land in v1.1. Until publish, vendor the bin from the monorepo (see Quickstart).
Telemetry
The server inherits the SDK's anonymous, never-blocking usage telemetry and adds an mcp_tool funnel (which tool, destructive vs read-only, arg-validation rejections). It's on by default and never emits keys or PII. Opt out with TRIA_TRADE_TELEMETRY=0 in the server's env block — see Telemetry & privacy.