Backtest Pine strategies from Claude, Cursor, or any MCP client.
@pineforge/codegen-mcp is a local stdio MCP server that lets your AI agent transpile Pine to C++ and run Docker backtests on your data. One npm package, zero glue code.
npx -y @pineforge/codegen-mcp
Requires Node ≥ 20 · Docker daemon · a PineForge API key (pf_…)
OHLCV files never leave your machine. Only the Pine source travels to the codegen API. Backtests run in Docker on your local daemon.
Works with any MCP-aware client.
Add to your claude_desktop_config.json (Settings → Developer → Edit Config). Replace pf_... with your key.
{
"mcpServers": {
"pineforge-codegen": {
"command": "npx",
"args": ["-y", "@pineforge/codegen-mcp"],
"env": {
"PINEFORGE_API_KEY": "pf_..."
}
}
}
}One-shot register the server with the claude CLI:
claude mcp add pineforge-codegen \ --transport stdio \ --env PINEFORGE_API_KEY=pf_... \ -- npx -y @pineforge/codegen-mcp
Settings → MCP → New MCP Server → paste the Claude Desktop JSON config above.
Four tools, two surfaces.
| name | runs on | quota | what it does |
|---|---|---|---|
| transpile_pine | remote API | counts | Pine v6 source → C++ translation unit ready for the runtime |
| backtest_pine | local Docker | counts 1 | End-to-end: transpile + compile + run against your CSV. Returns full report. |
| get_quota | remote API | free | Check your API key tier and remaining transpile budget |
| pull_engine_image | local Docker | free | Fetch the latest pineforge-engine Docker image from GHCR |
| variable | default | purpose |
|---|---|---|
| PINEFORGE_API_KEY | (required) | Bearer token for the codegen API. Get one via the waitlist below. |
| PINEFORGE_GATEWAY | production URL | Override the API host. Defaults to production codegen-gateway. |
| PINEFORGE_ALLOW_ANYWHERE | 0 | Set to 1 to allow OHLCV paths outside the MCP cwd. |
| PINEFORGE_DOCKER_TIMEOUT_MS | 120000 | Hard kill (ms) for docker pull / docker run. Defaults to 2 minutes. |
Get a free key + start prompting.
Drop your email on the home page waitlist. We send your codegen API key by email within seconds. Plug it into the MCP config above and start backtesting from your AI assistant.
Want to build a strategy by hand? Start with the open runtime →