Skip to main content

How to Connect Windsurf to NinjaTrader 8 with CrossTrade MCP

Windsurf is Codeium's AI-native IDE. Its Cascade Agent supports MCP servers, which means CrossTrade tools become available alongside your normal code completion in a single editor. The config uses serverUrl (or url) — both accepted, but stick with serverUrl to match Windsurf's official examples.

OAuth scope: mcp:tradeMulti-model harness

Prerequisites

RequirementDetail
CrossTrade subscriptionElite
CrossTrade Add-Onv1.13.0 or higher
NinjaTrader 8Running, broker connected
AccountSim101 for first runs
OAuth scopemcp:trade
Config file~/.codeium/windsurf/mcp_config.json
CrossTrade MCP server
https://app.crosstrade.io/v1/api/mcp
Transport: streamable-http. Auth: OAuth 2.1 + PKCE. Request scope mcp:trade. Read plus write. Place/cancel orders, deploy strategies, compile NinjaScript.

Step 1: Open Cascade settings

Open Windsurf → Cascade panel → MCP ServersAdd server.

Or edit ~/.codeium/windsurf/mcp_config.json directly:

{
"mcpServers": {
"crosstrade": {
"serverUrl": "https://app.crosstrade.io/v1/api/mcp",
"headers": {
"Authorization": "Bearer ${env:CROSSTRADE_TOKEN}"
}
}
}
}
serverUrl vs url

Windsurf accepts both serverUrl and url. The official docs example uses serverUrl — use that to avoid surprises if Windsurf ever drops the alias. Variable interpolation: ${env:VAR_NAME}, ${file:/path/to/file}.

Step 2: OAuth

Per Windsurf's docs: "Windsurf supports OAuth for each transport type." Reload Cascade. First tool call triggers the browser OAuth flow.

Step 3: NinjaScript loop

Same compile-loop pattern as Cursor:

  1. GetNinjaScriptHelp on planned types.
  2. Draft into the workspace file.
  3. CompileNinjaScript(in_memory: true).
  4. Repair.
  5. WriteNinjaScriptFile.
  6. RunStrategyBacktest.

Windsurf's strength is multi-step task planning. Phrase the prompt as a single goal ("Build, compile, and backtest a working MES EMA cross strategy on Sim101") and let Cascade plan the steps.

FAQ

Plan requirements?

Windsurf has Free, Pro, Max, Teams, and Enterprise tiers. MCP support is available across them; provider model access scales with tier.

Which transports work?

stdio, SSE, and Streamable HTTP. For CrossTrade, just provide serverUrl and Windsurf auto-detects.

OAuth handshake

The first tool call surfaces an authorization URL. Open it in a browser, approve mcp:trade, and return to the harness. The access token is stored by the harness (keychain, config file, or memory depending on the client).

See CrossTrade MCP OAuth for the full flow, and 403/408 troubleshooting if the handshake fails.

Verify the connection

Smoke-test before doing anything stateful:

Call GetMcpCapabilities and McpSelfTest. Then ListAccounts and GetConnections.
Report add-on version, NT8 version, and which accounts are linked.

If you authorized mcp:trade, also confirm Sim101 is the default account before any order placement.

Funded-account safety
The mcp:trade scope grants order placement. The scope does not protect a funded account; your prompt and account selection do. Default to Sim101 during setup. For funded accounts, verify the firm's automation policy first.

Troubleshooting

SymptomLikely causeFix
403 insufficient_scopeToken authorized at mcp:read but tool requires mcp:tradeReauthorize the connection and select mcp:trade
OAuth callback failsSystem browser blocked the redirect or popupCopy the auth URL manually, complete it, paste the code back
Tools list is empty after connectServer registered but session did not refreshRestart the harness or trigger a tool list refresh
Add-on offline errorNT8 not running, or add-on not loadedConfirm NT8 is open and the CrossTrade add-on (v1.13.0+) is installed
Re-auth fails after token expiryBrowser auth state stuckRestart Windsurf to reset state, then re-authorize
serverUrl ignoredOlder Windsurf buildUpdate Windsurf to current 1.x release; both serverUrl and url are accepted in current versions