Skip to main content
Glama
Pit Officer

Pit Officer

Official

Pit Officer

CI Release License

Website: officer.openpit.dev

Contact: info@openpit.dev.

Pit Officer lets you manage trading accounts, set risk limits, connect to brokers, and send orders from a web panel. The OpenPit risk engine checks each order before Officer sends it through a trading connection. You can also use Officer from trading software or AI agents.

Run

Watch the video guide or follow the steps below. The quickstart covers stopping, ports and troubleshooting.

Install Docker, then run:

docker run -d --name pit-officer --restart unless-stopped -p 127.0.0.1:8787:8787 -v pit-officer-data:/data ghcr.io/openpitkit/officer:latest

Open http://127.0.0.1:8787. latest is the newest release; your data stays in the pit-officer-data volume. Back up before every upgrade, and regularly, from Service > Database > Database backup > Export in the panel.

To upgrade an installed Officer, see Upgrade Officer.

edge is the current development build, for quick tests only. Its data is disposable. Stop the release container first, then use the same volume:

docker stop pit-officer
docker run -d --name pit-officer-edge --restart unless-stopped -p 127.0.0.1:8787:8787 -v pit-officer-data:/data ghcr.io/openpitkit/officer:edge

On its first start, the panel asks whether to copy the release data or start empty. It never changes the release database. See Trying the development build.

Related MCP server: Reins

Build

Prerequisites: a C toolchain, which the OpenPit Go binding requires through cgo; Go; and Node and npm for the dashboard bundle. Tool versions are pinned in .github/ci-versions.env; just ensure-node installs the pinned Node into .tmp/node.

From the repository root, build the dashboard before the binary so Go embeds the compiled assets:

npm --prefix web ci
npm --prefix web run build
CGO_ENABLED=1 go build -ldflags "-X go.openpit.dev/officer/framework/backend.buildCommit=$(git rev-parse HEAD)" -o pit-officer ./cmd/pit-officer

On Windows with PowerShell, set CGO_ENABLED=1 in your shell, build with go build -ldflags "-X go.openpit.dev/officer/framework/backend.buildCommit=$(git rev-parse HEAD)" -o pit-officer.exe ./cmd/pit-officer, and run ./pit-officer.exe.

Run from source

A locally built binary behaves like edge: its first serve asks which database to use, and it never changes the release database. Make that choice before running mcp.

Pit Officer is a single binary with four subcommands: serve, mcp, dashboard, healthcheck. After building it, run from the repository root:

./pit-officer serve       # serve the dashboard, REST API, and HTTP MCP
./pit-officer dashboard   # in another terminal, open the running instance
./pit-officer mcp         # alternatively, run a local stdio MCP server

The subcommands, environment variables, flags, and authorization model are in the configuration reference. See the API notes for REST and MCP integration.

Local container build

To build and run a local container image with the settings in docker-compose.yml:

. ./.github/ci-versions.env
docker build --build-arg GO_VERSION="$CI_GO" --build-arg OFFICER_COMMIT="$(git rev-parse HEAD)" -t pit-officer:local .
docker compose up

Optional Just shortcuts

Just provides a quicker alternative to the manual steps above. The recipes also require Python 3; the full check additionally uses golangci-lint and Semgrep, as described in the development notes.

just frontend-ci-install  # npm ci in web/ from the committed lockfile
just build                # build the SPA, then the pit-officer binary
just run-serve            # build and serve
just dashboard            # open the running instance in the browser
just run-mcp              # build and run a local stdio MCP server
just docker-build         # build the pit-officer:local container image
just check                # format checks, linters, Semgrep, tests, frontend bundles

Composing your own Officer from the importable packages, building against a local Pit checkout, and the debug variants are covered in the development notes.

License

Apache License 2.0. See LICENSE.

Available Tools

46 tools
apply_adjustmentA

