Skip to main content

How to Connect GitHub Copilot to NinjaTrader 8 with CrossTrade MCP

GitHub Copilot Chat in VS Code supports MCP through Agent Mode. Native browser OAuth, Dynamic Client Registration, and config in .vscode/mcp.json. MCP became Generally Available in VS Code 1.102 (July 2025); current versions ship with everything you need.

OAuth scope: mcp:tradeSingle-vendor host

Prerequisites

RequirementDetail
CrossTrade subscriptionElite
CrossTrade Add-Onv1.13.0 or higher
NinjaTrader 8Running, broker connected
AccountSim101 for first runs
OAuth scopemcp:trade
Config file.vscode/mcp.json (workspace) or MCP: Open User Configuration (Command Palette → opens profile-level mcp.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: Update VS Code and enable Agent Mode

  1. Update VS Code to 1.102 or newer (MCP GA release).
  2. Install / update GitHub Copilot and GitHub Copilot Chat extensions.
  3. Sign in with your GitHub account (GitHub: Sign in from the Command Palette).
  4. Open the Copilot Chat panel, click the mode dropdown at the bottom of the input, and select Agent.

Step 2: Register CrossTrade MCP

Easiest path: Command Palette → MCP: Add Server → follow the wizard → choose Workspace or Global.

Manual path: create .vscode/mcp.json in your workspace (or use Command Palette → MCP: Open User Configuration for the profile-level file):

{
"servers": {
"crosstrade": {
"type": "http",
"url": "https://app.crosstrade.io/v1/api/mcp"
}
}
}
Top-level key is "servers"

VS Code uses "servers", not "mcpServers" (which Cursor, Cline, and others use). Pasting a Claude Desktop or Gemini config schema here results in zero registered servers — and no error message.

Step 3: OAuth handshake

On first tool call, VS Code opens a browser window for OAuth. An Auth CodeLens appears above the server entry in mcp.json so you can re-trigger it later.

VS Code supports Dynamic Client Registration and Client Information Metadata Discovery, so CrossTrade's OAuth setup works without any pre-registration on your end.

A trust prompt appears before the server starts the first time and before tools run.

Step 4: First prompt in Agent Mode

In the Agent panel:

Use the crosstrade MCP server. Confirm it's connected. Call ListAccounts and
GetConnections. Report add-on version, NT8 version, and connected accounts.

Step 5: NinjaScript compile loop

Same pattern as Claude Code or Cursor:

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

Storing secrets safely

Don't hard-code bearer tokens. Use VS Code's input variables:

{
"inputs": [
{ "type": "promptString", "id": "ct-token", "description": "CrossTrade token", "password": true }
],
"servers": {
"crosstrade": {
"type": "http",
"url": "https://app.crosstrade.io/v1/api/mcp",
"headers": { "Authorization": "Bearer ${input:ct-token}" }
}
}
}

VS Code prompts on first use and caches the value in OS secret storage.

FAQ

Does Copilot need a paid plan?

GitHub Copilot Free, Pro, Pro+, Business, and Enterprise all support Agent Mode and MCP. Premium-request quotas differ. Business/Enterprise additionally need the org admin to enable the MCP servers in Copilot policy (off by default).

Can I pick the model?

Copilot Chat rotates among Claude, GPT, and Gemini variants depending on tier and time. MCP behavior is consistent across them.

Why don't my MCP tools show up in Ask or Edit mode?

By design. MCP tools are only visible in Agent mode. There's no warning — you just don't see them.

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
MCP tools registered but invisible in chatYou are in Ask or Edit mode, not Agent modeOpen the mode dropdown at the bottom of the Copilot Chat input and select Agent
Pasted JSON shows zero servers loadedUsed the wrong top-level keyVS Code mcp.json uses "servers" (NOT "mcpServers")
MCP unavailable for Business/Enterprise usersOrg policy "MCP servers in Copilot" is disabled by default at the org levelAsk your org admin to enable it; Free / Pro / Pro+ are not subject to this policy
Auth fails on remote SSH dev containerOAuth prompt opens on the remote host, not local browserEither use the local VS Code instance, or forward the port to your machine