QMax for AI agents
QMax finds the best price for a trade on Qubic by comparing the QX order book with the QSwap pool and splitting an order across both. Its API is free. These two downloads put it in an agent's hands: an MCP server for any MCP client, and a TypeScript SDK for your own code. Neither holds anyone's keys, and QMax never trades for you: an agent signs its own trades, inside limits it sets.
MCP server
One file, run with Node 22 or newer. It talks to https://qmax.exchange/api unless you set QMAX_API_URL.
curl -O https://qmax.exchange/agents/qmax-mcp.mjs
node qmax-mcp.mjs # speaks MCP on stdio
Add it to an MCP client, for example Claude Desktop (claude_desktop_config.json) or Claude Code:
{ "mcpServers": { "qmax": { "command": "node", "args": ["/path/to/qmax-mcp.mjs"] } } }
It offers tools for: assets, quotes across QX and QSwap, order books, candles, price history, arbitrage checks, pools, asset health, the live trade tape, wallet ledgers, backtests and
unsigned trade plans (qmax_build_plan). Every tool is read-only: none signs or sends anything.
| Setting | What it does |
|---|---|
QMAX_API_URL | Where the QMax API is. Default: https://qmax.exchange/api. |
QMAX_API_KEY | A prepaid QMax key, if you have one. Pays for Max plans from its balance. |
QMAX_AGENT_SEED | Optional. Lets the server buy an x402 session when a call needs paying (a Max plan). This spends real QU from that wallet. |
QMAX_MAX_SPEND_QU | The most QU the server will ever pay for sessions. Default 30,000. |
One tool costs money: qmax_best_position (Max, the best position for a trade) is 100 QU per plan, from a prepaid key's balance or free inside an x402 session. Everything
else is free. If you set QMAX_AGENT_SEED, use a wallet that holds only what the agent may spend, and keep the seed in the environment, never in a file or a chat.
TypeScript SDK
An npm package (types included), served from this site. It is also available as one neutral ES module file, qmax-sdk.js, for any runtime.
npm install https://qmax.exchange/agents/qmax-sdk.tgz
import { QMaxClient } from "@qmax/sdk";
const qmax = new QMaxClient({ baseUrl: "https://qmax.exchange/api" });
const quote = await qmax.quote({ side: "buy", asset: "QDOGE", qty: 1_000_000 });
quote.route; // the cheapest way to fill it across QX and QSwap, each leg with its limits
For an agent that trades, @qmax/sdk/agent (Node only) quotes, checks the plan against limits you set (maxOutlayQu is required), signs with the agent's own
seed and sends each step; it can only call QX and QSwap, and its x402 payer can only pay QPayhub. The package's README has the full example.
Check what you downloaded
curl -O https://qmax.exchange/agents/SHA256SUMS
shasum -a 256 -c SHA256SUMS
SHA256SUMS lists the hash of each file here. Run a file you downloaded only if its hash matches.
How the payment works
QMax follows Q+Pay's x402 format (network qubic:mainnet, settled through QPayhub). A request that needs paying is answered with a 402 that names the price and the exact
payment; a client pays and repeats the request. The offer is public. QPayhub keeps at least 100 QU of every payment, so a payment per call is not offered: prepay a key
(a top-up of 10,000 QU buys 100 Max plans) or buy a session. The details, with the live prices, are in /llms.txt.