Apply an adjustment to an account's balances of one asset through the engine and return the recorded adjustment. An agent may only lower the balance (available), held and incoming of the account's own currency, each set to a value (absolute) or changed by one (delta), given as exact decimal strings: another asset, a position included, an account without a currency of its own, a delta above zero or an absolute above the field's current value refuses the whole adjustment with loosening_refused and changes nothing, and so does an averageEntryPrice or a realizedPnl other than the current one, or any realizedPnl while the position's P&L calculation is halted, as it would restart it. A bound constrains the value the adjustment results in, not the change: a result outside it records the adjustment as rejected with a structured reason and changes no balance, a policy outcome rather than an error. An adjustment that changes nothing, such as one naming no field, is not recorded and returns no adjustment. Mutates account balances; protected and disabled by default.

Inputs: account (required), adjustment (required), missingAccount (required). Returns: adjustment

cancelA

Cancel an untouched workflow order from the signed hold approval Officer recorded at submit. Optional caller-reported leavesQuantity is recorded verbatim when supplied; the SDK receives the order's own recorded reservation remainder. After execution-report activity, submit an explicit report. Protected and disabled by default.

Inputs: id (required), reason, leavesQuantity. Returns: id, keyId, status, signedAttestation

check_orderA

Run a non-mutating pre-trade dry-run for an order: report whether it would pass the engine's risk checks plus the reasons (would-be lock prices on pass, structured rejects and any would-be account block on reject). Submits nothing and changes no state - no order is placed, no funds are reserved.

Inputs: side (required), account (required), baseAsset (required), amountKind (required), +3 more. Returns: passed, rejects, wouldBlock, wouldDisplayPrice

check_trading_connectionB

Check the venue identity and status of a trading connection. Read-only - credentials are never exposed.

Inputs: connection (required). Returns: venueStatus, venueIdentity

clear_trading_fee_accountA

Clear the Officer account receiving unlinked venue fees. The clear is refused with loosening_refused, as it moves where future venue fees are debited. Mutates Officer control-plane config; protected and disabled by default.

Inputs: connection (required). Returns: connection

confirm_executionC

Record confirmation history for a workflow order from the signed hold approval Officer recorded at submit. The shortcut is rejected after execution-report activity; protected and disabled by default.

Inputs: id (required). Returns: id, keyId, status, signedAttestation

create_accountA

Create an account with a code, an optional title and an optional realized P&L currency. Without its own currency the account inherits its group's, then the default group's; with no tier set it tracks no realized P&L. The create is refused with loosening_refused, as a new account starts unblocked, with no barrier of its own and no balance or P&L history, so it could bring back a code that was deleted or renamed away. Mutates Officer control-plane config; protected and disabled by default.

Inputs: code (required), title, currency. Returns: account

create_assetB

Create an asset with a code, an optional title and the optional code of an existing asset class. Mutates Officer control-plane config; protected and disabled by default.

Inputs: code (required), title, assetClass. Returns: asset

create_groupA

Create an account group with a code, an optional title, an optional realized P&L currency and optional notes. A member account without its own currency inherits the group's, then the default group's; without a currency the group tier stays unset. The code - is reserved for the default group and refused with validation. Mutates Officer control-plane config; protected and disabled by default.

Inputs: code (required), notes, title, currency. Returns: group

create_trading_connectionB

Create a trading connection with write-only credentials. The create is refused with loosening_refused, as a new connection widens what can be sent. Mutates Officer control-plane config; protected and disabled by default.

Inputs: mode (required), label (required), enabled (required), provider (required), +2 more. Returns: connection

delete_accountA

Delete an account. An account with dependent rows is refused with has_dependents unless force deletes them with it; a trading connection's fee account is refused with conflict, even with force. The delete is refused with loosening_refused, even with force, when the account is blocked, when it is in a blocked group or in a group with a group-scoped Spot Funds P&L bound, when it carries a rate-limit, order-size or Spot Funds P&L barrier of its own, or while any rate-limit barrier is configured. Force-deleting removes the account's venue-fee adjustments, so fees it received may be booked again to the connection's current fee account on the next restart. Mutates Officer control-plane config; protected and disabled by default.

Inputs: account (required), force. Returns: force, account

delete_assetA

Delete an asset. An asset with dependent rows, the market-data and trading instruments that reference it included, is refused with has_dependents, and so is an asset an account or group holds as its currency. The delete is refused with loosening_refused while a rate-limit or order-size barrier references the asset or a Spot Funds P&L bound is denominated in it, and always with force: force would delete the asset's dependent rows with it - balances, orders, trades, adjustments and barriers among them. Mutates Officer control-plane config; protected and disabled by default.

