Skip to content

MCP server (AI clients)

The terminal can host a local MCP server (Model Context Protocol - the open standard AI assistants use to call tools), so an AI client like Claude Code or Claude Desktop can connect to your running terminal and work with it: pull candles and the order book, run the setup scanner, read your account and positions, write and backtest bot scripts, and - only behind explicit opt-ins - place trades and run bots.

Everything stays on your machine. The server binds to 127.0.0.1 only, requires a generated access token, and is off by default. Where the AI Coach brings an AI’s read into your manual orders, the MCP server is the reverse door: your AI assistant reaching into the terminal - with you deciding exactly how far.

Where: Settings ▸ AI / LLM ▸ MCP ServerTransport: local-only HTTP (127.0.0.1)Default: off; trading gated separately
📷
Screenshot needed
id: trading-mcp-server

The MCP Server settings: enable toggle, port, the tiered trading permissions, and the access token with its ready-made connect command

suggested 1280x720

Once connected, the assistant sees a catalog of tools:

  • Market data - candles on any timeframe, the L2 order book, recent trades (time & sales), tradable symbols - on any connected venue, not just the active one.
  • Account & positions - equity, cash, margin, PnL, open positions, working orders.
  • The scanner - scan_symbol runs the terminal’s real detection pipeline on demand: all 98 detectors plus the Monte-Carlo odds engine, so the AI gets the same scored setups your charts show.
  • Your record - trade history and performance stats, broken down by origin. Orders an AI places are tagged mcp, so you can ask it how its own trades are doing.
  • The strategy loop - write a Lua bot script, compile-check it (errors come back with line numbers), backtest it with the terminal’s engine (fees, slippage, brackets, no lookahead), save it to your script library, and create a bot from it. Created bots always start stopped.
  • Trading (opt-in) - place, modify, and cancel orders, set position brackets, close positions, and start bots.
  1. Open Settings ▸ AI / LLM and scroll to MCP Server.
  2. Toggle Enable MCP server. The status line shows it running on 127.0.0.1:8078 (change the port if something else owns it), and an access token is generated - every client must present it.
  3. Leave the trading toggles off until you want them (see the safety model below).

The settings section shows a ready-made connect command with your port and token filled in.

Claude Code connects natively - paste the command from settings:

Terminal window
claude mcp add --transport http nocterm http://127.0.0.1:8078/mcp \
--header "Authorization: Bearer <your token>"

Claude Desktop can’t speak HTTP directly, so the app ships a tiny bridge - nocterm-mcp - inside the app bundle. It finds your port and token by itself, so the Claude Desktop config is just the path:

{
"mcpServers": {
"nocterm": { "command": "/Applications/Nocterm Trader.app/Contents/MacOS/nocterm-mcp" }
}
}

(On Linux the bridge is usr/bin/nocterm-mcp inside the AppImage.) Fully quit and reopen Claude Desktop after editing the config. The bridge reconnects on its own if you restart the terminal, and if the terminal isn’t running it tells the AI exactly that instead of failing cryptically.

A good first prompt to prove the pipe works:

Using the nocterm tools: list my venues, pull the last 10 one-minute candles for XBTUSD, and give me a one-line read on the price action.

Permissions are tiered, and every toggle applies instantly - mid-conversation:

toggledefaultwhat it allows
Enable MCP serveroffRead-only everything: data, scanner, account, history, scripts, backtests.
Allow tradingoffOrder placement, modification, cancels, closes, brackets - and starting bots.
Allow live venuesoffWithout it, orders only ever reach paper venues; live venues refuse with a message naming this toggle.

Three things to understand about the contract:

  • There are no per-order confirmation prompts. With trading enabled, the AI’s orders execute. The design trades prompts for visibility: every call is written to the Logs panel, every action raises a toast, and every order lands in your local History attributed to mcp.
  • Stopping is always allowed. An AI can stop a running bot even with trading off - halting risk should never require a permission.
  • Writing scripts and running backtests are deliberately ungated: they produce files and simulations, never orders. The gate sits at the arming step (start_bot, placing).

The tools compose into a full development loop the assistant can drive end to end: draft a bot script in the same Lua dialect as custom indicators, validate it (compile errors come back line-numbered), backtest it over real venue candles, iterate until the numbers hold up, save it, and create a bot bound to a venue, symbol, and timeframe. For example:

Write an RSI mean-reversion bot, validate it, and backtest it on XBTUSD 1h over 1000 bars. If the profit factor beats 1.2, save it and create a paper bot with a $500 allocation - but don’t start it.

