OpenAI · MCP · NinjaTrader 8

Connect OpenAI Codex to NinjaTrader 8

OpenAI Codex CLI is the GPT counterpart to Claude Code. TOML config, native OAuth, the NinjaScript compile loop in your terminal.

See it in action
openai codex · crosstrade mcp · sim101

OpenAI Codex calling CrossTrade MCP tools against a live NinjaTrader 8 account. Run this yourself in 5 minutes →

Why OpenAI Codex

Why pair OpenAI Codex with CrossTrade MCP

Codex is a terminal coding agent that edits local files and calls MCP tools in the same session. If you prefer GPT models for strict tool-call adherence, Codex is the right harness. Remote MCP support landed in Codex 0.134.0 (May 2026); older versions are stdio-only.

Transport ~/.codex/config.toml with [mcp_servers.X], OAuth via `codex mcp login`
Highlights

What this combination unlocks

Strict tool calling

GPT models almost never malform PlaceOrder arguments — important when mcp:trade is on.

TOML config

Familiar shape if you've used Cargo or Hugo.

Approval gates

Per-server approval mode pauses every write call for confirmation.

How it works

The connection chain

OpenAI Codex
   │  OAuth-authorized tool call
   ▼
CrossTrade hosted MCP server   (https://app.crosstrade.io/v1/api/mcp)
   │
   ▼
CrossTrade Add-On running inside NT8 on your PC
   │
   ▼
NinjaTrader 8

One URL, one consent screen, one read-only first prompt. The MCP server is hosted by CrossTrade; you don't run anything beyond NT8 + the CrossTrade Add-On.

Ready to set up OpenAI Codex?

The full step-by-step setup lives on a dedicated page. Verified against OpenAI's current docs.

Open setup instructions →
Example prompts

Copy-paste prompts that work today

Codex compile loop GetNinjaScriptHelp on EMA, ATR. Draft SampleEmaCross.cs. CompileNinjaScript(in_memory: true). Repair until green.
FAQ

Common questions

Is Codex CLI a good fit for NinjaScript development?

Yes, especially if you prefer GPT models. Codex is OpenAI's terminal coding agent — same compile-loop pattern as Claude Code, but GPT-driven. Strict tool-call adherence (GPT rarely malforms PlaceOrder arguments), TOML config, native OAuth.

Codex vs Claude Code: which is better for NinjaScript?

Both work. Claude generally writes cleaner C# on the first attempt; GPT generally fixes errors faster on the second. Try both on the same spec and decide. If your codebase already has OpenAI keys configured, Codex is the smaller addition.

Do I need ChatGPT Plus or an API key?

Either works. ChatGPT Plus / Pro / Business / Edu / Enterprise plans work via codex login. Or set OPENAI_API_KEY for the API-key path. The ChatGPT free tier is not supported via sign-in flow.

Does Codex support models other than GPT?

No — Codex is GPT-locked by design. If you want a multi-model harness, use OpenCode, Cline, or Continue and route OpenAI through them. They give you the same Codex-style compile loop with the option to swap to Claude, Gemini, or DeepSeek mid-session.

Mac, Windows, and Linux?

All three. Install via curl (macOS/Linux), PowerShell (Windows), npm (cross-platform, Node 22+), or Homebrew. Node 22+ is the current minimum for the npm install.

Version cliff for remote HTTP MCP?

Yes. Remote Streamable HTTP MCP support landed in Codex CLI 0.134.0 (May 26, 2026). Older versions only support stdio MCP and will silently ignore url = "..." in config.toml. Run npm install -g @openai/codex@latest to upgrade.

Why no `transport` field in the TOML config?

Codex infers transport from which field is set: url → Streamable HTTP, command → stdio. There is no transport = "http" key — adding one is silently ignored. This is intentional but trips up users coming from other tools.

OAuth callback failed — what now?

If the browser redirect fails after sign-in, copy the full callback URL from the address bar and paste it back into the CLI prompt. Codex falls back to manual paste cleanly. If your IdP needs a fixed redirect URI, pin the port via mcp_oauth_callback_port in config.toml.

Connect OpenAI Codex to NinjaTrader 8 in 5 minutes

Free Sim101 walkthrough. Read-only first. Upgrade scope only when a real workflow needs it.