nexus-exchange-mcp
OfficialOne-line summary: An MCP server exposing the Nexus Exchange REST API so an AI agent can read live market data and manage accounts, trading, funding, bridging, delegated agents, and API keys.
Public market data (no credentials): market summaries, static market specs, single/all tickers, order books, mark price, market status, recent trades, OHLCV candles, funding-rate history, dense funding samples, risk parameters, venue stats and stats history, and aggregate service status.
Demo endpoints (no credentials): a public demo account snapshot with its positions and open orders, useful for showing the account flow before keys exist.
Account and portfolio reads (HMAC key): balance/equity/positions, portfolio summary, full account state in one coherent read, effective fee schedule, portfolio history (equity + PnL + volume windows), equity history, open positions, closed positions, open orders, a single order, order history, fills, funding payments, withdrawals, deposits, rate-limit budget, and ADL history/events.
Trading (HMAC key): place limit, market, stop-loss, take-profit, and trailing orders; batch-submit 1–100 orders; amend price/size atomically; preview margin/fee impact without submitting; cancel one order (with market routing).
Mass cancel: cancel all open orders, optionally scoped to one market, guarded by an explicit
cancel_all: true.Funds and margin: deposit USDX collateral, submit a listable ledger deposit, adjust isolated margin (add/remove) on an open position.
Faucet/credit: claim fixed-amount testnet faucet USDX, or claim credit up to a per-key daily allowance.
Cross-chain bridge: list bridgeable chains/assets; list and fetch bridge deposits; create/list per-chain deposit addresses (deprecated — no route served); withdraw-wallet challenge, registration (one wallet per account,
confirm: true), and listing.Cancel-on-disconnect: read and set the account's dead-man's-switch (requires explicit
enabled).Delegated agents: list agent keys; register one via an owner-wallet EIP-712 signature; revoke one with
confirm: true.Wallet login and API keys (session token): sign in with an EIP-191 wallet signature for a 24h session token, then list, create, or delete HMAC API keys (delete guarded by
confirm: true).WebSockets: mint 60s single-use tokens for the authenticated
/wsstream or legacy/stream, returning thews_endpointso no host is guessed (it deliberately does not hold a streaming socket open itself).Not available: the admin tier tools (registered only behind an opt-in flag and not present in this schema), real-money
mainnet(no reachable host), andget_deposit_target, which returns a clearnot_yet_availableinstead of faking a result.Auth and safety model: public reads need nothing; trading/account tools need HMAC credentials from env or a shared credential file; irreversible tools need declared funds (
real/play) and explicitconfirm: trueflags; network is selected viatestnet(default),local,mainnet(error), or acustombundle, and credentials never cross networks.Naming note: the schema registers legacy tool names (
list_markets,place_order,get_candles, …) as deprecated aliases that forward to the canonicalfetch_*/create_orderhandlers described in the README.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@nexus-exchange-mcp What's the current BTC-USDX-PERP ticker on Nexus?"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Nexus Exchange MCP Server
This repository is archived and no longer maintained. The Nexus Exchange API it was built for is being shut down, and no further releases will be published.
An MCP server that exposes the Nexus Exchange API as tools an AI agent (Claude Desktop / Claude Code) can call to read market data and place trades.
It talks to the real, public exchange gateway. Market-data and demo tools work with zero configuration; account and trading tools use HMAC API credentials read from environment variables.
What works today
Every tool sends the spec's bare path (/orders) to one REST base: the spec's
/v1 base on the public testnet host (https://api.testnet.nexus.xyz/v1), and
the origin on a bare indexer such as local. The bridge tools are the one
exception while the pinned spec lacks their bare twins. See
"REST base and paths" below.
Tool | Status | Endpoint (surface) |
| ✅ Live (public) |
|
| ✅ Live (public) |
|
| ✅ Live (public) |
|
| ✅ Live (public) |
|
| ✅ Live (public) |
|
| ✅ Live (public) |
|
| ✅ Live (public) |
|
| ✅ Live (public) |
|
| ✅ Live (public) |
|
| ✅ Live (public) |
|
| ✅ Live (public) |
|
| ✅ Live (public) |
|
| ✅ Live (public) |
|
| ✅ Live (public) |
|
| ✅ Live (public) |
|
| ✅ Live (public) |
|
| ✅ Live (public) |
|
| ✅ Live (needs key) |
|
| ✅ Live (needs key) |
|
| ✅ Live (needs key) |
|
| ✅ Live (needs key) |
|
| ✅ Live (needs key) |
|
| ✅ Live (needs key) |
|
| ✅ Live (needs key) |
|
| ✅ Live (needs key) |
|
| ✅ Live (needs key) |
|
| ✅ Live (needs key) |
|
| ✅ Live (needs key) |
|
| ✅ Live (needs key) |
|
| ✅ Live (needs key) |
|
| ✅ Live (needs key) |
|
| ✅ Live (needs key) |
|
| ✅ Live (needs key) |
|
| ✅ Live (needs key) |
|
| ✅ Live (needs key) |
|
| ✅ Live (needs key) |
|
| ✅ Live (needs key) |
|
| ✅ Live (needs key) |
|
| ✅ Live (needs key) |
|
| ✅ Live (needs key) |
|
| ✅ Live (needs key) |
|
| ✅ Live (needs key) |
|
| ✅ Live (needs key) |
|
| ✅ Live (needs key) |
|
| ✅ Live (needs key) |
|
| ✅ Live (needs key) |
|
| ✅ Live (needs key) |
|
| ✅ Live (needs key) |
|
| ✅ Live (public) |
|
| ⛔ Deprecated — route not served (ENG-11460) |
|
| ⛔ Deprecated — route not served (ENG-11460) |
|
| ✅ Live (needs key) |
|
| ✅ Live (needs key) |
|
| ✅ Live (needs key) |
|
| ✅ Live (needs key + EIP-191 sig or own wallet) |
|
| ✅ Live (needs key) |
|
| ✅ Live (needs key) |
|
| ✅ Live (EIP-712 signature or own wallet) |
|
| ✅ Live (EIP-712 signature or own wallet) |
|
| ✅ Live (stdio, play funds only) | none (local key) |
| ✅ Live (EIP-191 signature or own wallet) |
|
| ✅ Live (needs session token) |
|
| ✅ Live (needs session token) |
|
| ✅ Live (needs session token) |
|
| ✅ Live (needs key) |
|
| ✅ Live (needs key) |
|
| ✅ Live (public) |
|
| 🔒 Admin (opt-in, see below) |
|
| 🔒 Admin (opt-in, see below) |
|
| 🔒 Admin (opt-in, see below) |
|
| 🚧 Pending — server-side endpoint not built yet | none yet |
get_deposit_target is wired into the agent flow but returns a clear
not_yet_available message rather than faking a result. The bridge
deposit-address tools (create_bridge_deposit_address /
list_bridge_deposit_addresses) were meant to supersede it, but they are
deprecated: no server implements /api/v1/bridge/deposit-addresses (its design
was cancelled with ENG-11460), so every call fails.
Tool names
Each tool is named snake_case of the spec operationId it calls, with the
direct-indexer V1 suffix dropped (fetchOrderBookV1 → fetch_order_book),
so the name an agent picks matches the operation and the other SDKs (R2.25,
ENG-17742). scripts/check_spec_drift.py enforces it.
The previous names (list_markets, get_ticker, place_order, …) stay
registered for one minor release as deprecated aliases: each forwards to the
same handler, and its description starts with Deprecated: use `<new name>`.
The full map is DEPRECATED_ALIASES in
src/tools/index.ts. Two changes are not plain renames:
list_marketskeeps returning the markets summary (GET /markets/summary), so it aliasesfetch_markets_summary. The static specs (GET /markets, formerlylist_market_specs) arefetch_markets.cancel_ordernow cancels one order only. The account-wide cancel it used to do withcancel_all: trueiscancel_all_orders, which requiresconfirm: true.
REST base and paths
Per EDR-006 (ENG-17186, ENG-18323) every request is the spec's bare path
under one REST base: sent as /v1/orders on the public testnet host, signed as
/orders.
One base.
https://api.testnet.nexus.xyz/v1on testnet, and the bare origin (http://localhost:9090) on an indexer that serves at its root, likelocal. The/v1is the published prefix the edge strips before the indexer sees the request, so copy the base whole rather than trimming it to the hostname: the bare host routes nothing and answers 404. ANEXUS_EXCHANGE_API_URLthat still ends in/api/exchangeis accepted and normalized, so it cannot double up. Which host that is comes from the network axis, and a named network keeps its own gateway path whenNEXUS_EXCHANGE_API_URLonly redirects the host.HMAC signs the bare path (
/orders). The base's own prefix is not signed over, so the signed path and the wire path differ by that prefix; see Authentication.The bridge is the one exception. The pinned spec (v0.8.1) declares the bridge operations only under
/api/v1/bridge/*, so those tools still send/v1/api/v1/bridge/...and sign/api/v1/bridge/..., which routes and verifies. They move to bare paths once a published spec carries the bare twins (ENG-18318 added them upstream).cancel_orderrequiresmarket_id.cancel_all_orderstakes an optionalmarket_idto scope a mass-cancel to one market.
API-surface coverage
71 registered tools (plus 48 deprecated aliases, see
Tool names) covering 66 spec operations of Exchange API spec
v0.8.1. Those are two different numbers and neither substitutes for the
other: an alias calls the same operation as its canonical tool, and two tools
call none. The operation count is the figure comparable with the rs / py / cli
SDK manifests; the tool count is MCP's own axis and must never be reported as a
coverage figure. docs/coverage-unit.md records that
decision and how it is enforced.
66 of the 68 distinct operations, or 66 of the 101 the spec literally
documents — the spec lists most operations twice, once on the legacy gateway
route and once on its /api/v1 alias, and each aliased pair is one tool.
The operation list is not hand-counted: endpoints.txt is
generated from the per-tool ops declarations in src/tools/index.ts and
verified against the pinned spec on every PR by scripts/check_spec_drift.py
(see Spec drift).
The pin bump (ENG-6038) was pin-only — it advanced .api-version v0.6.2 →
v0.7.1 without mapping the surface those releases had added. ENG-6136 then
exposed those additions as tools, and ENG-6461 advanced the pin to v0.7.2
together with the portfolio-parity surface it added. ENG-9342 then advanced it
to v0.7.3, pin-only again; the three routes that release added are mapped here
(ENG-9202, below), leaving only the field-level half of ENG-9636. ENG-10482 then
advanced the pin to v0.8.1, which added and removed no route: both tags document
the same 101 operations, and all 92 documented 2xx bodies stay
application/json. That is why neither pin bump moved the counts by itself —
not that the two releases were empty. v0.8.x did change schemas on routes this
server already maps, and the additions it does not expose are listed after the
list below. Below, the spec version each addition shipped in is noted:
Portfolio parity (v0.7.2) —
fetch_portfolio_history(GET /account/portfolio-history: equity + PnL + volume series over aday/week/month/allwindow),fetch_account_state(GET /account/state: summary + open positions from one coherent read), andfetch_trading_fees(GET /account/fees: effective maker/taker bps, tier, rolling 30d volume, discounts). The same release enriched thePositionschema —notional_value,margin_used,roe,max_leverage, andleverage, each nullable with a<field>_errorcompanion, plus the always-presentfunding_paid(no_errorcompanion: its"0"is a real zero, not unknown) — and addedwithdrawableto the portfolio summary; those are response-shape additions on already-mapped routes, so they change no route count — the tools that return them (fetch_balance,fetch_positions,fetch_account_state,fetch_account_summary) call them out in their descriptions instead.Account cancel-on-disconnect (v0.7.1) —
fetch_cancel_on_disconnect/set_cancel_on_disconnect(GET/PUT /account/cancel-on-disconnect)./api/v1/bridgePhase A (v0.7.1) —fetch_bridge_assets(public catalog),create_bridge_deposit_address,list_bridge_deposit_addresses,fetch_bridge_deposits, andfetch_bridge_deposit(five operations).Registered withdrawal wallets (v0.7.3, ENG-8902) —
create_bridge_wallet_challenge,register_bridge_wallet, andlist_bridge_wallets(POST /api/v1/bridge/wallets/challenge,POST/GET /api/v1/bridge/wallets). Unlike a schema-only addition these are/api/v1-native with no legacy alias, so they raised the denominator: the v0.7.2 → v0.7.3 pin bump (ENG-9342) moved it from 65 distinct operations to 68 while coverage stayed at 63. Mapping them here closes that gap. Registration is two-step and stateless — the challenge returns a message bound to the account and the address, andregister_bridge_walletechoes it back with the wallet's EIP-191 signature over it. The challenge is not a nonce: until it expires the same signature can be resubmitted, which is a no-op because it only re-registers the same address for the same account. The account holds one wallet in this cut and it cannot be replaced — a different address is refused with409 wallet_already_registered— soregister_bridge_walletis funds-guarded and additionally requiresconfirm: true.Conditional order types (v0.7.0) —
create_order/create_orders/preview_ordernow map all six conditionalorder_types in addition tolimit/market: stop-loss (stop_limit/stop_market), take-profit (take_profit_limit/take_profit_market), and trailing (trailing_stop/trailing_limit), via thetrigger_price,trailing_offset_bps, andlimit_offset_bpsfields. These are a schema addition on the already-mapped order endpoint, so they change no route count — which is why the pin bump's operation-count metric never surfaced the gap.
Every operation this server can map is now mapped (ENG-9202). The 2
remaining are unmapped by design — the WebSocket upgrade endpoints
GET /ws and GET /stream: a request/response MCP tool cannot hold a
streaming socket open, so the server instead mints the auth token
(create_ws_token / create_ws_token_legacy) the caller uses to connect to them
directly. That is a decision, not a backlog item, and it is recorded as such
in NON_SPEC_TARGETS' neighbouring note in scripts/check_spec_drift.py; the
checker keeps printing them so the exclusion stays visible rather than
becoming invisible once it is deliberate.
The v0.7.2 cursor query parameter (ENG-5506) is now exposed on the five
paginated list tools — see "Pagination" below. It adds no route, so the operation
count above is unaffected.
Two optional request fields are documented but not exposed, and neither
affects the operation count. v0.7.3 documents max_slippage_bps on
create_order, create_orders, and preview_order (ENG-7550) — note the
engine has always accepted and enforced it (the fill VWAP is bounded against the
mid captured at submission, and the remainder cancels when the cap would be
crossed); v0.7.3 puts it on the public contract rather than introducing it, so
this is exposure work, not a new capability. It adds no route, so ENG-9202
did not cover it; it remains the field-level half of ENG-9636.
v0.8.0 documents the optional stp field on those same three order tools — the
public exposure ENG-5022 asked for. It is opt-in self-trade prevention, one of
CancelNewest, CancelOldest or DecrementAndCancel, where omitted or null
means self-matching is allowed: that is the default and the industry-standard
behaviour, so a caller who never sets it is unaffected. The engine has always
accepted it, so this too is exposure work rather than a new capability. The same
release added two read-only companions on Order that this server does not
surface either — stp echoes back the mode an order was placed with, and
cancellation_reason reports why a terminal order was cancelled (null, a bare
string, or a single-key object such as {"Stp": "CancelOldest"}). None of the
three adds a route. ENG-9636 is scoped to the v0.7.3 surface and does not
cover them; the v0.8.x surface needs its own follow-up.
One already-mapped route did change its response body: v0.8.1 repointed both
funding-samples operations from FundingSample to a new FundingPremiumSample
carrying only timestamp and premium_index. FundingSample is otherwise
unchanged and still serves GET /markets/{market_id}/funding, so this is a
schema repoint rather than a property removal — but the effect on the
funding-samples body is that funding_rate, mark_price and oracle_price
are gone from it. fetch_funding_samples describes the series and never named
those keys, and nothing in this repo reads them, so no tool description drifted.
Reconciling the liveness surface: v0.7.0 removed the standalone /health and
/ready routes from the public contract (only /status remains), so the former
get_health / get_readiness tools — which called routes the pinned spec no
longer documents — were dropped in favour of the surviving
fetch_status (/status).
Pagination
Five list tools are cursor-paginated (spec v0.7.2, ENG-5506):
Tool | Endpoint |
|
|
| 1000 |
|
| 1000 |
|
| 500 |
|
| 200 |
|
| 720 |
Each returns an envelope, not a bare array:
{ "items": [ … ], "next_cursor": "opaque-token" }The agent drives the loop: call once with no cursor, then call again with
cursor: <previous next_cursor>, and stop when next_cursor is null. Server
state rides in the X-Next-Cursor response header, which the server sends only
while more results exist — its absence is the documented end-of-results signal,
not an error. An empty items array with a non-null next_cursor is not the
end either: a sparse page still has pages behind it.
limit bounds one page, not the total, and is validated against that
endpoint's own maximum (table above) before the request, so an out-of-schema
value is never signed or forwarded. The maxima are not interchangeable — in
particular fetch_portfolio_history's limit cap of 366 is that endpoint's alone
and it takes no cursor at all.
If the upstream ever returns the same cursor it was given, paging cannot
advance. Handing that token back would put an agent in an unbounded tool-call
loop, so the tool forces next_cursor to null and adds a pagination_error
saying the results are incomplete — a stop, but explicitly not "end of history".
These parameters were in the spec ahead of the indexer, which may not yet emit
X-Next-Cursor (ENG-5506). That degrades safely: with no header every response
is next_cursor: null, i.e. exactly the pre-pagination single-page behaviour.
Authorization tiers
Public — no credentials.
HMAC (key): account reads, trading, agent/funding actions. Uses
NEXUS_EXCHANGE_API_KEY/NEXUS_EXCHANGE_API_SECRET, or the keycreate_api_keyjust made (see Stored credentials). The testnet host verifies it as your own key; see Authentication.Wallet signature:
login(EIP-191),register_agentandrevoke_agent(EIP-712), andregister_bridge_wallet(EIP-191) carry a wallet signature.revoke_agentaccepts nothing else: no HMAC key, session or agent key. Pass one made in the wallet assignature, or, on a play-funds target only, omit it and the stdio server signs with its own wallet (see Local wallet). The server never holds a key for real or undeclared funds, and the hosted server never holds one at all.Session token — the
*_api_keytools authenticate with a Bearer session token fromlogin. The stdio server keeps it for the session and saves it, so nothing needs copying into the environment (see Stored credentials);NEXUS_EXCHANGE_SESSION_TOKENstill works.Admin (opt-in) —
fetch_tiers/set_tier/delete_tieruse the operator admin secret and mutate other accounts' fee tiers. They are not registered unlessNEXUS_EXCHANGE_ENABLE_ADMIN_TOOLS=1is set (andNEXUS_EXCHANGE_ADMIN_SECRETprovided). Never enable these on an untrusted agent surface.
Destructive tools (revoke_agent, delete_api_key, delete_tier, and
cancel_all_orders) require an explicit confirm: true flag so a stray call
can't do damage by accident.
Related MCP server: crypto-projects-mcp
Quick start
The server is published to npm as
@nexus-xyz/exchange-mcp,
so it runs with no clone and no build step. Register it with Claude Code in one
line:
claude mcp add nexus -- npx -y @nexus-xyz/exchange-mcpOr launch the stdio server directly (npx fetches the package on first run):
npx -y @nexus-xyz/exchange-mcpIt waits on stdio for an MCP client and is meant to be launched by that client (see Claude Desktop config below) rather than run by hand. Market-data and demo tools work with zero configuration; see Environment variables to enable account/trading tools.
Prefer to run from a checkout — for development, or to use the smoke check? See Development.
Full circle on testnet
With nothing configured, an agent on the stdio server can go from no account to
a closed position on testnet (play funds) through tools alone. Each step is
one tool call:
Step | Tool | Arguments | What happens |
1 |
| none | Makes a wallet key and saves it (see Local wallet). Returns the address. |
2 |
| none | Signs the login message with that wallet and keeps the session token. |
3 |
| none | Mints an HMAC key with that token and keeps it, so the account tools work from here on. |
4 |
| none | Credits synthetic USDX. |
5 |
|
| Opens a small position. |
6 |
| the same with | Closes it ( |
Nothing is copied into the environment and the server is not restarted (see
Stored credentials). create_wallet refuses when this
network already has a wallet; confirm: true replaces it and the old key is
lost. claim_faucet has a per-wallet cooldown and cap, and claim_credit is
the per-key daily allowance.
examples/full-circle.mjs runs these steps
against a throwaway config directory, so your own Nexus config is left alone.
Environment variables
Copy .env.example and set as needed. Only trading/account tools need
credentials — never commit real secrets.
Variable | Required | Purpose |
| No | Network to target: |
| With | Explicit base override — scheme + host, plus the REST base path the deployment serves the spec under (testnet's |
| With | Name for a custom stage. Restricted to |
| With | Whose money is behind the URL: |
| No | Set to |
| No | Where a custom stage hangs off its host: |
| For account/trade tools | Private key (hex) of a registered agent. Signs every account/trade call with |
| For account/trade tools | HMAC API key id ( |
| For account/trade tools | HMAC secret (hex). |
| No | Wallet private key (hex) the stdio server signs with when |
| For | Bearer session token from |
| For admin tools | Operator admin secret ( |
| No | Set to |
Stored credentials
The stdio server shares its credential file with the Nexus CLI (nexus), so a
key made in one works in the other. The file is
$XDG_CONFIG_HOME/nexus/config.json, or ~/.config/nexus/config.json when
XDG_CONFIG_HOME is unset (macOS included), with one section per network under
networks.<network>, as in the CLI's
per-network credentials:
{
"networks": {
"testnet": {
"api_key": "nx_...",
"api_secret": "...",
"session_token": "..."
}
}
}loginkeeps its session token for the rest of the session and saves it to the active network's section, asnexus auth logindoes.create_api_keydoes the same with the new key id and secret. Once the secret is saved, the result shows"secret": "[REDACTED]"andsaved_tonames the file. If the save fails, the result carries the secret in full and asave_error.At startup the server reads the active network's section. Environment variables win field by field, matching the CLI's order (flags > env > file). A file that is not valid JSON stops the server at startup, as it stops the CLI, rather than being read as empty and overwritten.
So an agent goes from login to create_api_key to a trade in one session,
with nothing copied into the environment and no restart, and the key still
works after one.
The file is written 0600 in a 0700 directory, through a temp file and a
rename. Each write holds .config.json.xlock across its read, merge and
rename, the lock nexus also takes
(concurrent writers),
so a nexus command and the server never overwrite each other's change. The
lock is created exclusively (O_CREAT|O_EXCL), holds
pid=<pid> created_ms=<unix ms>, and is deleted when the write ends; a writer
that finds it retries for up to 15 s and deletes it once its mtime is over
10 s old. A nexus older than the lock does not take it, so the server still
re-reads after each write and reports a field such a write erased as unsaved
(the secret comes back in full). One network's credentials never go into another's section: a bare
NEXUS_EXCHANGE_API_URL, and a custom stage whose label spells a network name,
have no section, so what login and create_api_key return is kept for the
session only and the secret comes back in full. The hosted HTTP server never
reads or writes this file.
Local wallet
On a play-funds target (testnet, local, or a custom stage declared
NEXUS_EXCHANGE_FUNDS=play), the stdio server can hold a wallet key of its
own, so an agent can make an account with nothing signed elsewhere:
create_wallet, then login with no signature, then create_api_key.
create_walletgenerates a secp256k1 key and saves it asprivate_keyin the active network's section of the file above, then uses it for the rest of the session. It returns the address andsaved_to, never the key. If a wallet already exists it refuses unlessconfirm: true, which overwrites the old key and keeps it nowhere.To use a key you already have, set
NEXUS_EXCHANGE_PRIVATE_KEY. It wins over the file, andcreate_walletwill not replace it.With a wallet held,
login,register_agent,revoke_agentandregister_bridge_walletsign for themselves whensignatureis omitted. An explicitsignatureis still accepted everywhere.loginsigns only its fixed message,register_bridge_walletonly for the held wallet's own address, andregister_agentandrevoke_agentonly on testnet andlocal(their signatures are bound to the server's network name, which a custom stage does not declare).On mainnet, and on a custom stage whose funds are
realorunknown,create_walletand self-signing refuse before any request, and a key in the environment or the file is not even loaded. No tool ever returns the key.The
nexusCLI shares the file. A CLI release without nexus-exchange-cli#95 dropsprivate_keythe next time it writes the file (for example onnexus auth login), so update the CLI before using both.
Agent safety modes
Two switches limit what an agent can do, for trying an agent out or giving it
market access without trading rights (ENG-20366). Each one is an env var or a
flag in the stdio server's args. The hosted HTTP server reads only the env var.
Mode | Env var | Flag | What the agent gets |
Read-only |
|
| Only tools that change nothing. Placing, amending, cancelling, deposits, logins and key changes are gone. |
Paper |
|
| Read-only, plus simulated |
{ "command": "npx", "args": ["-y", "@nexus-xyz/exchange-mcp", "--paper"] }Read-only keeps a tool only when its readOnlyHint annotation is true, so the
set is exactly what tools/list labels as read-only. Every tool carries MCP
annotations (readOnlyHint, destructiveHint, idempotentHint); one that
calls anything but a GET has to declare them or the server refuses to start.
preview_order and the two WebSocket-token tools are POSTs that count as
read-only: they change no account state.
Paper mode fetches the market's public order book when an order is placed and
walks it. A market order takes levels until it fills or the book runs out. A
limit order fills only the levels its price crosses, and what is left rests in
an in-memory paper book for the life of the process (IOC cancels it, FOK
fills all or nothing, PostOnly is rejected if it would cross). Every
response says "simulated": true. It is deliberately simple. It does not
simulate margin or balance checks, fees, funding, liquidation or positions, and
a resting paper order never fills later, even when the market trades through
it. Only limit and market orders are simulated. Nothing in paper mode
places, amends or cancels a real order.
Networks
The target is chosen on a network axis — whose money is behind it — not a
release channel. NEXUS_EXCHANGE_NETWORK takes testnet, mainnet, local or
custom; the map for the three named networks lives in one place,
src/networks.ts, copied from the spec's
x-nexus-networks extension.
Network | Funds | Faucet | Target today |
| Play (synthetic USDX) | Yes |
|
| Play (whatever you hold) | Yes |
|
| Real money | No | No reachable host yet — selecting it is an error |
| You declare it | You declare it | The URL you supply — see A custom stage |
Nothing changes if you set nothing. The default resolves to exactly the host this server has always used.
mainnet deliberately does not work yet. Its host api.nexus.xyz has no DNS
(ENG-8155) and the pinned spec maps no operation onto its /v1 base, so any URL
built for it would be a guess — on the one network where a guess moves real
money. It fails with an explanation instead. To target it once it is live, set
NEXUS_EXCHANGE_API_URL explicitly alongside NEXUS_EXCHANGE_NETWORK=mainnet
— the network declares the funds, so the URL is only redirecting its host and
stays the sanctioned way to reach real funds before the durable host exists.
Three rules this implements, all from the spec extension:
Hosts are never interpolated from the network name. Mainnet is off-pattern on purpose —
api.nexus.xyz, notapi.mainnet.nexus.xyz— soapi.{network}.nexus.xyzwould resolve for every environment that can be tested and fail only on real funds. Every host is a named literal.An unrecognized network is treated as real funds. A typo is an error, never a fallback to play money.
localis likewise never a fallback for a public host that fails to resolve — succeeding quietly against localhost would hide a misconfigured client.Credentials never cross networks. Session tokens, HMAC keys and agent registrations are minted per network and are invalid on any other. Switching network means switching credentials; never carry a signature or a nonce across.
A custom stage
A deployment that is not one of the three networks — a private stage, a sandbox, an indexer on your own machine — is a custom target: it carries the same descriptor a named network does (label, host, funds, faucet, gateway shape), and this package ships no hostname for any of them. You supply it.
NEXUS_EXCHANGE_NETWORK=custom
NEXUS_EXCHANGE_API_URL=https://exchange.example.com # the stage's origin
NEXUS_EXCHANGE_NETWORK_LABEL=dev # a name for it
NEXUS_EXCHANGE_FUNDS=play # real | play | unknown
NEXUS_EXCHANGE_FAUCET=1 # only if it has one
NEXUS_EXCHANGE_GATEWAY_PATH=/ # bare indexer; omit for /api/exchangeFour rules, and they are the same four in every Nexus client:
customcarries the whole bundle, not just a URL. A URL alone is what makes a client report play-funds guardrails while pointed at a real-funds host.Funds are caller-declared, tri-state, and have no default.
real,play, orunknown. A staging deployment of mainnet is real-funds-shaped, so defaulting toplaywould make every guardrail lie in the direction that costs money, and defaulting torealwould make a dev stage unusable.A faucet is separate from funds, and absent until declared. "Not real money" does not imply "has a faucet".
The label is restricted to
[A-Za-z0-9._-](max 64). Across the clients it is the key stored credentials are namespaced under, so a label that can name a path (../other,one/two) or normalize onto another label is refused.
custom is client-side only. It is not a value the API accepts and it does not
appear in the spec's x-nexus-networks.
Undeclared funds refuse the tools that cannot be undone
NEXUS_EXCHANGE_API_URL on its own is the deprecated legacy shortcut. It
still works — no bundle required, legacy /api/exchange suffix still normalized
— and it resolves to a custom target whose funds are undeclared. It also has
no deployment shape to read, so it assumes the public-gateway one and the notice
below says so; every request is composed under that gateway path, which
is the one thing about this form that is not byte-identical to what it used to
resolve to. A bare URL pointed at an indexer that serves at its root wants
NEXUS_EXCHANGE_NETWORK=local alongside it, or the full bundle. That is not the same as play funds, so these
tools refuse rather than proceed on an assumption:
Tools | Need |
| funds declared |
| funds |
| funds |
Everything else is unaffected: every read, preview_order, and — deliberately —
cancel_order. Blocking a cancel would trap a caller holding open risk, which is
the opposite of a guardrail.
To lift the refusal, say what the target is: select a named network with
NEXUS_EXCHANGE_NETWORK, or describe the stage with the bundle above. Declaring
real is a legitimate answer and unlocks the irreversible tools — the guard asks
that somebody know, not that the money be play.
Because the bare form cannot answer that question, a server started on it prints one notice on stderr naming the declared form, then runs exactly as before (a single line, wrapped here):
nexus-exchange-mcp: NOTICE: NEXUS_EXCHANGE_API_URL on its own is deprecated and
still works. On its own it also assumes the PUBLIC-GATEWAY shape, so every
route resolves under /api/exchange; for an indexer that serves at its root, add
NEXUS_EXCHANGE_NETWORK=local, or describe the deployment with the full custom
bundle …Nothing is removed, and nothing is written to stdout — that is the JSON-RPC channel on the stdio surface, and a stray line there would corrupt the protocol.
Release channels are a URL, not a network
beta / staging are deployments of testnet, not a third pool of money, so they
are no longer enum values. Describe them as a custom stage instead:
NEXUS_EXCHANGE_NETWORK=custom
NEXUS_EXCHANGE_API_URL=https://staging.example.com # the deployment's origin
NEXUS_EXCHANGE_NETWORK_LABEL=staging
NEXUS_EXCHANGE_FUNDS=play # a testnet deployment holds play fundsThe URL overrides the network map and is validated either way (http(s) only, no
embedded user:password@, no query or fragment, since the base is concatenated
with a request path). Plaintext http to a non-loopback host warns on stderr:
HMAC over http exposes the key id and signature in transit — a private stage on
plain http is exactly what that warning is for.
Setting the URL alone still works and is the deprecated shortcut: it leaves
the funds undeclared, which is why it is a custom target with no bundle rather
than a mechanism of its own, and why the tools that cannot be undone refuse on
it. Both are documented in A custom stage.
WebSocket targets
create_ws_token and create_ws_token_legacy now return ws_endpoint alongside the
token, so a caller is no longer handed a 60-second credential with no address to
spend it at. For a named network the endpoints are the spec's published
ws_url for that network (x-nexus-networks, copied into src/networks.ts),
which is the spec's REST base with the scheme swapped:
wss://api.testnet.nexus.xyz/v1/ws # authenticated, connect with ?token=…
wss://api.testnet.nexus.xyz/v1/stream # public market dataThe /v1 prefix is required: the bare host routes no WebSocket path and answers
404 (ENG-17132). Mainnet has the same shape on api.nexus.xyz, which does not
resolve yet (no DNS, ENG-15183). With an explicit NEXUS_EXCHANGE_API_URL (or a
custom stage) the endpoints derive from that gateway base instead, since /ws,
/stream, /ws/token and /ws-tokens carry no per-path servers override in
the spec. On local there is no prefix at all — ws://localhost:9090/ws —
because the indexer serves those routes at its root.
API version
Currently targets Exchange API spec v0.8.1.
The pinned version lives in .api-version; the spec itself is
published by
nexus-xyz/nexus-exchange-api.
This repo does not vendor a copy — the checks below fetch the pinned release. The
line above is bot-managed; everything around it is human-owned.
Three separate things watch the pin, and they answer different questions:
Check | Question | Where |
| Does the tool surface still match the spec it pins? |
|
| Is the pin behind the latest release? |
|
| A newer spec released — is the delta breaking? |
|
spec-autobump (daily cron, repository_dispatch from the api repo, or manual
dispatch) classifies the pin advance with oasdiff and opens a PR touching only
.api-version and the managed line above, labelled spec-autobump or
breaking · needs-SDK-update. It never merges: allow_auto_merge is disabled on
this repo, so the workflow probes the setting and says so in the PR body rather
than calling gh pr merge --auto and reporting success over a no-op. It
supersedes the old poll-only api-version-sync workflow, which had no
classification step.
Spec drift
spec-drift is the verification half, and it runs on every PR — including the
autobump's own, where the pin is the change. It enforces three invariants:
every operation in
endpoints.txtexists in the pinned spec;endpoints.txtmatches the per-toolopsdeclarations byte-for-byte (it is a generated artifact, not a hand-maintained list);each tool's declared
opsmatch the operations its handler actually requests.
All three key an operation on METHOD /path (placeholder names normalized), never
on operationId. Ids are not stable across releases: v0.8.0 swapped
createWsToken and createWsTokenLegacy between POST /ws/token and
POST /ws-tokens — changing no route, and nothing this server calls, but a guard
keyed on ids would have broken on it anyway.
npm run spec:drift # verify against the pinned spec
npm run spec:drift:write # regenerate endpoints.txt after adding operations
npm run spec:drift:test # self-test: prove the checker goes red when defeatedAdding a tool without declaring what it calls is a type error, so the mapping
cannot be skipped. See docs/coverage-unit.md.
Every upstream request also sends this pin as an X-Nexus-Api-Version: <tag>
header (e.g. X-Nexus-Api-Version: v0.8.1), alongside a normalized
User-Agent: nexus-exchange-mcp/<version>, so the exchange edge can attribute
and segment usage by client and by the contract version this server targets.
The header value is the server's own compiled-against tag — it is baked in at
build time (a test keeps it equal to .api-version), so it is
never taken from caller input.
Authentication
Agent keys (recommended for AI agents)
An agent key is a secp256k1 key a wallet authorizes to trade for it
(POST /agents/register). It can place, amend and cancel orders and read the
account, but it cannot withdraw, transfer, or manage agents. That makes it
the credential to hand an AI agent: if the model, its transcript or its host
leaks the key, nobody can move funds out with it.
Set NEXUS_EXCHANGE_AGENT_PRIVATE_KEY (or send X-Nexus-Agent-Private-Key to
the hosted server). Every account and trade
tool then signs with the agentAuth scheme the SDKs use, and the agent key wins
over an HMAC pair when both are set:
keccak256(<METHOD>\n<path>\n<query>\n<sha256hex(body)>\n<timestamp_ms>\n<nonce>)signed with the agent key (recoverable secp256k1, no EIP-191 prefix) and sent
as x-signature alongside x-agent, x-timestamp and x-nonce. The path is
the same bare path the HMAC scheme signs.
To get one, generate a key (any 32 random bytes, e.g. openssl rand -hex 32)
and register its address with your wallet: nexus agents register in the
Nexus CLI, or the
register_agent tool here. The server requires each
agent's nonce to rise on every write, so this server sends one agent-signed
write at a time; run one server per agent key.
HMAC API keys
Signed requests use the same canonical HMAC-SHA256 scheme the indexer verifies
(backend/services/indexer/src/auth.rs):
<timestamp>\n<METHOD>\n<path>\n<query>\n<sha256hex(body)>signed with the hex-decoded secret and sent as x-signature alongside
x-api-key and x-timestamp.
The signed path is the spec's bare path (e.g. /orders), and for the bridge
tools /api/v1/bridge/.... The base's own prefix is not signed over. On a bare
indexer (NEXUS_EXCHANGE_NETWORK=local) the two coincide, so the client signs
exactly what it sends. On the public testnet host they differ: the wire path is
/v1/orders while the signature covers /orders, and the route strips /v1
before the indexer checks (apps-prod-testnet.yaml: "transport prefixes are
stripped before auth"). If signed calls 401 on a prefixed host and the same key
works against a bare indexer, that stripping is the thing to check.
The testnet host verifies the caller's own HMAC. A bad signature is answered
401 UNAUTHORIZED, and a valid key acts as the account that minted it: its own
balance, faucet credit, orders and positions. So trading as yourself needs no
special gateway, and an agent can make its own account there with tools alone
(see Full circle on testnet). local (the
http://localhost:9090 from the exchange docker-compose) verifies client HMAC
the same way.
The one exception is the retired legacy gateway at
exchange.nexus.xyz/api/exchange, which no network targets since ENG-8869 (it
now answers 500). It proxied authenticated requests and signed them with the
site's own frontend key, so per-caller HMAC was not honored and calls resolved
to the site account. A custom stage still behind such a proxy behaves the same
way.
Claude Desktop config
Add this to your Claude Desktop config
(~/Library/Application Support/Claude/claude_desktop_config.json on macOS):
{
"mcpServers": {
"nexus-exchange": {
"command": "npx",
"args": ["-y", "@nexus-xyz/exchange-mcp"],
"env": {
"NEXUS_EXCHANGE_NETWORK": "testnet"
}
}
}
}Running from a local checkout instead? Use "command": "node" with
"args": ["/ABSOLUTE/PATH/TO/nexus-exchange-mcp/dist/index.js"] (after
npm run build).
testnet is the default, so the env block above is optional — it is spelled
out because naming the network is what declares the funds. To reach a deployment
this package ships no host for, use the custom bundle rather than
NEXUS_EXCHANGE_API_URL alone:
"env": {
"NEXUS_EXCHANGE_NETWORK": "custom",
"NEXUS_EXCHANGE_API_URL": "https://exchange.example.com",
"NEXUS_EXCHANGE_NETWORK_LABEL": "dev",
"NEXUS_EXCHANGE_FUNDS": "play"
}To enable trading, add NEXUS_EXCHANGE_API_KEY / NEXUS_EXCHANGE_API_SECRET to
the env block, or on testnet let the agent make its own key (see
Full circle on testnet).
Demo script
Add the config above, restart Claude Desktop, and confirm
nexus-exchangeappears in the tools list.Ask: "Show me the BTC market on Nexus" — Claude calls
fetch_markets_summary/fetch_tickerand reports the live BTC-USDX-PERP price.Ask: "What's in the demo account and its open positions?" — Claude calls
get_demo_accountandget_demo_positionsagainst the live exchange.
Hosted HTTP server (remote MCP)
The stdio server above runs locally and holds your API key on your machine. The hosted Streamable HTTP server is the remote front door: it lets a trader add Nexus as a remote MCP server without running any key-holding software locally.
# from the published package (no clone):
npx -p @nexus-xyz/exchange-mcp nexus-exchange-mcp-http
# or from a checkout:
npm run build
npm run start:http # listens on :8080, MCP endpoint at /mcp, probe at /healthzBehind a TLS-terminating ingress this is the public endpoint
https://mcp.exchange.nexus.xyz/mcp. A client adds it with:
claude mcp add --transport http nexus https://mcp.exchange.nexus.xyz/mcpIt exposes the same tool surface as the stdio server — both transports
register the identical ToolDef[] from src/tools/ via
createServerForClient in src/server.ts, so the tools never drift. The
transport is the SDK's StreamableHTTPServerTransport in stateful mode (one
MCP session per mcp-session-id), which also serves the SSE fallback stream
for server→client messages. Hosted traffic keeps the same
nexus-exchange-mcp/<version> User-Agent as the stdio CLI but appends a
(http) comment (nexus-exchange-mcp/<version> (http)) so usage attributes
to the hosted MCP in the dashboard while still segmenting under one product and
version.
Authentication (MVP — no OAuth yet)
OAuth 2.1 is out of scope for this MVP (tracked under the hardening work, ENG-3598, and scoped-key minting, ENG-3486). Until that lands, the hosted server takes the caller's existing Exchange HMAC credential as request headers, captured once at session initialize and reused for the session:
X-Nexus-Api-Key: <hmac key id> X-Nexus-Api-Secret: <hmac secret, hex>or, recommended, a trade-only agent key that cannot withdraw:
X-Nexus-Agent-Private-Key: <agent private key, hex>These are deliberately not named
x-api-key/x-signature(the upstream gateway's own headers) to avoid confusion. With no credential headers a session still serves public market-data tools, and every authenticated tool refuses with an error naming the two headers.The hosted server never uses server-env credentials (ENG-4359).
NEXUS_EXCHANGE_API_KEY,NEXUS_EXCHANGE_API_SECRET,NEXUS_EXCHANGE_AGENT_PRIVATE_KEY,NEXUS_EXCHANGE_SESSION_TOKEN,NEXUS_EXCHANGE_ADMIN_SECRETandNEXUS_EXCHANGE_PRIVATE_KEYare ignored in HTTP mode, and so is the stored-credentials file, so a caller that sends no headers can never trade as the server's account. Admin tools are never exposed over HTTP. The stdio server still reads them from the environment as before, then from that file.Header passthrough is the simplest defensible MVP, but the long-term answer is OAuth-minted scoped (trade-not-withdraw) keys so the caller never hands us a raw secret. See ENG-3598 / ENG-3486.
Limits and session lifetime
Variable | Default | Meaning |
|
| A session with no request for this long is closed and its client dropped (30 min). |
|
| Token-bucket size per client IP on |
|
| Tokens refilled per second per client IP. |
|
| How many proxies in front of the server append to |
|
| Largest |
Sessions live in process memory, so a restart or redeploy forgets them too. A
session id the server doesn't hold, evicted or lost, answers 404 (the MCP
Streamable HTTP spec's signal), and the client reconnects with a fresh
initialize. A request with no session id is a 400. Only requests count as
activity: an open SSE GET stream does not keep a session alive. A client over
the limit gets 429 with a Retry-After header (seconds). /healthz is not
limited.
The limiter is in memory and per process, so the effective ceiling is per replica: N replicas allow N times the configured rate. An ingress-level limit is the global answer.
Client IP. With MCP_HTTP_TRUSTED_PROXY_HOPS=0 (the default) the limiter
keys on the TCP peer and ignores X-Forwarded-For, because a client can set
that header to anything and would otherwise dodge the limit. Behind an ingress
the peer is the ingress itself, so every caller shares one bucket: set the
variable to the number of proxies that append to X-Forwarded-For (1 for a
single reverse proxy, 2 for a Google Cloud load balancer, which appends both
the client and its own address). The limiter then takes the Nth entry from the
right, the one the outermost trusted proxy saw. Setting it higher than the
real hop count lets a client spoof its IP again.
Development
Clone and build from source:
git clone https://github.com/nexus-xyz/nexus-exchange-mcp.git
cd nexus-exchange-mcp
npm install
npm run build
npm start # runs the stdio MCP server from the local buildThen the usual checks:
npm run format # prettier --write
npm run lint # eslint
npm run typecheck # tsc --noEmit
npm test # unit tests (HMAC scheme, arg mapping, schemas)
npm run test:coverage # unit tests + coverage (text/lcov/json-summary); CI emits the %
npm run spec:drift # tool surface vs. the pinned spec (see "Spec drift" above)The smoke check runs end-to-end against a live deployment. Against a local indexer, name the network too, so the target keeps the bare-origin shape:
NEXUS_EXCHANGE_NETWORK=local NEXUS_EXCHANGE_API_URL=http://localhost:9090 npm run smokeThe public testnet host works as well. Name the network alongside it: the
deprecated bare-URL form assumes the retired public-gateway shape and would
append /api/exchange to a base that already carries /v1.
NEXUS_EXCHANGE_NETWORK=testnet NEXUS_EXCHANGE_API_URL=https://api.testnet.nexus.xyz/v1 npm run smokeExpected output ends with fetch_markets_summary OK -> N markets.
It requires an explicit NEXUS_EXCHANGE_API_URL and has no default
(ENG-8092) — fetch_markets_summary is a read, and reads are never funds-guarded. The
URL names the host; the gateway path decides where every request lands under it
(ENG-6221), and that comes from the network. So NEXUS_EXCHANGE_API_URL alone
resolves …/api/exchange/… and prints the bare-URL deprecation notice on
stderr before proceeding, while NEXUS_EXCHANGE_NETWORK=local alongside it
serves the spec's paths at the origin and prints no notice — the network declared
the target, so the URL only redirected the host. Pointing a bare
NEXUS_EXCHANGE_API_URL at an indexer that serves at its root sends every
route under /api/exchange, where a bare indexer serves nothing; name the
network, or describe the stage with the full custom bundle (which is where
NEXUS_EXCHANGE_GATEWAY_PATH=/ is read — it is refused on its own). If the
target answers with HTML rather than JSON, on a 404 or on a 200, the check says
so by name and exits non-zero; it never reports a passing run for a body it
could not read as market-summary JSON.
License
Dual-licensed under MIT or Apache-2.0, at your option — same as the other Nexus Exchange SDKs.
Available Tools
115 toolsadd_marginA
Add or remove isolated margin on an open position. Fails if the position is not in isolated margin mode (MarginModeNotIsolated), if there is no open position in the market (NoOpenPosition), or if a removal breaches the margin floor. amount is a positive decimal string. Requires API credentials. This moves REAL margin on the position.
Inputs: amount (required), direction (required), market_id (required).
adjust_isolated_marginA
Deprecated: use add_margin. Add or remove isolated margin on an open position. Fails if the position is not in isolated margin mode (MarginModeNotIsolated), if there is no open position in the market (NoOpenPosition), or if a removal breaches the margin floor. amount is a positive decimal string. Requires API credentials. This moves REAL margin on the position.
Inputs: amount (required), direction (required), market_id (required).
amend_orderA
Deprecated: use edit_order. Amend a resting order's price and/or size in one atomic cancel-replace operation. At least one of price or size is required; a pre-trade margin check is applied to the replacement before it is accepted. Liquidation orders cannot be amended. Requires API credentials. This modifies a REAL order on the matching engine.
Inputs: order_id (required), market_id (required), size, price.
cancel_all_ordersA
Cancel ALL of the authenticated account's open orders, optionally scoped to one market with market_id. Destructive: you must pass confirm: true, so a stray or argless call can't mass-cancel by accident. To cancel a single order use cancel_order. Requires API credentials.
Inputs: confirm, market_id.
cancel_orderA
Cancel ONE resting order by order_id. market_id is required (the route uses it for routing). This tool only ever cancels the single named order; to cancel every open order use cancel_all_orders. Requires API credentials.
Inputs: order_id (required), market_id (required).
claim_creditA
Claim synthetic USDX credit from the testnet faucet, up to a per-key daily allowance (default 500 USDX, resets midnight UTC). Pass amount (positive decimal string) to claim a specific amount, or omit it to claim the full remaining allowance. The credited USDX is synthetic testnet value. Requires API credentials.
Inputs: amount.
claim_faucetA
Claim the fixed testnet faucet amount of synthetic USDX for the authenticated account, subject to a per-wallet cooldown and cumulative cap. Unlike claim_credit the amount is fixed server-side — no arguments. Requires API credentials.
Inputs: no named parameters.
create_api_keyA
Create a new HMAC API key for the authenticated wallet. The stdio server keeps the key for the rest of this session, so the account and trading tools work right away. The API shows the secret ONCE: the stdio server saves it for this network in the Nexus CLI config and secret comes back redacted, with saved_to naming the file. When it could not be saved, secret is returned in full and must be stored now. Authenticates with the session token from login, or NEXUS_EXCHANGE_SESSION_TOKEN.
Inputs: no named parameters.
create_bridge_deposit_addressA
Deprecated: no server implements this route (its design was cancelled, ENG-11460), so every call fails. Get or create the authenticated account's cross-chain deposit address on a chain. Sending a supported asset to the returned address credits the account. Idempotent per (account, chain): repeated calls return the same address rather than allocating a new one. Requires API credentials.
Inputs: chain (required).
create_bridge_wallet_challengeA
Step 1 of registering a withdrawal wallet: returns the exact message to sign with that wallet's key (EIP-191 personal_sign) and the expires_at it is valid until. Sign the message in the wallet and pass it and the signature to register_bridge_wallet, or, for the wallet create_wallet made, omit the signature and the server signs. Treat message as opaque: echo it back verbatim, never reformat, re-encode or trim it. The nonce field is informational — sign message, not the nonce, and do not treat the challenge as single-use: until it expires the same signature can be submitted again, which is harmless because the message is bound to your account and to address. Mints nothing and changes no state, so it is safe to call before you have decided to register. A 503 wallet_registration_unavailable means this deployment has no challenge key configured — registration is off there, and retrying will not help. Requires API credentials.
Inputs: address (required).
create_depositA
Submit a (testnet/synthetic) deposit for the authenticated account via the deposits ledger (POST /deposits — unlike deposit, the deposit is recorded and listable with fetch_deposits). amount is a positive decimal string; asset defaults to USDX. Requires API credentials. This moves REAL collateral on the account.
Inputs: amount (required), asset.
create_orderA
Place an order on a market, buy/sell. Supports limit, market, stop-loss (stop_limit / stop_market), take-profit (take_profit_limit / take_profit_market), and trailing (trailing_stop / trailing_limit) orders. Limit-family orders require a price; stop / take-profit orders require a trigger_price; trailing orders require trailing_offset_bps (and trailing_limit also limit_offset_bps). Requires API credentials. This submits a REAL order to the matching engine.
Inputs: side (required), size (required), type (required), market_id (required), +6 more.
create_ordersB
Submit multiple orders in one request. Each order has the same shape as create_order (market_id, side, type, size, and the type-dependent price / trigger_price / trailing offsets / time_in_force / reduce_only). Requires API credentials. This submits REAL orders to the matching engine.
Inputs: orders (required).
create_walletA
Make a new EVM wallet for this server to sign with, on a play-funds target only (testnet, local, or a custom stage declared NEXUS_EXCHANGE_FUNDS=play). The key is saved in this network's section of the Nexus CLI config (0600) and used for the rest of the session; only the address comes back, never the key. After it, login, register_agent and register_bridge_wallet sign for themselves when signature is omitted, so create_wallet, login, create_api_key gets an agent an account with nothing signed elsewhere. If a wallet already exists for this network it is refused unless confirm: true, which overwrites the old key and keeps it nowhere. Stdio server only. Refused on mainnet and on any target whose funds are real or undeclared.
Inputs: confirm.
create_ws_tokenA
Mint a short-lived (60s, single-use) token for an authenticated per-account WebSocket stream (order/fill/position updates). Uses the current /ws/token endpoint, which supports HMAC keys and registered agents. The response carries ws_endpoint — the URL to connect to for the configured network — so no host has to be guessed. Requires API credentials.
Inputs: no named parameters.
create_ws_token_legacyA
Mint a short-lived (60s, single-use) token for the legacy public /stream endpoint via POST /ws-tokens. Prefer create_ws_token (/ws/token) for new code; this is kept for /stream compatibility. The response carries ws_endpoint for the configured network. Requires API credentials.
Inputs: no named parameters.
delete_api_keyA
Delete (revoke) an HMAC API key by its key id. Destructive: any caller using that key stops working. You must pass confirm: true. Authenticates with the session token from login, or NEXUS_EXCHANGE_SESSION_TOKEN.
Inputs: key_id (required), confirm.
depositB
Deposit USDX collateral into the authenticated account. amount is a positive decimal string. Requires API credentials. This moves REAL collateral on the account.
Inputs: amount (required).
deposit_collateralA
Deprecated: use deposit. Deposit USDX collateral into the authenticated account. amount is a positive decimal string. Requires API credentials. This moves REAL collateral on the account.
Inputs: amount (required).
edit_orderA
Amend a resting order's price and/or size in one atomic cancel-replace operation. At least one of price or size is required; a pre-trade margin check is applied to the replacement before it is accepted. Liquidation orders cannot be amended. Requires API credentials. This modifies a REAL order on the matching engine.
Inputs: order_id (required), market_id (required), size, price.
fetch_account_stateA
Get the authenticated account's full state in ONE call: the portfolio summary aggregates plus every open position ({ summary, positions }). Prefer this over pairing fetch_account_summary with fetch_positions — both parts come from one coherent read, so summary.open_positions_count always matches the positions length. If the engine-authoritative margin view is unavailable this fails closed with a 502 (authoritative_margin_unavailable) rather than returning an estimate: retry after a short delay, do NOT read the error as a flat or empty account. Positions carry per-position risk detail. notional_value, margin_used, roe, max_leverage, and leverage are derived from mirrored state, so any of them can be null with a companion <field>_error naming the reason (e.g. mark_price_unavailable); treat null as UNKNOWN, never as zero. leverage is currently always null (leverage_error: margin_state_not_mirrored) — do not infer it from margin_used. funding_paid is NOT one of those: it is always present and has no _error companion, so its "0" is a real zero (no funding accrued), not unknown. It is paid-positive — a negative value means funding was received. Requires API credentials.
Inputs: no named parameters.
fetch_account_summaryA
Get the authenticated account's portfolio summary (equity, margin usage, PnL rollup) — a richer view than fetch_balance. Includes withdrawable: the engine-authoritative free margin floored at zero, i.e. exactly what can leave the account (never negative). Because withdrawable comes from that authoritative margin view, this call fails closed with a 502 (authoritative_margin_unavailable) when the view is unavailable rather than returning a local estimate: retry after a short delay, do NOT read the error as a flat or empty account. Requires API credentials.
Inputs: no named parameters.
fetch_adl_eventsA
Get the auto-deleveraging (ADL) settlement history for one market — the events where the engine force-closed positions to cover a shortfall. Requires API credentials.
Inputs: market_id (required), limit.
fetch_adl_historyA
Get the auto-deleveraging (ADL) events that touched a given account. Requires API credentials.
Inputs: address (required), limit.
fetch_agentsA
List the delegated agent keys registered for the authenticated wallet (address, label, expiry). Requires API credentials.
Inputs: no named parameters.
fetch_api_keysA
List the HMAC API keys for the authenticated wallet (key ids and metadata; never the secrets). Authenticates with the session token from login, or NEXUS_EXCHANGE_SESSION_TOKEN.
Inputs: no named parameters.
fetch_balanceA
Get the authenticated account snapshot: collateral balance, equity, and positions. Positions carry per-position risk detail. notional_value, margin_used, roe, max_leverage, and leverage are derived from mirrored state, so any of them can be null with a companion <field>_error naming the reason (e.g. mark_price_unavailable); treat null as UNKNOWN, never as zero. leverage is currently always null (leverage_error: margin_state_not_mirrored) — do not infer it from margin_used. funding_paid is NOT one of those: it is always present and has no _error companion, so its "0" is a real zero (no funding accrued), not unknown. It is paid-positive — a negative value means funding was received. Requires API credentials.
Inputs: no named parameters.
fetch_bridge_assetsA
List the bridgeable chains and, per chain, the depositable assets (USDC, USDX) and withdrawable assets (USDX) with their decimals, minimum amounts, required confirmations, and fees. Public catalog — no credentials needed. Use it to discover valid chain values for the other bridge tools.
Inputs: no named parameters.
fetch_bridge_depositB
Fetch a single cross-chain (bridge) deposit by id. Only deposits owned by the authenticated account are returned. Requires API credentials.
Inputs: id (required).
fetch_bridge_depositsA
List the authenticated account's cross-chain (bridge) deposits, newest first. Optionally filter by source chain, asset (USDC|USDX), or status (detected|confirming|credited|failed). Distinct from fetch_deposits, which lists the account's ledger deposits. Requires API credentials.
Inputs: asset, chain, limit, status.
fetch_cancel_on_disconnectA
Get the authenticated account's cancel-on-disconnect (COD) status. COD is an opt-in dead man's switch: when the account's last authenticated WebSocket connection drops and does not reconnect within the grace window, the exchange cancels all of the account's resting orders. Returns enabled (the account's own opt-in), active (whether it will actually fire — the opt-in AND the exchange-side feature switch), and grace_secs (the reconnect window in seconds, null when the feature is unavailable). Clients that trade purely over REST and never open a WebSocket are not covered. Requires API credentials.
Inputs: no named parameters.
fetch_depositsB
List the authenticated account's deposit history. Requires API credentials.
Inputs: limit.
fetch_equity_historyA
Get the authenticated account's equity time-series (5s cadence, ~1h window), oldest first. For a longer window, or for PnL and volume series alongside equity, use fetch_portfolio_history. Returns { items, next_cursor }. items is this page of results; next_cursor is an opaque token for the next page, or null when this is the last page. To read the full history, keep calling with cursor: <previous next_cursor> until next_cursor is null. limit sets the size of ONE page, not a total. Requires API credentials.
Inputs: limit, cursor.
fetch_funding_historyA
Get the authenticated account's funding-payment history, newest first, optionally filtered to a single market. Requires API credentials.
Inputs: limit, market_id.
fetch_funding_rate_historyA
Get the funding-rate history for one perpetual market. Public — no credentials needed.
Inputs: market_id (required), limit.
fetch_funding_samplesA
Get the dense per-tick funding premium-index samples for one perpetual market (60s cadence, up to 480 points = 8h). Finer-grained than fetch_funding_rate_history, which returns the settled hourly rates. Public — no credentials needed.
Inputs: market_id (required), limit.
fetch_market_risk_paramsA
Get one market's risk parameters: margin requirements and maximum leverage, from the engine's market registry. Public — no credentials needed.
Inputs: market_id (required).
fetch_marketsA
List all markets with their static specs (tick size, lot size, leverage, contract details) — the raw market definitions without live summary stats. Public — no credentials needed. (Use fetch_markets_summary for live mark price / volume / funding.)
Inputs: no named parameters.
fetch_markets_summaryA
List all tradable markets with their current summary (mark price, 24h change, volume, open interest, funding). Public — no credentials needed.
Inputs: no named parameters.
fetch_market_statusB
Get a market's trading status and halt info (whether trading is open, halted, or in auction). Public — no credentials needed.
Inputs: market_id (required).
fetch_mark_priceA
Get the current mark price for one market. Public — no credentials needed.
Inputs: market_id (required).
fetch_my_tradesA
List the authenticated account's fills (executed trades), newest first. Returns { items, next_cursor }. items is this page of results; next_cursor is an opaque token for the next page, or null when this is the last page. To read the full history, keep calling with cursor: <previous next_cursor> until next_cursor is null. limit sets the size of ONE page, not a total. Requires API credentials.
Inputs: limit, cursor.
fetch_ohlcvA
Get OHLCV candles for one market. Public — no credentials needed. Timeframe is one of 1s, 1m, 5m, 1h (default 1m).
Inputs: market_id (required), limit, timeframe.
fetch_open_ordersB
Get the authenticated account's resting (open) orders. Requires API credentials.
Inputs: no named parameters.
fetch_orderA
Get a single order by its id (status, fills, remaining size). Pass market_id when known — the spec marks it required for routing, though the gateway currently resolves the order without it. Requires API credentials.
Inputs: order_id (required), market_id.
fetch_order_bookB
Get the current order book (bids/asks with price + size) for one market. Public — no credentials needed.
Inputs: market_id (required).
fetch_ordersA
Get the authenticated account's terminal-status order history (filled / cancelled / rejected / expired), newest first. Returns { items, next_cursor }. items is this page of results; next_cursor is an opaque token for the next page, or null when this is the last page. To read the full history, keep calling with cursor: <previous next_cursor> until next_cursor is null. limit sets the size of ONE page, not a total. Requires API credentials.
Inputs: limit, cursor.
fetch_portfolio_historyA
Get the authenticated account's portfolio time-series — equity, cumulative trading PnL, and cumulative traded volume — over a selectable window, oldest first. Richer than fetch_equity_history (equity only, 5s cadence, ~1h); both derive equity from the same source, so the two never disagree. Each window sets its own downsample cadence and point capacity: day 5m/288, week 1h/168, month 6h/120, all 1d/366. pnl is deposit-neutral (trading performance only) and volume is monotonically non-decreasing. This is a HEAVY read — the gateway charges it 5x an ordinary GET, so a single call draws about five requests' worth of budget and the remaining reported by fetch_rate_limit_status (counted in ordinary requests) drops by ~5. Poll it sparingly. Requires API credentials.
Inputs: limit, window.
fetch_positionsA
Get the authenticated account's open positions. Positions carry per-position risk detail. notional_value, margin_used, roe, max_leverage, and leverage are derived from mirrored state, so any of them can be null with a companion <field>_error naming the reason (e.g. mark_price_unavailable); treat null as UNKNOWN, never as zero. leverage is currently always null (leverage_error: margin_state_not_mirrored) — do not infer it from margin_used. funding_paid is NOT one of those: it is always present and has no _error companion, so its "0" is a real zero (no funding accrued), not unknown. It is paid-positive — a negative value means funding was received. Requires API credentials.
Inputs: no named parameters.
fetch_positions_historyA
Get the authenticated account's closed positions (realized PnL per position). Returns { items, next_cursor }. items is this page of results; next_cursor is an opaque token for the next page, or null when this is the last page. To read the full history, keep calling with cursor: <previous next_cursor> until next_cursor is null. limit sets the size of ONE page, not a total. Requires API credentials.
Inputs: limit, cursor.
fetch_rate_limit_statusA
Get the authenticated account's current rate-limit status (remaining request budget). Useful for an agent to pace itself. Requires API credentials.
Inputs: no named parameters.
fetch_statsA
Get aggregate venue statistics (volume, trades, throughput) plus rolling unique-trader counts. Public — no credentials needed.
Inputs: no named parameters.
fetch_stats_historyA
Get the venue's per-second throughput history (ring buffer, up to 3600 points). Public — no credentials needed.
Inputs: no named parameters.
fetch_statusA
Aggregate service health of the exchange stack (indexer / engine / oracle / bots), as used by status pages. Public — no credentials needed.
Inputs: no named parameters.
fetch_tickerA
Get the ticker (last price, bid/ask, 24h stats) for one market, e.g. "BTC-USDX-PERP". Public — no credentials needed.
Inputs: market_id (required).
fetch_tickersA
Get tickers (last price, bid/ask, 24h stats) for ALL markets in one call. Public — no credentials needed.
Inputs: no named parameters.
fetch_tradesA
Get recent public trades (prints) for one market, newest first. Returns { items, next_cursor }. items is this page of results; next_cursor is an opaque token for the next page, or null when this is the last page. To read the full history, keep calling with cursor: <previous next_cursor> until next_cursor is null. limit sets the size of ONE page, not a total. Public — no credentials needed.
Inputs: market_id (required), limit, cursor.
fetch_trading_feesA
Get the authenticated account's effective fee schedule: maker/taker rate in basis points (a NEGATIVE maker rate is a rebate paid TO the maker), fee tier, rolling 30-day traded volume, and any active discounts. This is the forward-looking schedule rate for the scope named by schedule (per-market rates differ), not a realized per-fill average; volume_30d_estimated: true means the 30-day volume may undercount. Requires API credentials.
Inputs: no named parameters.
fetch_withdrawalsB
List the authenticated account's withdrawal history. Requires API credentials.
Inputs: limit.
get_account_feesA
Deprecated: use fetch_trading_fees. Get the authenticated account's effective fee schedule: maker/taker rate in basis points (a NEGATIVE maker rate is a rebate paid TO the maker), fee tier, rolling 30-day traded volume, and any active discounts. This is the forward-looking schedule rate for the scope named by schedule (per-market rates differ), not a realized per-fill average; volume_30d_estimated: true means the 30-day volume may undercount. Requires API credentials.
Inputs: no named parameters.
get_account_stateA
Deprecated: use fetch_account_state. Get the authenticated account's full state in ONE call: the portfolio summary aggregates plus every open position ({ summary, positions }). Prefer this over pairing fetch_account_summary with fetch_positions — both parts come from one coherent read, so summary.open_positions_count always matches the positions length. If the engine-authoritative margin view is unavailable this fails closed with a 502 (authoritative_margin_unavailable) rather than returning an estimate: retry after a short delay, do NOT read the error as a flat or empty account. Positions carry per-position risk detail. notional_value, margin_used, roe, max_leverage, and leverage are derived from mirrored state, so any of them can be null with a companion <field>_error naming the reason (e.g. mark_price_unavailable); treat null as UNKNOWN, never as zero. leverage is currently always null (leverage_error: margin_state_not_mirrored) — do not infer it from margin_used. funding_paid is NOT one of those: it is always present and has no _error companion, so its "0" is a real zero (no funding accrued), not unknown. It is paid-positive — a negative value means funding was received. Requires API credentials.
Inputs: no named parameters.
get_account_summaryA
Deprecated: use fetch_account_summary. Get the authenticated account's portfolio summary (equity, margin usage, PnL rollup) — a richer view than fetch_balance. Includes withdrawable: the engine-authoritative free margin floored at zero, i.e. exactly what can leave the account (never negative). Because withdrawable comes from that authoritative margin view, this call fails closed with a 502 (authoritative_margin_unavailable) when the view is unavailable rather than returning a local estimate: retry after a short delay, do NOT read the error as a flat or empty account. Requires API credentials.
Inputs: no named parameters.
get_adl_historyA
Deprecated: use fetch_adl_history. Get the auto-deleveraging (ADL) events that touched a given account. Requires API credentials.
Inputs: address (required), limit.
get_balanceA
Deprecated: use fetch_balance. Get the authenticated account snapshot: collateral balance, equity, and positions. Positions carry per-position risk detail. notional_value, margin_used, roe, max_leverage, and leverage are derived from mirrored state, so any of them can be null with a companion <field>_error naming the reason (e.g. mark_price_unavailable); treat null as UNKNOWN, never as zero. leverage is currently always null (leverage_error: margin_state_not_mirrored) — do not infer it from margin_used. funding_paid is NOT one of those: it is always present and has no _error companion, so its "0" is a real zero (no funding accrued), not unknown. It is paid-positive — a negative value means funding was received. Requires API credentials.
Inputs: no named parameters.
get_bridge_assetsA
Deprecated: use fetch_bridge_assets. List the bridgeable chains and, per chain, the depositable assets (USDC, USDX) and withdrawable assets (USDX) with their decimals, minimum amounts, required confirmations, and fees. Public catalog — no credentials needed. Use it to discover valid chain values for the other bridge tools.
Inputs: no named parameters.
get_bridge_depositA
Deprecated: use fetch_bridge_deposit. Fetch a single cross-chain (bridge) deposit by id. Only deposits owned by the authenticated account are returned. Requires API credentials.
Inputs: id (required).
get_cancel_on_disconnectA
Deprecated: use fetch_cancel_on_disconnect. Get the authenticated account's cancel-on-disconnect (COD) status. COD is an opt-in dead man's switch: when the account's last authenticated WebSocket connection drops and does not reconnect within the grace window, the exchange cancels all of the account's resting orders. Returns enabled (the account's own opt-in), active (whether it will actually fire — the opt-in AND the exchange-side feature switch), and grace_secs (the reconnect window in seconds, null when the feature is unavailable). Clients that trade purely over REST and never open a WebSocket are not covered. Requires API credentials.
Inputs: no named parameters.
get_candlesA
Deprecated: use fetch_ohlcv. Get OHLCV candles for one market. Public — no credentials needed. Timeframe is one of 1s, 1m, 5m, 1h (default 1m).
Inputs: market_id (required), limit, timeframe.
get_closed_positionsA
Deprecated: use fetch_positions_history. Get the authenticated account's closed positions (realized PnL per position). Returns { items, next_cursor }. items is this page of results; next_cursor is an opaque token for the next page, or null when this is the last page. To read the full history, keep calling with cursor: <previous next_cursor> until next_cursor is null. limit sets the size of ONE page, not a total. Requires API credentials.
Inputs: limit, cursor.
get_demo_accountA
Get a live, public demo account snapshot (balance, equity, positions). No credentials needed — useful to show the account flow before API keys are wired up.
Inputs: no named parameters.
get_demo_ordersA
Get the public demo account's open orders. No credentials needed.
Inputs: no named parameters.
get_demo_positionsA
Get the public demo account's open positions. No credentials needed.
Inputs: no named parameters.
get_deposit_targetB
Get the on-chain deposit target (address/memo) to fund the account. This legacy single-target lookup remains unbuilt server-side, and the bridge deposit-address tools that were to supersede it are deprecated because nothing serves them either.
Inputs: asset.
get_equity_historyA
Deprecated: use fetch_equity_history. Get the authenticated account's equity time-series (5s cadence, ~1h window), oldest first. For a longer window, or for PnL and volume series alongside equity, use fetch_portfolio_history. Returns { items, next_cursor }. items is this page of results; next_cursor is an opaque token for the next page, or null when this is the last page. To read the full history, keep calling with cursor: <previous next_cursor> until next_cursor is null. limit sets the size of ONE page, not a total. Requires API credentials.
Inputs: limit, cursor.
get_fillsA
Deprecated: use fetch_my_trades. List the authenticated account's fills (executed trades), newest first. Returns { items, next_cursor }. items is this page of results; next_cursor is an opaque token for the next page, or null when this is the last page. To read the full history, keep calling with cursor: <previous next_cursor> until next_cursor is null. limit sets the size of ONE page, not a total. Requires API credentials.
Inputs: limit, cursor.
get_funding_historyA
Deprecated: use fetch_funding_rate_history. Get the funding-rate history for one perpetual market. Public — no credentials needed.
Inputs: market_id (required), limit.
get_funding_paymentsA
Deprecated: use fetch_funding_history. Get the authenticated account's funding-payment history, newest first, optionally filtered to a single market. Requires API credentials.
Inputs: limit, market_id.
get_funding_samplesA
Deprecated: use fetch_funding_samples. Get the dense per-tick funding premium-index samples for one perpetual market (60s cadence, up to 480 points = 8h). Finer-grained than fetch_funding_rate_history, which returns the settled hourly rates. Public — no credentials needed.
Inputs: market_id (required), limit.
get_market_adl_eventsA
Deprecated: use fetch_adl_events. Get the auto-deleveraging (ADL) settlement history for one market — the events where the engine force-closed positions to cover a shortfall. Requires API credentials.
Inputs: market_id (required), limit.
get_market_risk_paramsA
Deprecated: use fetch_market_risk_params. Get one market's risk parameters: margin requirements and maximum leverage, from the engine's market registry. Public — no credentials needed.
Inputs: market_id (required).
get_market_statusA
Deprecated: use fetch_market_status. Get a market's trading status and halt info (whether trading is open, halted, or in auction). Public — no credentials needed.
Inputs: market_id (required).
get_mark_priceA
Deprecated: use fetch_mark_price. Get the current mark price for one market. Public — no credentials needed.
Inputs: market_id (required).
get_open_ordersA
Deprecated: use fetch_open_orders. Get the authenticated account's resting (open) orders. Requires API credentials.
Inputs: no named parameters.
get_orderA
Deprecated: use fetch_order. Get a single order by its id (status, fills, remaining size). Pass market_id when known — the spec marks it required for routing, though the gateway currently resolves the order without it. Requires API credentials.
Inputs: order_id (required), market_id.
get_orderbookA
Deprecated: use fetch_order_book. Get the current order book (bids/asks with price + size) for one market. Public — no credentials needed.
Inputs: market_id (required).
get_order_historyA
Deprecated: use fetch_orders. Get the authenticated account's terminal-status order history (filled / cancelled / rejected / expired), newest first. Returns { items, next_cursor }. items is this page of results; next_cursor is an opaque token for the next page, or null when this is the last page. To read the full history, keep calling with cursor: <previous next_cursor> until next_cursor is null. limit sets the size of ONE page, not a total. Requires API credentials.
Inputs: limit, cursor.
get_portfolio_historyA
Deprecated: use fetch_portfolio_history. Get the authenticated account's portfolio time-series — equity, cumulative trading PnL, and cumulative traded volume — over a selectable window, oldest first. Richer than fetch_equity_history (equity only, 5s cadence, ~1h); both derive equity from the same source, so the two never disagree. Each window sets its own downsample cadence and point capacity: day 5m/288, week 1h/168, month 6h/120, all 1d/366. pnl is deposit-neutral (trading performance only) and volume is monotonically non-decreasing. This is a HEAVY read — the gateway charges it 5x an ordinary GET, so a single call draws about five requests' worth of budget and the remaining reported by fetch_rate_limit_status (counted in ordinary requests) drops by ~5. Poll it sparingly. Requires API credentials.
Inputs: limit, window.
get_positionsA
Deprecated: use fetch_positions. Get the authenticated account's open positions. Positions carry per-position risk detail. notional_value, margin_used, roe, max_leverage, and leverage are derived from mirrored state, so any of them can be null with a companion <field>_error naming the reason (e.g. mark_price_unavailable); treat null as UNKNOWN, never as zero. leverage is currently always null (leverage_error: margin_state_not_mirrored) — do not infer it from margin_used. funding_paid is NOT one of those: it is always present and has no _error companion, so its "0" is a real zero (no funding accrued), not unknown. It is paid-positive — a negative value means funding was received. Requires API credentials.
Inputs: no named parameters.
get_rate_limit_statusA
Deprecated: use fetch_rate_limit_status. Get the authenticated account's current rate-limit status (remaining request budget). Useful for an agent to pace itself. Requires API credentials.
Inputs: no named parameters.
get_service_statusA
Deprecated: use fetch_status. Aggregate service health of the exchange stack (indexer / engine / oracle / bots), as used by status pages. Public — no credentials needed.
Inputs: no named parameters.
get_statsA
Deprecated: use fetch_stats. Get aggregate venue statistics (volume, trades, throughput) plus rolling unique-trader counts. Public — no credentials needed.
Inputs: no named parameters.
get_stats_historyA
Deprecated: use fetch_stats_history. Get the venue's per-second throughput history (ring buffer, up to 3600 points). Public — no credentials needed.
Inputs: no named parameters.
get_tickerA
Deprecated: use fetch_ticker. Get the ticker (last price, bid/ask, 24h stats) for one market, e.g. "BTC-USDX-PERP". Public — no credentials needed.
Inputs: market_id (required).
get_tickersA
Deprecated: use fetch_tickers. Get tickers (last price, bid/ask, 24h stats) for ALL markets in one call. Public — no credentials needed.
Inputs: no named parameters.
get_tradesA
Deprecated: use fetch_trades. Get recent public trades (prints) for one market, newest first. Returns { items, next_cursor }. items is this page of results; next_cursor is an opaque token for the next page, or null when this is the last page. To read the full history, keep calling with cursor: <previous next_cursor> until next_cursor is null. limit sets the size of ONE page, not a total. Public — no credentials needed.
Inputs: market_id (required), limit, cursor.
get_withdrawalsA
Deprecated: use fetch_withdrawals. List the authenticated account's withdrawal history. Requires API credentials.
Inputs: limit.
get_ws_tokenA
Deprecated: use create_ws_token. Mint a short-lived (60s, single-use) token for an authenticated per-account WebSocket stream (order/fill/position updates). Uses the current /ws/token endpoint, which supports HMAC keys and registered agents. The response carries ws_endpoint — the URL to connect to for the configured network — so no host has to be guessed. Requires API credentials.
Inputs: no named parameters.
get_ws_token_legacyA
Deprecated: use create_ws_token_legacy. Mint a short-lived (60s, single-use) token for the legacy public /stream endpoint via POST /ws-tokens. Prefer create_ws_token (/ws/token) for new code; this is kept for /stream compatibility. The response carries ws_endpoint for the configured network. Requires API credentials.
Inputs: no named parameters.
list_agentsA
Deprecated: use fetch_agents. List the delegated agent keys registered for the authenticated wallet (address, label, expiry). Requires API credentials.
Inputs: no named parameters.
list_api_keysA
Deprecated: use fetch_api_keys. List the HMAC API keys for the authenticated wallet (key ids and metadata; never the secrets). Authenticates with the session token from login, or NEXUS_EXCHANGE_SESSION_TOKEN.
Inputs: no named parameters.
list_bridge_deposit_addressesA
Deprecated: no server implements this route (its design was cancelled, ENG-11460), so every call fails. List the authenticated account's cross-chain deposit addresses across chains. Requires API credentials.
Inputs: no named parameters.
list_bridge_depositsA
Deprecated: use fetch_bridge_deposits. List the authenticated account's cross-chain (bridge) deposits, newest first. Optionally filter by source chain, asset (USDC|USDX), or status (detected|confirming|credited|failed). Distinct from fetch_deposits, which lists the account's ledger deposits. Requires API credentials.
Inputs: asset, chain, limit, status.
list_bridge_walletsA
List the authenticated account's registered withdrawal wallets. Wallets are not chain-scoped: one EVM address is valid on every supported EVM chain, and the chain is chosen per withdrawal. In this cut an account holds at most one wallet and both verified and is_default are always true on it, so do not branch on either — they start varying only with the wallet-lifecycle follow-up. An empty wallets array means nothing is registered yet; use create_bridge_wallet_challenge then register_bridge_wallet. Requires API credentials.
Inputs: no named parameters.
list_depositsA
Deprecated: use fetch_deposits. List the authenticated account's deposit history. Requires API credentials.
Inputs: limit.
list_marketsA
Deprecated: use fetch_markets_summary. List all tradable markets with their current summary (mark price, 24h change, volume, open interest, funding). Public — no credentials needed.
Inputs: no named parameters.
list_market_specsA
Deprecated: use fetch_markets. List all markets with their static specs (tick size, lot size, leverage, contract details) — the raw market definitions without live summary stats. Public — no credentials needed. (Use fetch_markets_summary for live mark price / volume / funding.)
Inputs: no named parameters.
loginA
Sign in with an EVM wallet to get a 24h session token. Submit an EIP-191 personal_sign signature over the exact message "Sign in to Nexus Exchange", made in the wallet and passed as signature. Omit signature to have the stdio server sign with its own wallet (see create_wallet; play-funds targets only). The returned token is the Bearer credential for the *_api_key tools. The stdio server keeps it for the rest of this session and saves it for this network in the Nexus CLI config (saved_to names the file), so nothing has to be copied into the environment. No credentials needed to call this.
Inputs: message, signature.
place_orderA
Deprecated: use create_order. Place an order on a market, buy/sell. Supports limit, market, stop-loss (stop_limit / stop_market), take-profit (take_profit_limit / take_profit_market), and trailing (trailing_stop / trailing_limit) orders. Limit-family orders require a price; stop / take-profit orders require a trigger_price; trailing orders require trailing_offset_bps (and trailing_limit also limit_offset_bps). Requires API credentials. This submits a REAL order to the matching engine.
Inputs: side (required), size (required), type (required), market_id (required), +6 more.
place_orders_batchA
Deprecated: use create_orders. Submit multiple orders in one request. Each order has the same shape as create_order (market_id, side, type, size, and the type-dependent price / trigger_price / trailing offsets / time_in_force / reduce_only). Requires API credentials. This submits REAL orders to the matching engine.
Inputs: orders (required).
preview_orderA
Preview an order without submitting it: projects the margin, equity, and fee impact of the order. Takes the same arguments as create_order. Nothing reaches the matching engine. Requires API credentials.
Inputs: side (required), size (required), type (required), market_id (required), +6 more.
register_agentA
Register a delegated agent key so an AI agent can trade on a wallet's behalf without holding the wallet key. Authorized by an EIP-712 signature from the OWNER WALLET over RegisterAgent{agent, expiresAt, nonce} (domain Nexus Exchange v1). Sign it in the wallet and pass wallet and signature, or omit both to have the stdio server sign with its own wallet (see create_wallet; testnet and local only, expiry defaulting to now+30d). No API credentials are needed; the signature is the authorization.
Inputs: agent (required), nonce (required), label, wallet, +2 more.
register_bridge_walletA
Step 2 of registering a withdrawal wallet: submit the address, the message returned by create_bridge_wallet_challenge echoed back VERBATIM, and the EIP-191 signature over it. Omit signature to have the stdio server sign with its own wallet (see create_wallet; play-funds targets only, and address must be that wallet). The address recovered from the signature must equal address, and the challenge must name the authenticated account. The registered wallet is where withdrawals are paid, so getting it wrong matters: an account holds ONE wallet in this cut and replacement is not supported — registering a different address afterwards is refused with 409 wallet_already_registered rather than updating the record. Because of that you must pass confirm: true. Re-registering the SAME address is idempotent and returns the existing record. Errors: invalid_address, invalid_challenge, challenge_expired, signature_mismatch, account_mismatch on 400; wallet_registration_unavailable on 503 when the deployment has no challenge key (not transient — do not retry). Requires API credentials.
Inputs: address (required), message (required), confirm, signature.
revoke_agentA
Revoke a previously registered delegated agent key by its address. Destructive: the agent can no longer trade on the wallet's behalf. To avoid an accidental revoke you must pass confirm: true. Requires API credentials.
Inputs: address (required), confirm.
set_cancel_on_disconnectA
Enable or disable cancel-on-disconnect (COD) for the authenticated account. Pass enabled: true to arm the dead man's switch (the exchange cancels all resting orders when your authenticated WebSocket drops and does not reconnect within the grace window) or enabled: false to disable it. Off by default. enabled is required and explicit — there is no default — so every call states the intended state and an argless call is rejected rather than silently toggling. Returns the resulting COD status. Requires API credentials.
Inputs: enabled (required).
submit_depositA
Deprecated: use create_deposit. Submit a (testnet/synthetic) deposit for the authenticated account via the deposits ledger (POST /deposits — unlike deposit, the deposit is recorded and listable with fetch_deposits). amount is a positive decimal string; asset defaults to USDX. Requires API credentials. This moves REAL collateral on the account.
Inputs: amount (required), asset.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 115 tools
Roughly half the surface consists of deprecated aliases that duplicate a live tool one-to-one (get_balance/fetch_balance, get_orderbook/fetch_order_book, place_order/create_order, amend_order/edit_order, list_deposits/fetch_deposits, etc.), so an agent must constantly resolve 'which of these two identical tools do I call?'. On top of that, several tools are admitted dead ends that always fail (create_bridge_deposit_address, list_bridge_deposit_addresses, get_deposit_target), and get_deposit vs create_deposit vs deposit_collateral add further near-miss overlap.
Two competing conventions coexist: the modern set uses fetch_*/create_*/edit_*/cancel_*/register_* while the deprecated set uses get_*/list_*/place_*/amend_*/adjust_*. Within each family the verb_noun pattern is readable, but mixing get_/fetch_ and place_/create_ across the same resource is exactly the inconsistency the rubric penalizes.
115 tools is an extreme mismatch for any single server. Even after removing the ~45 deprecated aliases, the live surface is 60+ tools, which far exceeds a well-scoped set and forces the agent to carry a large mental model of near-duplicates.
Domain coverage is actually broad and strong: markets/tickers/orderbook/OHLCV/funding, full order lifecycle (create, batch, preview, edit, cancel, cancel-all), account/positions/PnL/fees/history, deposits/withdrawals/bridge, API keys, agent keys, wallets, and WS tokens. The main gap is that a few advertised bridge/deposit-target tools have no working server implementation, leaving genuine dead ends.
Maintenance
Related MCP Connectors
Trading MCP server for AI agents, with live market data, account reads and controlled execution.
Nifty's MCP server — exposes tasks, projects, messages, and files as tools for AI agents.
MCP server exposing the Backtest360 engine API as tools for AI agents.
Related MCP Servers
- FlicenseBqualityFmaintenanceAn MCP server that enables AI models like Claude to interact with the Trading Simulator API for checking balances, viewing prices, and executing trades with automatic chain detection.15-
- AlicenseBqualityDmaintenanceAn MCP server that provides cryptocurrency project data to AI agents11MIT
- AlicenseNot gradedqualityDmaintenanceAn MCP server that gives AI agents direct access to Polymarket Crypto prediction markets, enriched with live spot prices. Discover markets, analyze order books, paper trade strategies, track activity, and execute live trades — all through natural language.1AGPL 3.0
- AlicenseBqualityBmaintenanceAn MCP server that enables AI agents to scan the market, manage positions, and retrieve trading metrics for Bybit through natural language commands.1023AGPL 3.0