Inputs: asset (required), force. Returns: asset, force

delete_groupA

Delete an account group. Its member accounts leave the group and keep their trading and compliance history. The delete is refused with loosening_refused, even with force, when the group is blocked, when it carries a group-scoped Spot Funds P&L bound, or while any rate-limit barrier is configured; it is refused with currency_change_blocked, even with force, when leaving would change the effective currency of a member carrying protected state. The group's trading access grants are deleted with it; its former members keep only their own. The default group cannot be deleted. Mutates Officer control-plane config; protected and disabled by default.

Inputs: group (required), force. Returns: force, group

delete_trading_instrumentA

Delete a trading instrument mapping. The delete is refused with loosening_refused, as a mapping decides what can be sent and which asset a venue fee is booked in. Mutates Officer control-plane config; protected and disabled by default.

Inputs: connection (required), externalSymbol (required). Returns: connection, externalSymbol

get_account_stateA

Return account row and its account-scoped risk barriers, each with the fields set_limit takes, the rate window as windowMs in milliseconds. Read-only - no secrets, no order-flow control.

Inputs: account (required). Returns: limits, account

get_auditA

Return recent control-plane audit entries (default 50, max 500). Read-only - no secrets, no order-flow control.

Inputs: limit, account, category. Returns: entries

get_credential_storageA

Report whether stored credentials are sealed under the master key and, when they are not, whether trading connections or market-data sources hold keys in plain text. Read-only - credentials are never exposed.

Returns: credentialsSealed, plaintextTradingKeys, plaintextMarketDataKeys

get_limitsA

Return risk barriers and P&L-bound currencies, optionally filtered by account; each barrier has the fields set_limit takes, the rate window as windowMs in milliseconds. Read-only - no secrets, no order-flow control.

Inputs: account. Returns: limits

get_orderA

Return one order addressed by its id: its status, its 1:1 signed approval (when issued), and its fills with their display prices. Read-only - no secrets, no order-flow control. The opaque pre-trade lock is never exposed; only backend-derived display prices are.

Inputs: id (required). Returns: order, trades, approval, venueOrder

get_spot_funds_limit_modeA

Return the global Spot Funds limit mode and the accounts a Spot Funds P&L bound blocks for want of a currency. mode is enforce, which refuses an order that lacks funds or holdings, or track_only, which does not refuse on funds but records every hold, so balances and positions may go negative; until first set the mode is enforce. stored is whether the spot_funds_limit_mode policy row is stored; false means no row and the default enforce. P&L bounds, rate and order-size barriers apply in both modes. accountsWithoutCurrency lists the visible accounts with no effective realized P&L currency that a Spot Funds P&L bound applies to: their P&L halts, so the bound blocks them. Read-only - no secrets, no order-flow control.

Returns: mode, stored, accountsWithoutCurrency

get_tradingA

Read trading providers and connections. Read-only - credentials are never exposed.

Returns: providers, connections

grant_trading_accessA

Grant an Officer account access to a trading connection, or an account group where the server offers account groups. The grant is refused with loosening_refused, as it widens what can be sent. Mutates Officer control-plane config; protected and disabled by default.

Inputs: connection (required), account, accountGroup, venueAccount. Returns: account, connection, accountGroup, venueAccount

healthA

Report Pit Officer deployment health: per-node engine version, build profile and liveness, and store reachability, schema version and path. Read-only status only - exposes no secrets and no order-flow control.

Returns: node, healthy

list_accountsA

Return one page of accounts; each row is the account row of the REST account list, its block joined with its group's. Read-only - no secrets, no order-flow control. Filters: group (exact group code; an empty string selects accounts in no group), code (code or title) and blockReason (text match), status (active | blocked), position (open-position count range), pnl (P&L bounds in pnl.currency) with includeUnsetPnl and includeHaltedPnl; venue is the trading-connection filter: mode any (through at least one trading connection), none (through no connection) or connection (through the connection whose id is in connection). Sort columns: blockReason, code, group, positionCount, status, title, venueAccess. Paging: limit rows per page (default 50, capped at 500) and a 1-based page; total counts the matching rows before paging. An invalid value fails with a validation error.

