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
- PNG charts render inline. Bagtester returns chart URLs in
visuals.equity_url. Cursor previews them in chat. - Per-project config works. Drop
.cursor/mcp.jsonin a repo for project-scoped Bagtester access — handy when one repo needs the agent and another doesn't. - Approve once, run many. First call from a new tool requests approval. After that, Cursor auto-allows the same tool for the session.
- Walk-forward auto-async-routes. Long sweeps return immediately with
status: "running"and a job id — Cursor knows to pollget_backtest_results.
One config block.
Free tier: 500 credits/month. Paste the JSON above into Cursor's MCP settings.