The bot appears in your Bots dashboard like any other - same journal, same guardrails, same controls - and starting it remains your call (or the AI’s, if you’ve enabled trading).

All 26 tools, as the AI sees them. Arguments marked ? are optional. Every venue-scoped tool takes venue? - one of nocterm (paper crypto), kraken, kraken_prop, or alpaca (US stocks) - and defaults to the terminal’s active venue when omitted.

toolargumentswhat it returns
list_venues-Venue keys, connection state, paper vs live, whether trading is currently allowed there (and why not). The recommended first call.
list_symbolsvenue?The venue’s tradable symbols.
get_candlessymbol, timeframe, limit? (200, max 1000), venue?Historic OHLCV; time is epoch seconds, the last bar may still be forming.
get_orderbooksymbol, depth? (25, max 100), venue?L2 snapshot, [price, qty] per level.
get_recent_tradessymbol, limit? (50, max 500), venue?Time & sales from the venue’s own tape; side is the taker side.
get_accountvenue?Equity, cash, margin, realized/unrealized PnL, leverage.
get_positionsvenue?Open positions.
get_open_ordersvenue?Working orders.
toolargumentswhat it returns
scan_symbolsymbol, timeframe, scan_bars? (10, max 50), venue?Setups that fired in the last N closed bars: all 98 detectors, each hit scored by the Monte-Carlo odds engine (p_target_before_stop, R:R, EV in R, median time-to-resolve).
get_trade_historykind? (orders / closes / all), limit? (50, max 500), search?, from_ms?, to_ms?Orders placed through the terminal (with origin attribution) and closed round trips, newest first.
get_performance_statsfrom_ms?, to_ms?, search?Wins/losses, win rate, realized PnL, fees, order/rejection counts, and per-origin + per-symbol breakdowns.
toolargumentswhat it does
list_scripts-Every script in your library, by name and kind.
get_scriptnameA script’s Lua source.
validate_scriptsource, name?Compile-check without saving; errors carry :LINE: markers.
save_scriptname, sourceSave into the library, routed by the script’s declared type. Saves even on compile failure (the error comes back so the AI can iterate).
run_backtestscript? or source?, symbol, timeframe, bars? (1000, max 5000), fee_bps? (25), slippage_bps? (2), params?, venue?Backtest with the terminal’s engine - next-bar-open fills, fees + slippage, brackets, allocation caps. Returns the tearsheet: returns, drawdown, Sharpe/Sortino, trade stats, recent round trips, equity curve, script log.
toolargumentsgatewhat it does
list_bots--Configs, status (Stopped / Running / Halted), journal stats.
get_bot_journalbot_id-One bot’s activity log, journaled orders, closed positions.
create_botname, script, symbol, timeframe, allocation_quote? (1000), venue?-Create from a saved bot script. Born Stopped.
start_botbot_idtrading + live-venueThe arming step - the bot then trades autonomously per its script.
stop_botbot_idnoneGraceful stop: cancels working orders, keeps the position. Always allowed.

Order writes (require Allow trading; live venues additionally require Allow live venues)

Section titled “Order writes (require Allow trading; live venues additionally require Allow live venues)”
toolargumentswhat it does
place_ordersymbol, side, quantity, limit_price?, trigger_price?, stop_price?, target_price?, time_in_force?, venue?Type inferred: limit_price → limit, trigger_price → stop, both → stop-limit, neither → market. stop_price / target_price add protective brackets; TIF is gtc (default), ioc, fok, or post_only.
modify_orderorder_id, limit_price?, trigger_price?, quantity?, stop_price?, target_price?, venue?Edit a working order in place; omitted fields are unchanged. Venue support varies - unsupported venues say so.
set_position_bracketsposition_id, stop_price?, target_price?, clear_stop?, clear_target?, venue?Set or remove a position’s TP/SL legs.
cancel_orderorder_id, venue?Cancel a working order.
close_positionposition_id, quantity?, venue?Close fully, or partially with quantity.
  • Treat Allow live venues as the real switch. Paper-only mode lets you watch an AI trade for weeks before any real order is possible.
  • The token guards the port against anything else on your machine (including web pages poking at localhost). Regenerate it any time; connected clients then need the new one.
  • The scanner an AI calls is the same attention router you use - it surfaces candidates and scores geometry; it doesn’t make a weak setup good, and neither does the AI asking for it.
  • One backtest proves little. Make the assistant vary symbol, timeframe, and window before either of you trusts a script.