Back to blog

Engineering · May 26, 2026

MCP Spotlight: FLOX — AI-Native Trading Framework Where Your Agent Writes the Strategies

FLOX gives AI agents a complete trading toolkit: 213 stars, ~30 MCP tools for strategy scaffolding, backtesting, indicator computation, and live execution. One strategy class runs backtest, paper, and live — with Python, Node, Codon, and C bindings.

MCP ServerFLOXAlgorithmic TradingBacktestingQuantitative FinanceAI Agents

MCP Spotlight: FLOX — AI-Native Trading Framework Where Your Agent Writes the Strategies

Server: flox-mcp by FLOX Foundation Stars: 213 · License: MIT · Languages: Python, Node.js, Codon, C MCP Transport: stdio (local only) · Tools: ~13 dedicated MCP tools + ~30 framework-wide Exchange connectors: Bybit, Bitget, Hyperliquid, Polymarket · Last updated: May 26, 2026

What It Does

FLOX is not a thin MCP wrapper around a REST API. It's an AI-native trading framework — strategies, backtests, paper trading, and live execution live behind one toolkit, and an MCP server gives your agent access to the entire surface.

One strategy class. Three execution modes: backtest, paper, live. Same code for all three. The MCP control plane lets an AI agent write, validate, backtest, and deploy trading strategies without switching tools, languages, or environments.

And because the MCP server runs locally — no network calls, no cloud dependency — the agent works directly against the same FLOX installation you have on your machine. What the agent sees is what the developer ships.

Why It Matters for Agent Engineering

Most financial MCP servers do one thing: fetch data. Stock prices, earnings reports, SEC filings. They're API proxies with MCP-shaped hats.

FLOX is different. It gives the agent the entire strategy lifecycle:

  1. Scaffold — generate starter strategy from a template (bar-driven, trade-driven, hybrid)
  2. Validate — AST-parse the strategy, check for required hooks, reject eval/exec
  3. Backtest — run against CSV data in a resource-capped subprocess
  4. Indicate — compute indicators, verify inputs, suggest alternatives
  5. Deploy — switch the same strategy class to paper or live execution

The agent doesn't just read data — it builds, tests, and operates trading systems. This is the difference between a research assistant and an engineering partner.

The MCP Tool Surface

Strategy Tools

ToolWhat It Does
scaffold_strategyGenerate starter strategy class for Python or Node. Bar-driven, trade-driven, or hybrid. CI-validated templates — can't rot silently.
validate_strategyStatic analysis on Python strategy code. AST parses, checks for required hooks, rejects dangerous patterns.
run_backtestExecute a Python strategy against CSV data. Sandboxed subprocess caps CPU, memory, output size, and wall-clock time.

Intelligence Tools

ToolWhat It Does
list_indicatorsEvery indicator with class signature, batch function, and shape. Filter by substring.
compute_indicatorRun one FLOX indicator over a list of floats. Accepts class-form (EMA) or function-form (ema) names.
suggest_indicatorMap English descriptions ("trend filter", "momentum oscillator") to ranked indicator shortlists.
explain_eventDescribe fields of any FLOX event struct (FloxTradeData, FloxBookData, FloxBarData).

API Surface Tools

ToolWhat It Does
list_capi_functionsSearch the C-API surface from committed ABI snapshot. Returns name + return type + parameter types.
lookup_symbolTake any binding-local spelling and return the canonical name in C-API, Python, Node, and Codon.
list_bindingsEnumerate exports of one binding (capi, python, node, codon, quickjs) with substring filter.
lookup_error_codeE_SYM_001 → full Markdown page with fix recipe, common causes, diagnostics.

Knowledge Tools

ToolWhat It Does
docs_searchTop-k FTS5 search over six doc roots: bindings, how-to, tutorials, reference, explanation, errors.
get_exampleCode from docs/examples/ matching a topic — strategy, connector, indicator, event-handler, risk, backtest — optionally filtered by language.

That's 13 tools covering the full strategy lifecycle. No other trading MCP server gives agents this much surface — most expose 2–3 read-only data endpoints and call it a day.

Architecture: Why "Grounded" Matters

The FLOX team uses the word grounded deliberately. The agent doesn't hallucinate API signatures — it reads them from the committed ABI snapshot:

list_capi_functions → returns name + return type + parameter types
                     from .api/c-api.snapshot (enforced by CI codegen gate)
lookup_symbol → maps any binding-local name to the canonical C-API, Python, Node, Codon form
                queried from binding_manifest.json (built from binding_parity.yaml + type stubs)

This means the agent always codes against real, versioned signatures. No guessing. No deprecated parameters. No hallucinated function names. The snapshot is the same one that enforces ABI compatibility in CI — if the agent's view drifts, the build fails.

Bundled Data Architecture

The MCP server ships with read-only data embedded in the wheel:

BundlePurpose
c-api.snapshotC-API function signatures (name, return type, params)
ir.snapshot.jsonFull IR: functions, structs, enums, typedefs, function pointers
binding_manifest.jsonPer-binding symbol map (Python, Node, Codon, QuickJS)
errors/E_*.mdError code documentation with fix recipes
docs.fts.sqliteFTS5 full-text search index over six doc roots
examples_index.jsonIndex of docs/examples/ by path, language, topic, sha256
templates/strategy/CI-validated strategy scaffolds for Python and Node

