NinjaTrader 8 MCP Server
Enables Claude Code to directly access NinjaTrader 8 accounts, positions, orders, market data, charts, and strategy management through a NinjaScript Add-On.
README
NinjaTrader 8 MCP Server
Claude Code integration for NinjaTrader 8. Gives Claude direct access to accounts, positions, orders, market data, charts, and strategy management through a NinjaScript Add-On running inside NT8.
Architecture
Claude Code (claude.ai/code)
| stdio JSON-RPC 2.0 (MCP protocol)
v
src/server.js (Node.js MCP server — 26 tools)
| HTTP localhost:7890
v
nt8-addon/McpBridgeAddon.cs (NinjaScript Add-On running inside NT8.exe)
| NT8 internal API
+-- Account.All -> accounts, balances, P&L
+-- Order.CreateOrder() -> place / cancel / modify orders
+-- Account.Positions -> open positions
+-- Instrument.All -> market data, quotes, instrument search
+-- ChartControl -> chart state, instrument, reload
+-- Strategy management -> enumerate and stop running strategies
Key difference from browser-based MCPs: NT8 has no external HTTP API.
McpBridgeAddon.cs is a NinjaScript Add-On that runs inside NT8's process and bridges
its internal .NET APIs to an HTTP listener on localhost:7890. Without it, nothing works.
Features (26 MCP tools)
| Category | Tools |
|---|---|
| Health | nt_health_check |
| Connections | nt_connection_status |
| Accounts | nt_accounts, nt_account_balance, nt_account_info |
| Positions | nt_positions, nt_position |
| Orders | nt_orders, nt_place_order, nt_modify_order, nt_cancel_order, nt_cancel_all_orders, nt_close_position, nt_flatten_all |
| Market Data | nt_quote, nt_instrument_info, nt_instrument_search, nt_bars, nt_depth |
| Charts | nt_charts, nt_chart_state, nt_chart_instrument, nt_chart_reload |
| Strategies | nt_strategies_running, nt_strategy_stop |
| Indicators | nt_indicator_values |
Quick Setup
Prerequisites
- NinjaTrader 8 (any account — Sim, Demo, or Live)
- Node.js 18+
- Claude Code
1. Install the Add-On
Copy McpBridgeAddon.cs to NT8's custom Add-Ons folder:
# Adjust the path to match your user directory
Copy-Item "nt8-addon\McpBridgeAddon.cs" `
"$env:USERPROFILE\OneDrive\Documents\NinjaTrader 8\bin\Custom\AddOns\McpBridgeAddon.cs" -Force
Or copy to:
%USERPROFILE%\Documents\NinjaTrader 8\bin\Custom\AddOns\McpBridgeAddon.cs
2. Compile in NT8
- Open NinjaTrader 8
- Control Center menu: New -> NinjaScript Editor
- In the left tree, expand Add-Ons -> click McpBridgeAddon
- Press F5 to compile
- If an authorization dialog appears ("NinjaTrader has detected new add-on(s)"), click Yes NT8 will restart and auto-enable the Add-On.
- If the port doesn't come up automatically: Tools -> Add-Ons -> check McpBridgeAddon -> OK
3. Verify the Add-On is running
curl.exe http://localhost:7890/api/health
# Expected: {"status":"ok","version":"1.2.0","port":7890,"accounts":N}
4. Install the MCP server
npm install
5. Register with Claude Code
Add to ~/.claude/settings.json under mcpServers:
"ninjatrader": {
"command": "node",
"args": ["C:/path/to/ninjatrader-mcp/src/server.js"],
"env": {
"NINJATRADER_MODE": "local",
"NINJATRADER_LOCAL_URL": "http://localhost:7890"
}
}
Restart Claude Code, then verify:
Use nt_health_check to verify NinjaTrader is connected.
Automated Boot (optional)
scripts/nt8-full-boot.ps1 automates the entire cold-start sequence:
- Launch NT8
- Complete Google OAuth login (reads credentials from
.env) - Select Simulation mode
- Open NinjaScript Editor -> compile McpBridgeAddon
- Detect and fix compile errors before proceeding
- Enable Add-On via Tools -> Add-Ons
- Verify port 7890 + run health check
cp .env.example .env # fill in NINJATRADER_USERNAME
powershell -ExecutionPolicy Bypass -File scripts\nt8-full-boot.ps1
API Reference
The Add-On exposes 26 HTTP endpoints on localhost:7890. The MCP server wraps these as tools.
Key endpoints
GET /api/health
GET /api/connection/status
GET /api/accounts
GET /api/account/{id}/balance
GET /api/account/{id}
GET /api/positions
POST /api/order/place
POST /api/order/cancel
POST /api/order/modify
GET /api/quote/{symbol} -- symbol format: "NQ 09-26" not "NQ DEC25"
GET /api/instrument/{symbol}
GET /api/instruments/search?q=NQ
GET /api/bars/{symbol}?period=1&type=minute
GET /api/orders
POST /api/order/closeposition
POST /api/order/flattenall
GET /api/charts
GET /api/chart/state
POST /api/chart/instrument
POST /api/chart/reload
GET /api/strategies/running
POST /api/strategy/stop
GET /api/indicator/{symbol}/{name}
GET /api/depth/{symbol}
Place order
curl -X POST http://localhost:7890/api/order/place \
-H "Content-Type: application/json" \
-d '{"accountId":"Sim101","instrument":"NQ 09-26","action":"Buy","orderType":"Market","quantity":1}'
Field names: accountId (not account), instrument (not symbol)
NT8 symbol format: Use NQ 09-26 (futures month-year code). The current front month
as of mid-2026 is NQ 09-26. Quarterly rolls change this in March/June/September/December.
Accounts (Simulation)
| Account | Connection | Cash |
|---|---|---|
| Sim101 | Simulation | $100,000 |
| DEMO7847095 | Simulation | $50,000 |
| Backtest | - | $100,000 |
| Playback101 | - | $0 |
Environment Variables
Copy .env.example to .env:
NINJATRADER_MODE=local
NINJATRADER_LOCAL_URL=http://localhost:7890
NINJATRADER_USERNAME=your@gmail.com
NINJATRADER_ACCOUNT=simulated
NINJATRADER_USERNAME and NINJATRADER_ACCOUNT are only used by the boot automation script.
The MCP server itself only needs NINJATRADER_MODE and NINJATRADER_LOCAL_URL.
Troubleshooting
| Symptom | Cause | Fix |
|---|---|---|
Connection refused on port 7890 |
NT8 not running or Add-On disabled | Start NT8, enable Add-On via Tools -> Add-Ons |
| Compile error in NinjaScript Editor | API mismatch (rare) | See nt8-addon/McpBridgeAddon.cs header comments |
Account not found |
No broker connection | Connect Simulation account in NT8 Connections menu |
| Quote returns zeros | Market closed or no subscription | Normal on weekends; open a chart for that symbol |
| Order state: Rejected | Market hours (Sim broker) | Expected outside RTH; will fill when market opens |
instrument is required |
Wrong field name | Use instrument not symbol in order body |
File Structure
ninjatrader-mcp/
+-- src/
| +-- server.js MCP server (26 tools, JSON-RPC 2.0 over stdio)
| +-- api.js NT8 HTTP API client
+-- nt8-addon/
| +-- McpBridgeAddon.cs NinjaScript Add-On (runs inside NT8.exe)
| +-- INSTALL.md Add-On installation guide
+-- scripts/
| +-- nt8-full-boot.ps1 Full cold-start automation (launch -> login -> compile -> verify)
| +-- nt8-enable-addon.ps1 Standalone: enable Add-On via Tools -> Add-Ons
| +-- nt8-mcp-start.ps1 Standalone: start MCP server (assumes NT8 already running)
+-- .env.example Environment variable template
+-- package.json
+-- README.md
+-- SETUP_GUIDE.md Extended setup walkthrough
License
MIT
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。