Skip to main content

MCP Trading API for AI Agents

CrossTrade exposes a hosted Model Context Protocol (MCP) server at /v1/api/mcp. It gives AI agents a typed way to read account state, place trades, run analysis, author NinjaScript, backtest through NT8's actual Strategy Analyzer engine, deploy strategies, and operate selected NinjaTrader 8 add-on features.

Use this section when you want an AI agent (Claude, ChatGPT, Cursor, or any MCP-compatible client) to call CrossTrade directly. For client setup, OAuth discovery, and assistant configuration, start with AI-Assisted Development.

If you want copy-ready trader prompts for AI trading agents instead of tool specs, see MCP Trading with AI Agents in the Learn section.

Elite and Add-On Required

MCP tool calls require an Elite subscription and CrossTrade Add-On v1.13.0 or higher. OAuth discovery still works for non-Elite accounts, but tools/call returns HTTP 403 with "MCP requires an Elite subscription" until the account is upgraded.

REST and WebSocket access remain available on Pro. The Elite gate applies to the MCP transport.

What MCP Adds

MCP includes the public REST trading surface and adds tools that are only practical through an agent-controlled tool interface.

CapabilityWhat it coversStart here
Public API toolsAccounts, orders, positions, executions, quotes, bars, market info, and strategy lifecycle operations.CrossTrade API Overview
Environment checksAdd-on version, feature flags, self-tests, async job status, and NT8 connection state.Capabilities
NinjaScript automationRead, generate, compile, write, and inspect NinjaScript against the user's actual NT8 install.NinjaScript and Strategies
Strategy backtestingRun the user's compiled NinjaScript through NT8's actual Strategy Analyzer engine. Single backtests are bit-identical to NT8's UI. Optional parameter sweeps return a ranked grid.Backtesting and Optimization
Strategy deploymentDeploy compiled strategies, verify live state, stop deployments, and reopen charts.NinjaScript and Strategies
Alert relaySurface MCP-originated alerts through the user's in-app, email, Discord, or Telegram channels.Platform Tools
GuardrailsVersion checks, permission boundaries, and safe tool sequences for AI trading agents.Workflows and Safety

Call these before allowing an agent to trade or deploy code:

GetMcpCapabilities
McpSelfTest
ListAccounts
GetConnections
GetAllPositions
GetAllOrders

GetMcpCapabilities confirms the add-on version and enabled feature set. McpSelfTest checks the transport and tool categories. The account, connection, position, and order calls establish current risk before any write operation.

Do Not Skip State Checks

MCP can place orders and mutate the running add-on. Before an autonomous agent workflow sends a trading or deployment command, it should verify the account, connection, open positions, working orders, and any account-level risk limits that matter to the strategy.

The Agent Loop

The end-to-end workflow MCP is designed for. Every step is one or more typed tool calls.

inspect → GetMcpCapabilities, McpSelfTest, ListAccounts, GetConnections,
GetAccountSummary, GetWatermarks, ListPositions, ListOrders
research → GetQuote, MarketInfo, GetBars, GetVolumeProfile
author → GetNinjaScriptHelp, SearchNinjaScriptSymbols,
LookupNinjaScriptSymbol
compile → CompileNinjaScript(in_memory: true), GetMcpJob
write → WriteNinjaScriptFile(overwrite: true)
backtest → RunStrategyBacktest, GetMcpJob
optimize → RunStrategyBacktest(optimization: { parameters_sweep, fitness })
deploy → DeployStrategy
verify → GetDeployedStrategyState (trust the live block)
notify → EmitMcpAlert
close → StopStrategy, RemoveAlert

Section Map