MCP
hardbasis mcp serves every CLI command as an MCP tool over stdio. A tool call runs through the same dispatcher as the CLI and sends identical bytes. Install the CLI first (Install).
Start it
Claude Code:
claude mcp add hardbasis -- hardbasis mcp
claude mcp add hardbasis -- hardbasis mcp --confirm ack # the desktop app's Code tabClaude Desktop, Cursor and Gemini CLI take the same entry, each in its own file (untested in these clients; only Claude Code is measured):
| client | config file |
|---|---|
| Claude Desktop | macOS ~/Library/Application Support/Claude/claude_desktop_config.json; Windows %APPDATA%\Claude\claude_desktop_config.json; or Settings, Developer, Edit Config |
| Cursor | project .cursor/mcp.json, or global ~/.cursor/mcp.json |
| Gemini CLI | ~/.gemini/settings.json |
{ "mcpServers": { "hardbasis": { "command": "hardbasis", "args": ["mcp"] } } }Codex (~/.codex/config.toml, untested):
[mcp_servers.hardbasis]
command = "hardbasis"
args = ["mcp"]Grok Bot (xAI, x.com/bot, untested): it runs on xAI's cloud computer and has no config file. Ask it in chat to add a custom server with this start command, and give it HARDBASIS_API_KEY as an environment variable on the server entry. A localhost server does not work there.
npx -y @hardbasis/cli mcp --confirm ackFrom a source checkout without the binary installed:
claude mcp add hardbasis -- pnpm --silent --dir "$PWD" exec tsx src/cli/main.ts mcpClient matrix
Measured by sending one acknowledged testnet write through each client.
| client | advertises elicitation | renders prompt | --confirm |
|---|---|---|---|
| Claude Code desktop app (Code tab) | yes | no (declines in about 10 ms) | ack |
claude CLI 2.1.310, interactive terminal | yes | yes | elicit |
| Claude Desktop (chat) | untested | untested | elicit until measured |
| Grok Bot (xAI) | untested | untested | ack until measured |
Where the prompt does not render, run --confirm ack and treat the agent's acknowledgement as the only gate.
Tool groups
Tools are named hb_<group>_<verb>. Which groups a server exposes depends on whether a key is configured:
| group | default, no key | default, with key | --groups all |
|---|---|---|---|
| markets, public, por, health, deployment | yes | yes | yes |
| account, positions, orders, cancel-all-after, fills, funding, limits, sessions, usdhb, withdrawals, deposits, deposit-invoices, liquidations | no | yes | yes |
| referral, promoter, leaderboard, faucet, signup | no | no | yes |
--groups g1,g2 serves exactly the groups you name. Read tools carry readOnlyHint: true; write, funds and credential tools carry destructiveHint: true and the description prefix [WRITE: requires acknowledged=true].
The two gates
- The agent. A write tool refuses with
cli_ack_requiredunless the call carriesacknowledged: true. The agent sets it only when you asked for that exact action. - You. When the client supports MCP elicitation, the server shows a one-line summary and one required choice with no default. Only the affirmative choice (
place order,cancel order,send,mint,redeem) sends the write.
dryRun: true sends nothing and needs neither gate.
A refused call
The agent calls hb_orders_create without the flag:
{
"marketId": "btc-usd",
"side": "buy",
"type": "limit",
"limitPriceQ8": "5000000000000",
"contracts": "1"
}Nothing is sent, and the result is:
{
"code": "cli_ack_required",
"error": "hb_orders_create is write-class: nothing was sent. Call again with acknowledged=true only if the user explicitly asked for it."
}An accepted call
You asked for one btc-usd contract, bought at a limit of 50000.00. The agent calls again with "acknowledged": true. In a client that renders prompts you see:
BUY 1 contract btc-usd, limit 50,000.00
action: place order | do not placePick place order and the order is sent; the result is the venue's order body.
Elicit or ack
| client answer | result | what the agent should do |
|---|---|---|
| the affirmative choice | the write is sent | report the result |
| decline, cancel, or another value | cli_user_declined | stop; retry only if you ask again |
| no answer within the timeout | cli_user_declined | stop; retry only if you ask again |
| decline in under 500 ms | cli_confirm_not_rendered | tell you the prompt never showed; suggest --confirm ack |
| no elicitation support | the write is sent, with a note | relay the note to you |
--confirm elicit(the default) asks you per write, as above.--confirm ackmakes the agent'sacknowledgedthe only gate, on purpose, and the server says so in its instructions. Use it for clients that cannot render prompts (the matrix above).- For a mint, redeem or withdrawal, the prompt is built from the quote the server returned. If a mint or redeem quote expires while you read it, the server re-quotes once after you confirm and proceeds only within the venue's served
requoteToleranceQ9; a larger change asks you again.
Autopilot
hardbasis mcp --autopilotAutopilot runs writes without either gate. In exchange the server arms cancel-all-after at start, re-arms it every 30 s, and disarms it on clean shutdown, so a crashed or hung agent leaves no resting orders. Funds and credential tools stay out of reach.
It is testnet only. On mainnet it is refused with cli_autopilot_requires_limits: an unattended agent on real money needs limits the venue enforces per key, and those are not served yet (R-AP-10).
The audit stream
The server writes one JSON line per event to stderr:
server_start: network, groups, tool count,autopilot,confirm_mode(elicitorack),elicitation(availableorunavailable), and the detected client.tool_call: tool, group, effect, the money fields, and for writesconfirm(confirmed,declined,not_rendered,timeout,unavailable,ackorautopilot) withconfirmMs.tool_result: whether it succeeded, and the errorcodeif not.
HARDBASIS_MCP_AUDIT=off disables it. Keys never appear beyond hb_...<last4>.