Inputs: pnl, code, page, sort, +8 more. Returns: total, accounts

list_groupsA

Return one page of account groups; each row is the group row of the REST group list. The first page also carries the default group when it matches the filters, outside the limit and the total. Read-only - no secrets, no order-flow control. Filters: code (code or title), notes and blockReason (text match), status (active | blocked), position (open-position count range), account (member-account count range); venue is the trading-connection filter: mode any (through at least one trading connection), none (through no connection) or connection (through the connection whose id is in connection). Sort columns: accountCount, blockReason, code, notes, positionCount, status, title, venueAccess. Paging: limit rows per page (default 50, capped at 500) and a 1-based page; total counts the matching rows before paging. An invalid value fails with a validation error.

Inputs: code, page, sort, limit, +6 more. Returns: total, groups

list_ordersA

Return one page of orders; each row is the order row of the REST order list. Read-only - no secrets, no order-flow control. Filters: account (exact account code), source, side (buy | sell), status (order statuses), baseAsset and quoteAsset (text match), amount and price (decimal range), at (time range); venue is the trading-connection filter: mode any (through at least one trading connection), none (through no connection) or connection (through the connection whose id is in connection). Sort columns: account, amountValue, at, baseAsset, price, quoteAsset, side, source, status. Paging: limit rows per page (default 50, capped at 500) and a 1-based page; total counts the matching rows before paging. An invalid value fails with a validation error.

Inputs: at, page, side, sort, +9 more. Returns: total, orders

list_tradesA

Return one page of trades; each row is the trade row of the REST trade list. Read-only - no secrets, no order-flow control. Filters: account, baseAsset and quoteAsset (text match), id (exact trade id), side (buy | sell), source, at (time range), quantity, price and lockPrice (decimal range); venue is the trading-connection filter: mode any (through at least one trading connection), none (through no connection) or connection (through the connection whose id is in connection). Sort columns: account, at, baseAsset, lockPrice, price, quantity, quoteAsset, side, source. Paging: limit rows per page (default 50, capped at 500) and a 1-based page; total counts the matching rows before paging. An invalid value fails with a validation error.

Inputs: at, id, page, side, +10 more. Returns: total, trades

list_trading_destinationsA

List the trading destinations available to an Officer account. Read-only - credentials are never exposed.

Inputs: account (required), mode. Returns: destinations

report_fillA

Apply an execution report - a fill, a commission or a lifecycle status - to an order returned by submit_order or submit_drop_copy_order; the instrument, account and side come from the order. A report on an ordinary order is signed and attested fail-closed and returns its attestation, unsigned under eSign-off; a report on a drop-copy order stays unsigned and returns no attestation, because drop-copy never enforced a pre-trade verdict. filled and partially_filled carry a fill; rejected, rolled_back, filled and cancelled are terminal and release the order's remaining reservation. A report on a terminal order is refused with terminal_order, on a venue-linked order with venue_order_managed, and a repeated id with conflict. Mutates engine state; protected and disabled by default.

Inputs: order (required), status (required), id, price, +4 more. Returns: id, result, signed, attestationKeyId, +1 more

revoke_trading_accessA

Revoke the access of an Officer account to a trading connection, or of an account group where the server offers account groups. Revoking the last sender of a connection with no fee account on a provider with unlinked fees is refused with loosening_refused, as the connection's venue fees would then be skipped. Mutates Officer control-plane config; protected and disabled by default.

Inputs: connection (required), account, accountGroup. Returns: account, connection, accountGroup

search_trading_symbolsB

Search venue symbols for a trading connection. Read-only - credentials are never exposed.

Inputs: query (required), connection (required). Returns: matches, supported

send_live_orderA

Check, hold and send an order to a live venue, with real money. Returns the approval and acknowledged, refused or unknown send outcome. Mutating, protected and disabled by default.

Inputs: side (required), account (required), baseAsset (required), amountKind (required), +5 more. Returns: id, keyId, reasons, verdict, +2 more

send_paper_orderA

