pineforgeGet started
For AI assistants · MCP server

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.

Install
npx -y @pineforge/codegen-mcp

Requires Node ≥ 20 · Docker daemon · a PineForge API key (pf_…)

Privacy

OHLCV files never leave your machine. Only the Pine source travels to the codegen API. Backtests run in Docker on your local daemon.

Client setup

Works with any MCP-aware client.

Claude Desktop

Add to your claude_desktop_config.json (Settings → Developer → Edit Config). Replace pf_... with your key.

claude_desktop_config.json
{
  "mcpServers": {
    "pineforge-codegen": {
      "command": "npx",
      "args": ["-y", "@pineforge/codegen-mcp"],
      "env": {
        "PINEFORGE_API_KEY": "pf_..."
      }
    }
  }
}
Claude Code CLI

One-shot register the server with the claude CLI:

bash
claude mcp add pineforge-codegen \
  --transport stdio \
  --env PINEFORGE_API_KEY=pf_... \
  -- npx -y @pineforge/codegen-mcp
Cursor

Settings → MCP → New MCP Server → paste the Claude Desktop JSON config above.

Exposed tools

Four tools, two surfaces.

nameruns onquotawhat it does
transpile_pineremote APIcountsPine v6 source → C++ translation unit ready for the runtime
backtest_pinelocal Dockercounts 1End-to-end: transpile + compile + run against your CSV. Returns full report.
get_quotaremote APIfreeCheck your API key tier and remaining transpile budget
pull_engine_imagelocal DockerfreeFetch the latest pineforge-engine Docker image from GHCR
Environment variables
variabledefaultpurpose
PINEFORGE_API_KEY(required)Bearer token for the codegen API. Get one via the waitlist below.
PINEFORGE_GATEWAYproduction URLOverride the API host. Defaults to production codegen-gateway.
PINEFORGE_ALLOW_ANYWHERE0Set to 1 to allow OHLCV paths outside the MCP cwd.
PINEFORGE_DOCKER_TIMEOUT_MS120000Hard kill (ms) for docker pull / docker run. Defaults to 2 minutes.
Get started

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