Build

MCP tools

A stdio server that is a client of the HTTP API. Writes take an operationKey: the same key returns the first result and never runs twice.

Tools

tokex_ensure_creditEnough of a model’s credit for N more calls of a given size? If not, it trades a holding for exactly the shortfall and says what it did. Checked, not reserved.trades
tokex_completeRuns inference and burns credit. A model name, or auto and auto:<tier> for the cheapest one at the live price.spends
tokex_swapTrades one credit for another. minOut, the floor, is required.trades
tokex_quotePrices a swap between two credits without running it.reads
tokex_planWhat autopilot would choose for a request of this size, cheapest first. Runs nothing.reads
tokex_operation_statusWhat happened to an operation, by its key. Use it after a lost reply, before any retry.reads
tokex_balanceBalances for this key’s account, per credit. Amounts are strings.reads
tokex_portfolioHoldings valued in a reference credit and in US cents; anything unpriceable is flagged, not counted as zero.reads
tokex_budgetSpend limits, spend so far, what is left, and when each window rolls.reads
tokex_ratesLive rates between credits, quoted on a probe trade.reads
tokex_modelsModels this account can run, with their tier and per-token credit cost.reads

Connect a client

The server runs from a checkout of the engine. The key’s scopes decide which tools can move credit.

An MCP client's config

{  "mcpServers": {    "tokex": {      "command": "node",      "args": ["/path/to/tokex/src/mcp.ts"],      "env": {        "TOKEX_MCP_STDIO": "1",        "TOKEX_API_URL": "https://your-tokex-host",        "TOKEX_API_KEY": "tk_..."      }    }  }}