Check, hold and send an order to a paper venue. Returns the approval and acknowledged, refused or unknown send outcome. Mutating, protected and disabled by default. send_live_order is the live counterpart.

Inputs: side (required), account (required), baseAsset (required), amountKind (required), +5 more. Returns: id, keyId, reasons, verdict, +2 more

set_account_currencyA

Set or clear an account's own realized P&L currency; an empty currency clears it, so the account inherits its group's, then the default group's, and tracks no realized P&L when no tier is set. A change of the account's effective currency is refused with currency_change_blocked while the account holds any non-zero balance, position, cost-basis or P&L value, a P&L halt or an active order, or while a Spot Funds P&L bound applies to it. Mutates Officer control-plane config; protected and disabled by default.

Inputs: account (required), currency (required). Returns: account

set_limitA

Create a risk barrier, or make the one stored at the same address stricter, and return it as stored. policy names the kind - rate_limit, order_size_limit, one of the P&L-bound kill switches spot_funds_pnl_bounds_kill_switch (realized P&L), spot_funds_unrealized_pnl_bounds_kill_switch (unrealized P&L) and spot_funds_total_pnl_bounds_kill_switch (total P&L), or spot_funds_limit_mode - and the other arguments are that kind's fields; a field of another kind is refused with validation. Anything that loosens risk is refused with loosening_refused and changes nothing. A barrier that replaces the one at its address must be no looser: for rate_limit no more orders and, on the broker and asset scopes, the same window, on the account and account_asset scopes a window no shorter; for order_size_limit every current cap kept and none raised; for a P&L-bound kill switch the same currency, every current bound kept, the lower bound no lower and the upper bound no higher. A new account_underlying_asset or account_settlement_asset cap must be no higher than the underlying_asset or settlement_asset cap on the same asset that it overrides, and a new account_group or account bound must be in the currency of, and no looser than, the bound it takes over from: for a group the global bound, for an account the bound that applies to it now. The first order-size barrier is refused while any rate-limit barrier is configured. spot_funds_limit_mode is the Officer policy that decides whether Spot Funds checks funds, on the global scope only, with the one field mode: enforce (Check funds) refuses an order that lacks funds or holdings; track_only (Accounting without blocking) does not refuse on funds but records every hold, so balances and positions may go negative. Until first set the mode is enforce; the switch to track_only is refused with loosening_refused, and the switch to enforce resets no balance. P&L bounds, rate and order-size barriers apply in both modes. No barrier can be removed; to switch Spot Funds back to Check funds, set spot_funds_limit_mode with mode enforce. Mutates Officer control-plane config; protected and disabled by default.

Inputs: scope (required), policy (required), mode, asset, +10 more. Returns: rateLimit, orderSizeLimit, spotFundsLimitMode, spotFundsPnlBoundsLimit, +2 more

set_market_data_instrumentA

Enable or disable one configured market-data instrument. An enable is refused with loosening_refused, as it widens the quotes the engine prices orders with. Mutates Officer control-plane config only; protected and disabled by default.

Inputs: id (required), enabled (required), externalSymbol (required). Returns: id, enabled, externalSymbol

set_trading_connection_enabledA

Enable or disable a trading connection. An enable is refused with loosening_refused, as it widens what can be sent. Mutates Officer control-plane config; protected and disabled by default.

Inputs: enabled (required), connection (required). Returns: enabled, connection

set_trading_fee_accountA

Set the Officer account receiving unlinked venue fees. The set is refused with loosening_refused, as it moves where future venue fees are debited. Mutates Officer control-plane config; protected and disabled by default.

Inputs: account (required), connection (required). Returns: account, connection

set_trading_instrumentA

Set a trading instrument mapping. The change is refused with loosening_refused, as a mapping decides what can be sent and which asset a venue fee is booked in. Mutates Officer control-plane config; protected and disabled by default.

Inputs: enabled (required), baseAsset (required), connection (required), quoteAsset (required), +1 more. Returns: enabled, baseAsset, connection, quoteAsset, +1 more

submit_drop_copy_orderA

Submit a drop-copy order through the normal policy pipeline while ignoring policy rejects and existing account or group kill-switch blocks. Policies retain their normal state changes. The id is optional; when omitted, the store assigns it. No lifecycle event is signed. Mutates engine state; protected and disabled by default.

