Official MCP integration

Backtest from your AI agent

The Manifold-BT Model Context Protocol server exposes the full Rust backtesting engine to any MCP client, Claude Code, Codex, Cursor, Windsurf, VS Code. Let an LLM author strategies, run backtests, sweep parameters, and generate tearsheets without writing a line of Python.

$pip install manifoldbt-mcp

Author in natural language

no Python

Describe a strategy idea in plain English. The agent writes it in the Manifold-BT DSL, validates it through the Rust compiler, and hands you a serialized StrategyDef, no imports, no boilerplate.

Research conversationally

sweeps & walk-forward

Run parameter sweeps, 2-D heatmaps, walk-forward optimization, stability and Monte Carlo analysis by asking for them. Results come back ranked by any metric you name.

Tearsheets on demand

HTML report

Generate a full tearsheet from a backtest in one call. The agent runs the engine, renders a self-contained HTML report, and returns the path, ready to drop into a research note.

Connect your client

The server speaks MCP over stdio by default, so any MCP-compatible client works by pointing it at the manifoldbt-mcp binary on your PATH.

Cursor / Windsurf / VS Code
mcp.json
{
  "mcpServers": {
    "manifoldbt": {
      "command": "manifoldbt-mcp"
    }
  }
}
Codex
~/.codex/config.toml
[mcp_servers.manifoldbt]
command = "manifoldbt-mcp"
Claude Code
claude mcp add manifoldbt -- manifoldbt-mcp
Remote (HTTP)
manifoldbt-mcp --http --host 0.0.0.0 --port 8765

20 tools, 3 resources, 2 prompts

Every tool accepts JSON-friendly arguments, ISO dates, interval shorthands like "1h", fee presets, so the agent never has to reason about native types.

Environment & data
get_version

Engine version and license tier.

activate_license

Activate a Pro license for the session.

list_indicators

Enumerate every indicator with signatures.

list_examples

Browse bundled example strategies.

get_example

Fetch the source of an example.

list_symbols

List symbols registered in a DataStore.

resolve_symbol

Resolve a ticker to its SymbolId.

ingest_data

Pull bars from Binance / Hyperliquid (Databento / Massive on Pro).

Strategy authoring
build_strategy

Compile a DSL snippet into a validated StrategyDef.

validate_strategy

Validate StrategyDef JSON through the Rust compiler.

Backtest, research & reporting
run_backtest

Single backtest, metrics + summary.

run_batch

Many strategies in parallel on a shared data load.

run_sweep

Cartesian parameter sweep, ranked.

run_sweep_2d

2-D parameter heatmap.

run_walk_forward

Walk-forward optimization (Pro).

run_stability

Parameter stability analysis.

run_monte_carlo

Trade-permutation Monte Carlo.

run_stochastic

SDE path simulation (GBM, Heston, Merton...).

run_portfolio

Multi-strategy portfolio with risk rules.

plot_tearsheet

Render a full tearsheet as a self-contained HTML report.

Strategies are just DSL snippets

The agent writes strategies in a namespace that pre-imports every Manifold-BT symbol, no import statements, no pandas. It assigns a single strategy variable, and the server validates it through the Rust compiler before anything runs.

Prefer to drive it yourself? Send an already-serialized StrategyDef JSON to any tool instead.

ema_cross.py
fast = ema(close, 12)
slow = ema(close, 26)

strategy = (
    Strategy.create("ema_cross")
    .signal("fast", fast)
    .signal("slow", slow)
    .size(when(fast > slow, lit(0.5), lit(0.0)))
    .stop_loss(pct=3.0)
)

A typical agent session

01
list_indicators

Discover the available indicators.

02
write_strategy prompt

Draft a strategy from a natural-language idea.

03
build_strategy

Validate it into a StrategyDef with declared parameters.

04
run_backtest

Get metrics and a printable summary.

05
run_sweep

Rank variants by Sharpe to find the best one.

06
plot_tearsheet

Save an HTML tearsheet report to disk.

07
analyze_result prompt

Turn the metrics into a research note.

Runs on your machine

The server runs locally with the permissions of the launching process. There is no inbound network unless you explicitly enable the HTTP transport. Your data, your keys, and your strategies never leave your machine.

Strategy snippets execute in-process through the Python interpreter. Run the server with clients you trust, or isolate it in a dedicated virtual environment or container. When exposing the HTTP transport, keep it behind your own authentication.

Point an agent at the engine

Install the server, register it with your MCP client, and start backtesting in plain English.