All local. No network calls. The agent spawns as a child process and talks via stdio — nothing leaves the machine.

Strategy Scaffolding: Three Flavors

The scaffold_strategy tool generates three kinds of starter strategies:

# Bar-driven: strategy reacts to OHLCV bars
class MyBarStrategy:
    def on_bar(self, bar: FloxBarData) -> FloxSignal | None:
        ...

# Trade-driven: strategy reacts to order fills
class MyTradeStrategy:
    def on_trade(self, trade: FloxTradeData) -> FloxSignal | None:
        ...

# Hybrid: reacts to both bars and trades
class MyHybridStrategy:
    def on_bar(self, bar: FloxBarData) -> FloxSignal | None:
        ...
    def on_trade(self, trade: FloxTradeData) -> FloxSignal | None:
        ...

Each template goes through ast.parse + validate_strategy in CI on every build. The templates can't silently rot — if a FLOX API change breaks a scaffold, CI catches it. The agent never inherits broken boilerplate.

Connecting FLOX to Your Agent

Step 1: Install

pip install flox-mcp           # MCP server + flox-py (indicators, backtest, engine CLI)
flox-mcp init                  # writes ./.mcp.json for the current project

Step 2: Restart your MCP client

Cursor, Claude Code, or Cline picks up the config automatically. The agent now has access to all 13 tools.

Step 3: For live execution (optional)

flox engine sim --strategy s.py --tape ./tape   # boots Runner + Simulator + ControlServer
flox-mcp init --engine-url URL --token T         # appends live engine wiring to .mcp.json

The agent can now query live state, place orders, and manage positions — same tools, different execution context.

Production Pattern: Agent-Driven Strategy Development

Here's what a full strategy development workflow looks like with FLOX connected to your agent:

Agent workflow:
1. User: "Build a mean-reversion strategy on BTC with 20-bar EMA filter"
2. Agent calls suggest_indicator("mean revert") → shortlists indicators
3. Agent calls list_indicators("ema") → confirms EMA signature
4. Agent calls scaffold_strategy(kind="bar-driven", lang="python") → starter class
5. Agent edits code: adds EMA filter, reversion logic, position sizing
6. Agent calls validate_strategy(code) → passes AST check, hooks present
7. Agent calls run_backtest(strategy, dataset="btc-1h.csv") → returns PnL, Sharpe, drawdown
8. Agent iterates: adjusts parameters, re-runs backtest
9. Agent presents results → human reviews equity curve
10. Human approves → agent switches to paper trading via engine

The agent handles steps 2–8 autonomously. The human steps in at steps 1 (strategy idea) and 9 (review). Every technical step — indicator selection, scaffolding, validation, backtesting — is tool-grounded. No hallucinated backtest results. No wrong indicator parameters.

Exchange Connectivity

FLOX ships native connectors for four exchanges:

ConnectorType
BybitCEX — spot, futures
BitgetCEX — spot, futures
HyperliquidDEX — perpetuals
PolymarketPrediction market

Connectors build optionally (-DFLOX_BUILD_CONNECTORS=ON in CMake), so a backtest-only build doesn't pay the dependency cost. Each adapter handles exchange-specific order types, rate limits, and data format normalization — the agent interacts with FLOX's uniform API regardless of the underlying venue.

Comparison: FLOX vs. Traditional Quant Stack

CapabilityFLOX MCPTraditional Quant Stack
Strategy lifecycle tools✓ Scaffold → validate → backtest → deploy— Per-step tool per vendor
Agent-grounded API surface✓ ABI snapshot, IR, binding manifest— Docs-only, hallucination-prone
Same code: backtest + live✓ One class, three modes— Separate implementations
Local-only execution✓ stdio, no cloud— Mixed local/cloud
Multi-language bindings✓ Python, Node, Codon, C— Usually Python-only
CI-validated templates✓ Scaffolds tested on every build— Manual template maintenance
Error code lookupE_SYM_001 → fix recipe— Stack Overflow / docs search
Indicator suggestion✓ Natural language → ranked list— Manual research

For quant developers and trading teams, the single-interface model eliminates the "write a strategy, then rewrite it for backtesting, then rewrite it again for live" anti-pattern. The agent writes it once.

Key Takeaways

  • Complete strategy lifecycle: 13 tools covering scaffold, validate, backtest, indicate, and deploy — not just data access
  • Grounded API surface: Agent reads real signatures from ABI snapshot and IR, not from documentation or memory
  • One class, three modes: Same strategy code runs backtest, paper, and live — no rewrite tax
  • Multi-language: Python, Node.js, Codon, and C bindings from a single C++ core — agent can target any binding
  • CI-validated templates: Strategy scaffolds are AST-parsed and validated on every build — templates can't quietly break
  • Local-first: No network calls, no cloud dependency — agent spawns as a child process over stdio
  • Four exchange connectors: Bybit, Bitget, Hyperliquid, Polymarket — optional builds, uniform API
  • Agent-as-quant: The agent doesn't just fetch data — it builds, tests, and operates trading systems end-to-end

FLOX: github.com/FLOX-Foundation/flox · Docs: flox-foundation.github.io/flox · MCP Package: pip install flox-mcp · Glama: glama.ai/mcp/servers/FLOX-Foundation/flox-mcp · Facio MCP docs: facio.bot/docs/mcp