Inputs: side (required), account (required), baseAsset (required), amountKind (required), +5 more. Returns: id, status

submit_orderA

Submit an order intent through pre-trade and obtain an approval envelope. Mutates engine state and records the pre-trade lock; protected and disabled by default.

Inputs: mode (required), side (required), account (required), baseAsset (required), +6 more. Returns: id, keyId, reasons, verdict, +1 more

update_accountA

Change an account's code and title; the title replaces the stored one and an empty title clears it. A code change is refused with loosening_refused when the account is blocked, when it is in a blocked group or in a group with a group-scoped Spot Funds P&L bound, or when it carries a rate-limit, order-size or Spot Funds P&L barrier of its own. Mutates Officer control-plane config; protected and disabled by default.

Inputs: code (required), title (required), account (required). Returns: account

update_assetA

Change an asset's code, title and asset class; the title and the asset class replace the stored ones, and an omitted or empty one clears it. A code change is refused with loosening_refused while a rate-limit or order-size barrier references the asset or a Spot Funds P&L bound is denominated in it. Mutates Officer control-plane config; protected and disabled by default.

Inputs: code (required), asset (required), title, assetClass. Returns: asset

update_groupA

Change an account group's code and title; the title replaces the stored one and an empty title clears it. The default group cannot be changed, and the code - is reserved for it and refused with validation. Mutates Officer control-plane config; protected and disabled by default.

Inputs: code (required), group (required), title (required). Returns: group

update_trading_connectionA

Update a trading connection label or write-only credentials. A credential change is refused with loosening_refused, as it restarts the trading runtime and so brings unavailable connections back. Mutates Officer control-plane config; protected and disabled by default.

Inputs: connection (required), label, credentials. Returns: connection

verify_trading_symbolB

Verify whether a venue symbol exists and is tradable. Read-only - credentials are never exposed.

Inputs: connection (required), externalSymbol (required). Returns: exists, details, tradable, supported

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    B3.4/5.0

    Scored across 46 tools

    Disambiguation3/5

    The order lifecycle is split across many closely related tools (submit_order, check_order, send_live_order, send_paper_order, submit_drop_copy_order, report_fill, confirm_execution, cancel), which the descriptions do distinguish but which require careful reading to choose correctly. Read-side trading tools (check_trading_connection, get_trading, list_trading_destinations, search_trading_symbols, verify_trading_symbol) and risk-read tools (get_limits vs get_account_state vs get_spot_funds_limit_mode) also overlap in scope.

    Naming Consistency4/5

    Nearly all 46 tools follow a verb_noun pattern (create_account, set_limit, list_orders, delete_group, grant_trading_access). Only two deviate: the bare 'health' and the bare 'cancel', both of which are still unambiguous.

    Tool Count3/5

    46 tools is heavy for a single server, though the domain genuinely spans accounts, groups, assets, connections, instruments, limits, orders and trades. Several read tools could be consolidated (multiple get_* risk and trading readers), but most tools map to real operations rather than filler.

    Completeness3/5

    Core trading lifecycle and most entity CRUD are covered, but there are notable gaps: no list_assets/get_asset, no read/list for trading or market-data instruments (only set/delete), and no position inspection tools despite positions being referenced throughout. Agents can work around some of this via get_account_state, but the asset and instrument surfaces are write-only.

    Maintenance

    ActivityActive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      C
      maintenance
      Enables AI agents to securely call MCP tools with risk scoring, checkpoints, rollback, and approval workflows.
      7 npm
      MIT
    • A
      license
      A
      quality
      B
      maintenance
      Enables AI agents to place and manage Hyperliquid trades through MCP with position, leverage, daily-loss, market, and stop-loss limits enforced outside the model, plus paper trading and an auditable decision log.
      9
      104 npm
      MIT
    • A
      license
      Not graded
      quality
      B
      maintenance
      Enables AI trading agents to submit proposed trades for deterministic pre-execution risk evaluation, returning allow/warn/deny decisions, risk scores, and tamper-evident audit hashes. It also supports token safety checks, balance simulation, asset registry lookup, and audit trail verification.
      MIT