NinjaTrader 8 MCP Server
Trade, read positions and control charts in a running NinjaTrader 8 desktop through a NinjaScript Add-On
Reads and trades NinjaTrader 8 accounts, positions, orders and market data over MCP
By ozmnf4 (individual) JavaScript Local · stdio Finance and payments
19 popularity score ★ 36
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/ozmnf4/ninjatrader-mcp.git
cd ninjatrader-mcp
npm installclaude mcp add ninjatrader -- node '<ABSOLUTE_PATH_TO_CLONE>/src/server.js'{
"mcpServers": {
"ninjatrader": {
"command": "node",
"args": [
"<ABSOLUTE_PATH_TO_CLONE>/src/server.js"
]
}
}
}{
"mcpServers": {
"ninjatrader": {
"command": "node",
"args": [
"<ABSOLUTE_PATH_TO_CLONE>/src/server.js"
]
}
}
}{
"servers": {
"ninjatrader": {
"type": "stdio",
"command": "node",
"args": [
"<ABSOLUTE_PATH_TO_CLONE>/src/server.js"
]
}
}
}[mcp_servers.ninjatrader]
command = "node"
args = ["<ABSOLUTE_PATH_TO_CLONE>/src/server.js"]gemini mcp add --scope user ninjatrader node -- '<ABSOLUTE_PATH_TO_CLONE>/src/server.js'NINJATRADER_MODE |
Optional: local (default, NinjaTrader Desktop Add-On) or cloud (Ecosystem API). |
|---|---|
NINJATRADER_LOCAL_URL |
Optional: Address of the local Add-On HTTP server; default http://localhost:7890. |
NINJATRADER_API_KEY |
Optional: NinjaTrader Ecosystem API key; needed in cloud mode only. |
A small Node.js stdio server that puts a NinjaTrader 8 account in reach of an MCP client. Its 18 tools list accounts, balances and margin, show open positions, place, change and cancel orders, fetch quotes, historical bars, order-book depth and instrument searches, and in local mode read indicator values and chart state or start a NinjaScript strategy.
It has two modes, chosen with NINJATRADER_MODE. Local mode, the default, sends plain HTTP requests to an endpoint on the same machine (http://localhost:7890 unless NINJATRADER_LOCAL_URL says otherwise) that a NinjaScript Add-On inside NinjaTrader Desktop is expected to serve. Cloud mode sends requests to https://api.ninjatrader.com with NINJATRADER_API_KEY as a bearer token.
The repository does not ship that Add-On: it holds only src/server.js, src/api.js, the README, a setup guide and a TODO list, and the README points to NinjaTrader's developer portal for building one. The server is a hand-written JSON-RPC loop announcing protocol 2024-11-05 and version 1.0.0, with no published package; it runs from a clone. In src/api.js the cloud sign-in is marked as a placeholder ("Actual auth flow depends on NinjaTrader's Ecosystem API"), and the bearer token is only set when nt_health_check runs, so cloud calls made before a health check go out without a valid token.
| Runtime | Node.js 18+ |
|---|
Node.js 18 or later and a clone of the repository with npm install run in it. Local mode: NinjaTrader 8 Desktop running (Windows) with a NinjaScript Add-On that serves the HTTP endpoints the server calls on port 7890; you must supply or build that Add-On yourself. Cloud mode: a NinjaTrader Ecosystem account and an API key from the NinjaTrader developer portal.
nt_indicator_values, nt_chart_state and nt_execute_strategy return an error outside local mode. The Add-On local mode depends on is not included, and the repository's own TODO.md (2026-04-05) still lists the NinjaTrader connection test as pending. Cloud sign-in is a stub that passes the API key straight through as a bearer token, and only after nt_health_check has run. Settings are read with dotenv from a .env file in the working directory, which is usually not the clone when a client starts it, so pass them as environment variables in the client config. Local requests time out after 10 seconds; nt_historical_bars returns 100 bars of interval 1 by default.
Suits a NinjaTrader 8 user comfortable with NinjaScript who already runs, or will write, a local Add-On exposing an HTTP API and wants an assistant to read positions and place orders through it. Since its tools can place and cancel real orders, try it on a simulation account first. Anyone wanting something that works without writing their own bridge should look elsewhere: we also hold an official NinjaTrader entry (official-ninjatrader-mcp, published by nt-ninjatrader) and another community ninjatrader-mcp by anfs-pain.
nt_accountsnt_account_infont_account_balancent_positionsnt_positionnt_ordersnt_place_ordernt_modify_ordernt_cancel_ordernt_cancel_all_ordersnt_quotent_historical_barsnt_market_depthnt_search_instrumentsnt_indicator_valuesnt_chart_statent_execute_strategynt_health_check