Skip to main content

How to Connect Sourcegraph Amp to NinjaTrader 8 with CrossTrade MCP

Sourcegraph Amp is the newer frontier-agent product (different from Cody). Unlike Cody, Amp natively supports remote HTTP MCP with OAuth Dynamic Client Registration. Pay-as-you-go credits, no subscription. Cross-IDE: JetBrains, VS Code variants, Neovim, Zed, plus a CLI.

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
Install commandcurl -fsSL https://ampcode.com/install.sh | bash
Config fileamp.mcpServers in VS Code settings.json (or amp mcp add CLI)
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.

Amp vs Cody (important distinction)

Sourcegraph has two products in this space:

  • Cody is the older coding assistant. Stdio-only MCP, requires Enterprise + a feature flag.
  • Amp is the newer frontier-agent product. Native remote HTTP MCP, OAuth + DCR, pay-as-you-go.

For CrossTrade, Amp is the easier path.

Step 1: Install Amp

# macOS / Linux / WSL
curl -fsSL https://ampcode.com/install.sh | bash

# Windows (PowerShell)
powershell -c "irm https://ampcode.com/install.ps1 | iex"

# Homebrew
brew install ampcode/tap/ampcode

Then sign in:

amp login

For JetBrains: install Amp CLI, then run amp --jetbrains.

Step 2: Add CrossTrade MCP

Via the CLI:

amp mcp add crosstrade https://app.crosstrade.io/v1/api/mcp

Or edit VS Code settings.json:

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

Variable substitution via ${VAR_NAME} is supported in header values.

Step 3: OAuth (automatic via DCR for compliant servers)

If CrossTrade's MCP server advertises Dynamic Client Registration (it does), Amp auto-starts the OAuth flow in your browser on first connection. No manual config.

For non-DCR servers:

amp mcp oauth login crosstrade \
--server-url https://app.crosstrade.io/v1/api/mcp \
--client-id YOUR_CLIENT_ID \
--client-secret YOUR_SECRET \
--scopes "mcp:trade"

Redirect URI to register: http://localhost:8976/oauth/callback.

Step 4: First prompt

Confirm CrossTrade MCP. ListAccounts, GetConnections. One-line status per account.

Step 5: NinjaScript compile loop

Same compile-loop pattern as Claude Code or Cursor. Amp's strength is multi-step planning across files.

Plans

Pay-as-you-go credits, $5 minimum top-up. No subscription. Enterprise plans cost ~50% more. BYOK is supported.

FAQ

Should I use Cody or Amp?

Amp, unless your team already pays for Sourcegraph Enterprise and uses Cody extensively. Amp's MCP integration is cleaner and the auth flow is simpler.

Which IDEs?

Cross-IDE: JetBrains (IntelliJ, WebStorm, GoLand), VS Code variants, Neovim, Zed, plus a CLI.

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
Key amp.mcpServers not recognizedCopy-pasted mcp.servers or mcpServers from a different toolAmp uses amp.mcpServers (with the amp. prefix)
OAuth doesn't auto-registerServer doesn't advertise Dynamic Client RegistrationCrossTrade does support DCR; if Amp doesn't auto-register, run amp mcp oauth login <name> with explicit credentials