NinjaTrader MCP Server
Reads and trades NinjaTrader 8 accounts, positions, orders and market data over MCP
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
Opens the app, which asks before it adds the server. Then replace each <NAME> in its settings with your value.
git clone https://github.com/anfs-pain/ninjatrader-mcp.git
cd ninjatrader-mcp && npm installclaude mcp add ninjatrader-8 -- node '<ABSOLUTE_PATH_TO_CLONE>/src/server.js'{
"mcpServers": {
"ninjatrader-8": {
"command": "node",
"args": [
"<ABSOLUTE_PATH_TO_CLONE>/src/server.js"
]
}
}
}{
"mcpServers": {
"ninjatrader-8": {
"command": "node",
"args": [
"<ABSOLUTE_PATH_TO_CLONE>/src/server.js"
]
}
}
}{
"servers": {
"ninjatrader-8": {
"type": "stdio",
"command": "node",
"args": [
"<ABSOLUTE_PATH_TO_CLONE>/src/server.js"
]
}
}
}[mcp_servers.ninjatrader-8]
command = "node"
args = ["<ABSOLUTE_PATH_TO_CLONE>/src/server.js"]gemini mcp add --scope user ninjatrader-8 node -- '<ABSOLUTE_PATH_TO_CLONE>/src/server.js'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. |
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.
| Runtime | Node.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.
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.
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.
nt_health_checknt_connection_statusnt_accountsnt_account_infont_account_balancent_positionsnt_positionnt_ordersnt_place_ordernt_modify_ordernt_cancel_ordernt_cancel_all_ordersnt_close_positionnt_flatten_allnt_quotent_historical_barsnt_market_depthnt_search_instrumentsnt_instrument_infont_chart_listnt_chart_statent_chart_instrumentnt_chart_reloadnt_strategies_runningnt_strategy_stopnt_indicator_values