Cursor · Setup

Backtest from Cursor

Cursor has first-class MCP support. Drop a config block, restart, and the chat agent can submit Python strategies, run parameter sweeps, and pull back structured results — all without leaving the editor.

Setup

1

Get an API key

Sign up at bagtester.com/sign-up. Generate a key with the bag_ prefix.

2

Open MCP settings

In Cursor: Settings → Cursor Settings → MCP → Add new MCP server. Or edit your ~/.cursor/mcp.json directly.

3

Paste the config block

json
{
  "mcpServers": {
    "bagtester": {
      "url": "https://bagtester.com/api/mcp",
      "headers": {
        "Authorization": "Bearer bag_YOUR_KEY_HERE"
      }
    }
  }
}
4

Restart Cursor and verify

After restart, the MCP tools menu in Cursor's chat should list all 14 Bagtester tools.

5

Run a backtest

prompt
backtest a Bollinger band breakout (period=20, sigmas=2) on SPY for 2023-2024

Cursor writes the strategy, calls submit_strategy, and returns equity curve + metrics + quality flags + share URL.

Tips for Cursor specifically

One config block.

Free tier: 500 credits/month. Paste the JSON above into Cursor's MCP settings.