NinjaTrader 8 MCP Server

Trade, read positions and control charts in a running NinjaTrader 8 desktop through a NinjaScript Add-On

By anfs-pain (individual) JavaScript Local · stdio Finance and payments

11 popularity score ★ 7

Connect your client

Local (from source)

Add in one click

Opens the app, which asks before it adds the server. Then replace each <NAME> in its settings with your value.

Or add it by command or config

FirstTerminal
git clone https://github.com/anfs-pain/ninjatrader-mcp.git
cd ninjatrader-mcp && npm install
Claude CodeTerminal
claude mcp add ninjatrader-8 -- node '<ABSOLUTE_PATH_TO_CLONE>/src/server.js'
Claude Desktopclaude_desktop_config.json
{
  "mcpServers": {
    "ninjatrader-8": {
      "command": "node",
      "args": [
        "<ABSOLUTE_PATH_TO_CLONE>/src/server.js"
      ]
    }
  }
}
Cursor~/.cursor/mcp.json
{
  "mcpServers": {
    "ninjatrader-8": {
      "command": "node",
      "args": [
        "<ABSOLUTE_PATH_TO_CLONE>/src/server.js"
      ]
    }
  }
}
VS Code.vscode/mcp.json
{
  "servers": {
    "ninjatrader-8": {
      "type": "stdio",
      "command": "node",
      "args": [
        "<ABSOLUTE_PATH_TO_CLONE>/src/server.js"
      ]
    }
  }
}
Codex~/.codex/config.toml
[mcp_servers.ninjatrader-8]
command = "node"
args = ["<ABSOLUTE_PATH_TO_CLONE>/src/server.js"]
Gemini CLITerminal
gemini mcp add --scope user ninjatrader-8 node -- '<ABSOLUTE_PATH_TO_CLONE>/src/server.js'

Settings 3

NINJATRADER_MODE Optional: local (default) talks to the Add-On; any other value sends requests to NinjaTrader's cloud API instead.
NINJATRADER_LOCAL_URL Optional: Address of the Add-On's HTTP service; defaults to http://localhost:7890.
NINJATRADER_API_KEY Optional: Bearer key for https://api.ninjatrader.com, used only outside local mode.

What it does

This server connects an MCP client to NinjaTrader 8, the Windows trading platform. NinjaTrader has no outside API for the desktop, so the project ships two parts: a NinjaScript Add-On (McpBridgeAddon.cs) that you compile inside NinjaTrader and that opens a small HTTP service on localhost:7890, and a Node.js stdio server (src/server.js) that turns that service into MCP tools.

With both running, the assistant can list accounts and balances, read open positions and orders, place, modify and cancel orders, close one position or flatten everything, pull quotes, Level 2 depth and instrument details, list open charts, switch a chart's instrument and reload its scripts, list and stop running NinjaScript strategies, and read an indicator's current values. It works against whatever account NinjaTrader is connected to: Sim, demo or live.

The source registers 26 tools, but four of their names differ from the README's feature table: the code calls them nt_historical_bars, nt_market_depth, nt_search_instruments and nt_chart_list (src/server.js). The code also has a second mode the README does not describe: with NINJATRADER_MODE set to anything other than local, requests go to https://api.ninjatrader.com with a bearer key from NINJATRADER_API_KEY (src/api.js). Several tools are marked local mode only.

What it needs

RuntimeNode.js 18+

Windows with NinjaTrader 8 running and the McpBridgeAddon.cs Add-On copied into its Custom\AddOns folder, compiled in the NinjaScript Editor and enabled. A NinjaTrader account connection (Sim, demo or live). Node.js 18 or newer and a clone of the repository with npm install run in it. Quotes and depth need the matching market-data subscriptions in NinjaTrader.

Limits

nt_historical_bars returns an empty placeholder rather than bars; the code notes that NinjaTrader history needs an async request and points to nt_quote instead. The Add-On's port is fixed at 7890 in its source. Each request times out after 10 seconds. Quotes return zeros when the market is closed or the symbol is not subscribed, and Sim orders outside regular hours come back Rejected. Symbols must use NinjaTrader's month-year form ("NQ 09-26"). nt_chart_instrument and nt_chart_reload are tagged Phase 2 in the code. It is not on npm; it runs from a clone.

Who it suits

Suits a NinjaTrader 8 user on Windows who wants an assistant to watch accounts, check charts and strategies, or manage orders on the desktop they already run. Because it can place orders and flatten all positions on any connected account, including live ones, try it on a Sim account first. It is a single developer's project, not NinjaTrader's own; we also hold an official NinjaTrader entry (nt-ninjatrader/mcp-skills) for those who prefer the vendor's tooling. Not for macOS or Linux users, or anyone without NinjaTrader 8.

Tools 26

nt_health_check
Checks that the Add-On is up and reports how many accounts it sees
nt_connection_status
Shows whether each broker connection is connected or not
nt_accounts
Lists trading accounts with balances and open position counts
nt_account_info
Returns details for one account, such as connection, P&L and buying power
nt_account_balance
Returns cash, net liquidation, realized and unrealized P&L for an account
nt_positions
Lists open positions, for all accounts or one
nt_position
Returns one position by account and instrument
nt_orders
Lists orders, filterable by account and status
nt_place_order
Submits a market, limit, stop or stop-limit order
nt_modify_order
Changes the quantity or prices of a working order
nt_cancel_order
Cancels one working order by ID
nt_cancel_all_orders
Cancels working orders for one account or all of them
nt_close_position
Closes a position in one instrument with a market order
nt_flatten_all
Closes every position and cancels every working order across all accounts
nt_quote
Returns bid, ask, last and volume for a subscribed instrument
nt_historical_bars
Asks for OHLCV bars; currently returns a placeholder with no bars
nt_market_depth
Returns the Level 2 order book, given an L2 subscription
nt_search_instruments
Searches NinjaTrader's instrument list, up to 50 matches
nt_instrument_info
Returns tick size, point value, exchange and type for an instrument
nt_chart_list
Lists open chart windows with symbol, timeframe and ID
nt_chart_state
Shows a chart's symbol, timeframe, indicators and strategies
nt_chart_instrument
Switches a chart to another instrument, for example at a futures roll
nt_chart_reload
Reloads the NinjaScript on a chart
nt_strategies_running
Lists running NinjaScript strategies and their state
nt_strategy_stop
Stops a running strategy by its class name
nt_indicator_values
Reads the current output values of an indicator on an open chart

Similar servers