riv-mcp

v0.4.1
io.github.Christopher-AS/riv-mcp Checked 4 days ago Published 2 months ago

Riv MCP: spend authorization and governed trading (place_order, positions, market data, policies).

These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.

authorize Autorizar transação (Riv)

Pergunta ao Riv se uma transação é permitida ANTES de executá-la. Retorna a decisão de governança: ALLOW (siga), BLOCK (não execute), REQUIRE_APPROVAL (aguarde aprovação humana). Chame isto antes de qualquer gasto/pagamento.

ParameterTypeDescription
amount *numberValor da transação (positivo, até 2 casas decimais).
currency *stringMoeda da transação, ex.: BRL, USD.
categorystringCategoria de gasto opcional (ex.: inference, saas). Mandatos por categoria usam isto.
descriptionstringDescrição opcional da transação (para auditoria).

get_activity Consultar atividade (Riv)

Consulta o ledger do Riv. Com activityId, retorna o resultado de uma autorização específica (o id vem da resposta da tool authorize); sem activityId, retorna as atividades mais recentes do agente (extrato).

ParameterTypeDescription
activityIdstringId da atividade (UUID) retornado pela tool authorize. Omita para listar as recentes.
limitintegerQuantas atividades recentes retornar (1–50, padrão 10). Ignorado com activityId.

place_order Place trading order (Riv)

Places a perp order on the connected venue through Riv's governance layer: every order is evaluated against the organization's trading policies before any execution, and executed orders carry Riv's builder code. BLOCK and REQUIRE_APPROVAL are normal outcomes, not errors — read the Reason and ReasonCode and adapt (reduce size or leverage, switch asset, or wait for approval). ALLOW with Executed: yes means the venue accepted the order in this call. A venue rejection (HTTP 422) is ALSO a normal outcome, not an error: Execution: failed plus the venue's own reason (quoted, untrusted) — fix the…

ParameterTypeDescription
asset *stringAsset symbol, e.g. BTC.
leverage *numberLeverage multiplier, e.g. 2 for 2x.
notional *numberOrder size in USDC notional (up to 2 decimals).
orderType *stringmarket executes immediately (IoC at an aggressive price); limit rests on the book at limitPrice until filled, canceled, or expired.
side *stringOrder direction.
clientOrderIdstringIdempotency key for this order. When RETRYING the same order (timeout, unclear outcome), REUSE the exact same value — Riv will return the original outcome instead of placing a duplicate. A NEW order…
expiresAfterSecondsintegerLimit only. Cancel the resting order automatically if not filled within N seconds (server-enforced cap applies).
limitPricenumberREQUIRED for limit orders (rejected on market): the exact price submitted to the venue. Prices the venue tick cannot represent are rejected (limit_price_precision) rather than silently altered.
reduceOnlybooleanOnly reduce an existing position; exempts loss-halt policies.
tifstringLimit only. gtc (default) rests until filled/canceled; alo is post-only (maker).

get_positions Get open positions (Riv)

Lists the agent's open positions from Riv's view of the trading account (refreshed from the venue when stale; may take a few seconds). Read-only. Use it before placing or closing orders.

get_account_state Get trading account state (Riv)

Returns the agent's trading account state as Riv sees it: equity, peak equity, daily realized PnL, consecutive losses and open positions, with the asOf timestamp. This is the same state Riv's trading policies evaluate against.

get_market_data Get market data (Riv)

Fetches read-only market data for one asset on the venue: mid price, mark price, current funding rate and open interest. No custodial connection is required. Prices are in USDC.

ParameterTypeDescription
asset *stringAsset symbol, e.g. BTC.

cancel_order Cancel order (Riv)

Cancels a resting order on the venue by its venueOrderId (as returned by place_order). Requires an active venue connection; the cancellation is signed by Riv's gateway. A failed cancel (e.g. order already filled) is reported as a normal outcome, not an error.

ParameterTypeDescription
asset *stringAsset symbol of the order.
venueOrderId *integerThe venue order id returned by place_order.
clientOrderIdstringIdempotency key. REUSE the same value when retrying this exact cancel; new intent = new value. Auto-generated if omitted.

close_position Close position (Riv-governed)

Closes the agent's open position in the given asset by submitting a governed reduce-only market order in the opposite direction, sized to the full position. It goes through the exact same policy engine as place_order — BLOCK and REQUIRE_APPROVAL are normal outcomes to adapt to. If there is no open position, nothing is submitted.

ParameterTypeDescription
asset *stringAsset symbol of the position to close.
clientOrderIdstringIdempotency key. REUSE the same value when retrying this exact close; new intent = new value. Auto-generated if omitted.

list_trading_policies List trading policies (Riv)

Lists the trading policies currently in effect for this agent, with a human-readable summary of each limit: leverage caps, position size, asset allow/deny lists, loss halts, trading hours and approval thresholds. Use it to understand why an order was blocked and what would be allowed. With no policies in effect, all orders are blocked by default.