PineForge PineScript v6 — Claude Code MCP server: setup guide
Transpiles PineScript v6 into C++ to execute local strategy backtests against OHLCV market data. Keeps your trading code private and works offline without third-party API tokens.
claude mcp add pineforge-offline-pinescript-v6-backtest-mcp -- docker run -i --rm ghcr.io/pineforge-4pass/pineforge-backtest-mcp:v0.9.40What PineForge — offline PineScript v6 backtest MCP does
The server operates over stdio inside a self-contained container. It bundles the pineforge-codegen utility to translate PineScript v6 source code into C++ binaries on the fly. Calculations execute locally. Proprietary strategy code and market records never leave your drive.
Tooling covers single runs via backtest_pine, multi-parameter sweeps using backtest_pine_grid, and Binance market data collection. The check_tradingview_parity tool evaluates trade records against TradingView exports to confirm identical execution behavior.
File paths in tool arguments require absolute /work/... paths. The container working directory is /app, meaning relative paths write to temporary container storage that vanishes upon exit. Always keep the -i flag and omit -t because allocating a TTY breaks the JSON-RPC stream.
What it helps with
- Run deterministic PineScript v6 backtests locally without TradingView
- Compare local algorithmic trades against TradingView Strategy Tester exports
- Execute Cartesian sweeps across strategy inputs with
backtest_pine_grid - Download spot or perpetual OHLCV candlestick data from Binance
Example prompts for the agent
- Backtest the PineScript logic in
strategy.pineusing the bar data in/work/btc_1h.csv. - Fetch 1h klines for BTCUSDT from Binance and save them directly to
/work/binance_btc.csv. - Compare our strategy execution against
/work/tv_report.csvwithcheck_tradingview_parity.
How to install PineForge — offline PineScript v6 backtest MCP
Platform CLI
claude mcp add pineforge-offline-pinescript-v6-backtest-mcp -- docker run -i --rm ghcr.io/pineforge-4pass/pineforge-backtest-mcp:v0.9.40Platform CLI
codex mcp add pineforge-offline-pinescript-v6-backtest-mcp -- docker run -i --rm ghcr.io/pineforge-4pass/pineforge-backtest-mcp:v0.9.40Config file
{
"mcpServers": {
"pineforge-offline-pinescript-v6-backtest-mcp": {
"command": "docker",
"args": [
"run",
"-i",
"--rm",
"ghcr.io/pineforge-4pass/pineforge-backtest-mcp:v0.9.40"
]
}
}
}Config file
{
"servers": {
"pineforge-offline-pinescript-v6-backtest-mcp": {
"type": "stdio",
"command": "docker",
"args": [
"run",
"-i",
"--rm",
"ghcr.io/pineforge-4pass/pineforge-backtest-mcp:v0.9.40"
]
}
}
}Platform CLI
gemini mcp add pineforge-offline-pinescript-v6-backtest-mcp docker run -i --rm ghcr.io/pineforge-4pass/pineforge-backtest-mcp:v0.9.40Step by step, with commands for each platform: How to add an MCP server to Claude Code, Codex, Cursor, VS Code, Gemini CLI and more
Questions about PineForge — offline PineScript v6 backtest MCP
How to install PineForge — offline PineScript v6 backtest MCP in Claude Code?
Run claude mcp add pineforge-offline-pinescript-v6-backtest-mcp -- docker run -i --rm ghcr.io/pineforge-4pass/pineforge-backtest-mcp:v0.9.40. Docker must be running on your system.
What does PineForge do?
It compiles PineScript v6 trading algorithms into C++ units and calculates backtest results against OHLCV CSV files locally. No external accounts or API keys are needed.
Why must input CSV paths use /work/... prefixes?
The container executes from /app, while user files mount to /work. Using relative paths places output inside container storage that gets erased when the container exits.