Skip to main content

How to Connect Cline to NinjaTrader 8 with CrossTrade MCP

Cline is an open-source AI coding assistant for VS Code with MCP support. The UI flow (Cline panel → MCP Servers → Remote Servers tab) is easier than the JSON file for first-time setup. Note that Cline uses streamableHttp (camelCase) as the type value — different from Roo Code and Continue which use streamable-http kebab-case.

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 fileCline panel → MCP Servers → Remote Servers tab (or cline_mcp_settings.json in VS Code globalStorage)
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.
  1. Open VS Code.
  2. Open the Cline panel.
  3. Click the MCP Servers icon.
  4. Switch to the Remote Servers tab.
  5. Click Add Server.
  6. Fill in:
    • Server Name: crosstrade
    • Server URL: https://app.crosstrade.io/v1/api/mcp
    • Transport Type: Streamable HTTP (SSE is marked Legacy)
  7. Save.

On first tool call, Cline displays an OAuth2 URL. Click to open in browser. Approve mcp:trade. Re-authorization is automatic after the initial setup.

Step 1 (alternative): Edit cline_mcp_settings.json

If you prefer the JSON file (for sync across machines):

{
"mcpServers": {
"crosstrade": {
"type": "streamableHttp",
"url": "https://app.crosstrade.io/v1/api/mcp",
"headers": {
"Authorization": "Bearer YOUR_TOKEN"
},
"disabled": false,
"autoApprove": []
}
}
}

File location (VS Code globalStorage):

  • macOS: ~/Library/Application Support/Code/User/globalStorage/saoudrizwan.claude-dev/settings/cline_mcp_settings.json
  • Linux: ~/.config/Code/User/globalStorage/saoudrizwan.claude-dev/settings/cline_mcp_settings.json
  • Windows: %APPDATA%\Code\User\globalStorage\saoudrizwan.claude-dev\settings\cline_mcp_settings.json
Casing matters

Cline expects "type": "streamableHttp" in camelCase. Continue and Roo Code use "streamable-http" in kebab-case. Copy-pasting between them silently fails.

Step 2: First read-only workflow

Pull the last 20 closed trades on Sim101. Group by instrument and side. Report
win rate, average win, average loss, and the three biggest losers.

Step 3: NinjaScript compile loop (mcp:trade)

If you reauthorize at mcp:trade, Cline can run the full compile loop:

  1. GetNinjaScriptHelp on every NT8 type and method you plan to use.
  2. Draft the source.
  3. CompileNinjaScript(in_memory: true).
  4. On failure, LookupNinjaScriptSymbol and repair.
  5. WriteNinjaScriptFile after confirmation.
  6. RunStrategyBacktest on Sim101 with realistic commission and slippage.

See Vibe Code a NinjaScript Strategy for the full sequence.

Model choice

Cline routes to whatever LLM you've configured in its settings. For NinjaScript work, Claude and GPT both produce strong code; DeepSeek is a cheaper option for iteration-heavy work. See the model rail below.

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
type: "streamable-http" rejectedWrong transport-key casingCline uses type: "streamableHttp" (camelCase). Roo Code and Continue use the kebab-case form; do not copy between them
Re-auth fails with "missing stored state"Known bug after token expiry (GitHub issue #7964)Remove the server entry and re-add it; OAuth flow restarts cleanly