nexus-exchange-mcp
OfficialThe Nexus Exchange MCP server enables AI agents to read real-time market data and manage trades on the Nexus Exchange using the Model Context Protocol.
Public Market Data (no credentials needed)
List all markets, get tickers, order books, mark prices, market status, recent trades, candlestick data, and funding history.
Demo Account (no credentials needed)
View a live demo account's balance, equity, open positions, and open orders.
Authenticated Account Management (requires API key)
Check real account balance, equity, open positions, open orders, order history, fills, withdrawals, ADL history, and rate limit status.
Deposit collateral and claim credit.
Trading Operations (requires API key)
Place limit or market orders (buy/sell), including reduce-only and time-in-force options.
Place batch orders or cancel orders by ID or cancel all open orders at once.
Agent & API Key Management
Log in using a wallet signature to obtain a session token.
Create, list, and delete API keys.
List and revoke delegated trading agents (registering agents requires an external EIP-712 signature).
WebSocket & Utility
Generate WebSocket authentication tokens for direct streaming connections.
Check server health status.
Admin Tools (opt-in, requires admin secret)
List, set, and delete account fee tiers.
Pending / Not Yet Available
get_deposit_target(on-chain deposit address) is pending server-side implementation.
Click on "Install 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-mcpWhat'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
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
Most tools now target the direct-indexer /api/v1 surface served at the
host root (ENG-4740 — the indexer serves its REST API directly instead of via
the gateway REST proxy). The routes that have no /api/v1 equivalent stay on
the legacy /api/exchange gateway, which remains live dual-stack
(ENG-4751), so nothing breaks. See "Migration to /api/v1" 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 + direct gateway) |
|
| ✅ Live (needs key + direct gateway) |
|
| ✅ Live (needs key + direct gateway) |
|
| ✅ Live (needs key + direct gateway) |
|
| ✅ Live (needs key + direct gateway) |
|
| ✅ Live (needs key + direct gateway) |
|
| ✅ Live (needs key + direct gateway) |
|
| ✅ Live (needs key + direct gateway) |
|
| ✅ Live (needs key + direct gateway) |
|
| ✅ Live (needs key + direct gateway) |
|
| ✅ Live (needs key + direct gateway) |
|
| ✅ Live (needs key + direct gateway) |
|
| ✅ Live (needs key + direct gateway) |
|
| ✅ Live (needs key + direct gateway) |
|
| ✅ Live (needs key + direct gateway) |
|
| ✅ Live (needs key + direct gateway) |
|
| ✅ Live (needs key + direct gateway) |
|
| ✅ Live (needs key + direct gateway) |
|
| ✅ Live (needs key + direct gateway) |
|
| ✅ Live (needs key + direct gateway) |
|
| ✅ Live (needs key + direct gateway) |
|
| ✅ Live (needs key + direct gateway) |
|
| ✅ Live (needs key + direct gateway) |
|
| ✅ Live (needs key + direct gateway) |
|
| ✅ Live (needs key + direct gateway) |
|
| ✅ Live (needs key + direct gateway) |
|
| ✅ Live (needs key + direct gateway) |
|
| ✅ Live (needs key + direct gateway) |
|
| ✅ Live (needs key + direct gateway) |
|
| ✅ Live (needs key + direct gateway) |
|
| ✅ Live (public) |
|
| ✅ Live (needs key + direct gateway) |
|
| ✅ Live (needs key + direct gateway) |
|
| ✅ Live (needs key + direct gateway) |
|
| ✅ Live (needs key + direct gateway) |
|
| ✅ Live (needs key + direct gateway) |
|
| ✅ Live (needs caller EIP-712 signature) |
|
| ✅ Live (needs key + direct gateway) |
|
| ✅ Live (needs caller EIP-191 signature) |
|
| ✅ Live (needs session token) |
|
| ✅ Live (needs session token) |
|
| ✅ Live (needs session token) |
|
| ✅ Live (needs key + direct gateway) |
|
| ✅ Live (needs key + direct gateway) |
|
| ✅ 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. On the direct surface
it is superseded by the bridge deposit-address tools
(create_bridge_deposit_address / list_bridge_deposit_addresses), which
return real per-chain on-chain deposit addresses — prefer those; the legacy
single-target lookup is still unbuilt server-side.
Migration to /api/v1
Per ENG-4740 the gateway REST proxy is being eliminated: each backend
service exposes its own REST API and the indexer serves the exchange surface
directly under /api/v1 at the host root. This server calls those routes for
the v0.7.2 operations it exposes as tools (see
API-surface coverage below).
Base URL is the host root (
https://exchange.nexus.xyz), not the…/api/exchangegateway path./api/v1/*resolves at the root; the legacy-only routes append/api/exchange. ANEXUS_EXCHANGE_API_URLthat still ends in/api/exchangeis accepted and normalized.HMAC signs the full path the server verifies — e.g.
/api/v1/ordersfor v1 routes, the bare route (/orders) for legacy ones.cancel_orderrequiresmarket_idwhen cancelling a single order (the v1 route marks it required);market_idis optional withcancel_allto scope a mass-cancel to one market.Stay on the legacy gateway (no
/api/v1route):list_market_specs,get_market_risk_params,get_order(v1 mounts only PATCH + DELETE on/orders/{id}),get_withdrawals,list_deposits,get_funding_payments,get_adl_history,get_market_adl_events,deposit_collateral,submit_deposit,claim_faucet,adjust_isolated_margin, the agent / api-key / admin-tier tools,get_ws_token*,get_service_status, and thedemo/*reads. (The cancel-on-disconnect and bridge tools are v1-native.)
API-surface coverage
The tool surface covers 63 of the 65 distinct operations in Exchange API
spec v0.7.2 (98 spec operations counting the /api/v1 aliases of the
legacy routes; each aliased pair is one tool).
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 (the spec version each
addition shipped in is noted):
Portfolio parity (v0.7.2) —
get_portfolio_history(GET /api/v1/account/portfolio-history: equity + PnL + volume series over aday/week/month/allwindow),get_account_state(GET /api/v1/account/state: summary + open positions from one coherent read), andget_account_fees(GET /api/v1/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 (get_balance,get_positions,get_account_state,get_account_summary) call them out in their descriptions instead.Account cancel-on-disconnect (v0.7.1) —
get_cancel_on_disconnect/set_cancel_on_disconnect(GET/PUT /api/v1/account/cancel-on-disconnect)./api/v1/bridgePhase A (v0.7.1) —get_bridge_assets(public catalog),create_bridge_deposit_address,list_bridge_deposit_addresses,list_bridge_deposits, andget_bridge_deposit(five operations).Conditional order types (v0.7.0) —
place_order/place_orders_batch/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.
The remaining 2-operation gap is the WebSocket upgrade endpoints GET /ws
and GET /stream, unmapped by design: a request/response MCP tool cannot hold a
streaming socket open, so the server instead mints the auth token
(get_ws_token / get_ws_token_legacy) the caller uses to connect to them
directly.
One v0.7.2 addition is not exposed: the opaque cursor query parameter
(ENG-5506) documented on get_trades, get_fills, get_order_history,
get_closed_positions, and get_equity_history for keyset pagination. It adds
no route, so the operation count above is unaffected. Two reasons it is not
wired up: the spec is ahead of the indexer, which does not serve the
X-Next-Cursor header yet, and consuming that header would mean wrapping those
five tools' results in an envelope — an output-shape change to already-shipped
tools. Tracked as ENG-7424, blocked on ENG-5506.
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
get_service_status (/status).
Authorization tiers
Public — no credentials.
HMAC (key + direct gateway) — account reads, trading, agent/funding actions. Uses
NEXUS_EXCHANGE_API_KEY/NEXUS_EXCHANGE_API_SECRET. See the "Authentication" note below about the public proxy.Caller signature —
login(EIP-191) andregister_agent(EIP-712) carry a wallet signature the caller produces externally; this server never holds a wallet key and cannot sign for you.Session token — the
*_api_keytools authenticate with a Bearer session token fromlogin, set asNEXUS_EXCHANGE_SESSION_TOKEN.Admin (opt-in) —
list_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_order's mass-cancel) require an explicit confirm: true /
cancel_all: true flag so a stray call can't do damage by accident.
Related MCP server: CryptoConduit-MCP
Quick start
npm install
npm run build
npm start # runs the stdio MCP servernpm start waits on stdio for an MCP client; it is meant to be launched by
Claude rather than run by hand. To verify it works end-to-end against the live
API without a client, use the smoke check:
npm run smoke # lists tools, calls list_markets against productionExpected output ends with list_markets OK -> N markets.
Environment variables
Copy .env.example and set as needed. Only trading/account tools need
credentials — never commit real secrets.
Variable | Required | Purpose |
| No | API host root (serves |
| For account/trade tools | HMAC API key id ( |
| For account/trade tools | HMAC secret (hex). |
| For | Bearer session token from |
| For admin tools | Operator admin secret ( |
| No | Set to |
API version
Currently targets Exchange API spec v0.7.2.
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 drift CI job fetches the pinned release
to check for drift, and the scheduled api-version-sync workflow opens a PR when
a newer spec releases. The line above is bot-managed; everything around it is
human-owned.
Every upstream request also sends this pin as an X-Nexus-Api-Version: <tag>
header (e.g. X-Nexus-Api-Version: v0.7.2), 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
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.
For /api/v1 routes the signed path includes the prefix (e.g. /api/v1/orders);
for legacy gateway routes it is the bare path (e.g. /orders). The client signs
whatever path it sends, which is exactly what the indexer verifies over.
Important: the public production host still fronts authenticated requests with a
proxy that signs with the site's own frontend key, so per-caller HMAC headers
are not honored there — authenticated tools resolve to the site account, not
yours. To trade as a specific account, point NEXUS_EXCHANGE_API_URL at a
direct indexer gateway that verifies client HMAC (for example a local
http://localhost:9090 from the exchange docker-compose). Until then, use the
public get_demo_* tools to demo the account flow with no secrets.
Claude Desktop config
Add this to your Claude Desktop config
(~/Library/Application Support/Claude/claude_desktop_config.json on macOS),
adjusting the absolute path to this package's dist/index.js:
{
"mcpServers": {
"nexus-exchange": {
"command": "node",
"args": ["/ABSOLUTE/PATH/TO/nexus-exchange-mcp/dist/index.js"],
"env": {
"NEXUS_EXCHANGE_API_URL": "https://exchange.nexus.xyz"
}
}
}
}To enable trading, add NEXUS_EXCHANGE_API_KEY / NEXUS_EXCHANGE_API_SECRET
to the env block and set NEXUS_EXCHANGE_API_URL to a direct gateway.
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
list_markets/get_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.
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>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 falls back to any server-env credentials. Open question for review: 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.
Development
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 smoke # live end-to-end check against the gatewayLicense
Dual-licensed under MIT or Apache-2.0, at your option — same as the other Nexus Exchange SDKs.
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
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.Last updated15
- Alicense-qualityCmaintenanceAn 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.Last updated1AGPL 3.0
- Alicense-qualityCmaintenanceAn MCP server that enables AI agents to scan the market, manage positions, and retrieve trading metrics for Bybit through natural language commands.Last updated1MIT
- Alicense-qualityBmaintenanceAn MCP server that lets you talk to your AI trading assistant in plain English to research stocks, generate trade recommendations, manage a portfolio, and execute trades through natural language.Last updatedMIT
Related MCP Connectors
MCP server exposing the Backtest360 engine API as tools for AI agents.
MCP server for Gainium — manage trading bots, deals, and balances via AI assistants
An MCP server that gives your AI access to the source code and docs of all public github repos
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/nexus-xyz/nexus-exchange-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server