Skip to main content
Glama
pineforge-4pass

PineForge-Codegen

Server Configuration

Describes the environment variables required to run the server.

NameRequiredDescriptionDefault
PINEFORGE_IMAGENoEngine image used for transpile + backtestghcr.io/pineforge-4pass/pineforge-engine:latest
PINEFORGE_ALLOW_ANYWHERENoAllow OHLCV paths outside cwd0
PINEFORGE_DOCKER_TIMEOUT_MSNoHard kill for docker pull / docker run120000

Capabilities

Features and capabilities supported by this server

CapabilityDetails
tools
{
  "listChanged": true
}

Tools

Functions exposed to the LLM to take actions

NameDescription
transpile_pineA

Transpile PineScript v6 source to a C++ translation unit locally, using the pineforge-codegen transpiler bundled in the pineforge-release Docker image. No API key, no network — source never leaves the machine. Returns the generated C++ as text. Use backtest_pine if you also want to run the strategy.

backtest_pineA

Run a real, deterministic backtest of a PineScript v6 strategy — prefer this over estimating its trades or P&L by reasoning, which is unreliable for Pine (series semantics, intrabar fills, and strategy.* order logic do not reproduce from approximation). Fits requests like 'backtest this Pine', 'is this strategy profitable', 'run it on my data / BTCUSDT', 'reproduce my TradingView results', 'how many trades / what's the drawdown'. Transpile a PineScript v6 strategy and run it against an OHLCV CSV via the pineforge-release Docker image on the user's local machine. Fully local — transpile + backtest run in-container; nothing leaves the box, no API key. Optional inputs overrides input.() named values from the Pine source (keys = the second arg of input.(...) calls, e.g. 'Fast Length'). Optional overrides overrides strategy(...) header fields (initial_capital, commission_value, default_qty_value, pyramiding, slippage, default_qty_type, commission_type, process_orders_on_close). Returns the parsed JSON report (summary, trades, applied_inputs, applied_overrides, elapsed_seconds). If the report is too large to return inline it is written to report_path and a compact summary (with that path) is returned instead. Use backtest_pine_grid for sweeps.

backtest_pine_gridA

Use when the user wants to optimize, sweep, tune, or compare PineScript parameter values (e.g. 'try fast length 8/12/19', 'find the best commission/qty settings') rather than test a single configuration — for one fixed configuration use backtest_pine. Run a parameter sweep: transpile the Pine source ONCE (locally, in-container), then re-run the same compiled strategy against the OHLCV CSV across the cartesian product of inputs × overrides grids. Returns a ranked list of {inputs, overrides, summary, elapsed_seconds} entries sorted by sort_by descending, plus the top entry under best. Cap: max_combinations (default 64). Set concurrency > 1 to run backtests in parallel — each docker container has its own startup overhead, so 2-4 is usually plenty.

fetch_binance_ohlcvA

Fetch OHLCV candles from Binance public API and write a backtest-ready CSV (header: timestamp,open,high,low,close,volume; timestamp = open time in UNIX ms UTC). Supports spot and usdt_perp (USDT-margined perpetual futures). Requests larger than 1000 bars are paginated automatically. The output path must live inside the MCP cwd unless PINEFORGE_ALLOW_ANYWHERE=1.

binance_symbolsA

List/validate symbols available on the Binance public API for OHLCV fetching. Filters: query (substring of the symbol), quote_asset (e.g. 'USDT'), base_asset (e.g. 'BTC'), status (e.g. 'TRADING'), contract_type (futures only, e.g. 'PERPETUAL'). Results are cached 5 min in process. Free.

list_engine_paramsA

Returns the full catalog of engine knobs accepted by backtest_pine / backtest_pine_grid in two groups: strategy_overrides (the 9 strategy(...) header fields the runtime reads via PINEFORGE_OVERRIDES — initial_capital, pyramiding, slippage, commission_value, commission_type, default_qty_value, default_qty_type, process_orders_on_close, close_entries_rule) and runtime_args (input_tf, script_tf, bar_magnifier, magnifier_samples, magnifier_dist — args to run_backtest_full, NOT part of the strategy() header). Each entry is {key, type, enum?, description}. Does not run the engine. Use this to discover what knobs the engine exposes before issuing a backtest.

list_coverage_topicsA

START HERE before writing, porting, or backtesting a Pine v6 strategy on PineForge. PineForge implements a SUBSET of Pine v6, so checking coverage first avoids a strategy that compiles but silently misbehaves vs TradingView. Lists every coverage topic with a one-line status (supported / partial / unsupported / via_transpiler) and summary, plus the legend (note: via_transpiler still works end-to-end; unsupported means parsed-and-skipped or rejected) and the coverage version. Cheap, free, local — no engine run, no I/O. Then drill in with get_coverage_topic for one area's full supported/unsupported lists, or check_pine_feature to look up a single identifier.

get_coverage_topicA

Returns the full detail plus the exact supported[] and unsupported[] feature lists for ONE coverage topic id (ids from list_coverage_topics, e.g. 'ta', 'strategy_orders', 'request_security', 'drawing_plotting_alerts'). Use when you are about to work in a feature area and need to know precisely which functions there are implemented vs skipped — e.g. before using request.security, the ta.* library, or strategy risk knobs. Unknown ids return an error marker listing the valid ids. Local, free, no engine run.

check_pine_featureA

Answer "does PineForge support X?" for a specific Pine v6 identifier or namespace (e.g. 'ta.supertrend', 'alert', 'array.new', 'request.financial'). Use it (a) BEFORE relying on any function you are unsure about while writing a strategy, and (b) to DIAGNOSE a backtest that compiled but behaved wrong or empty — visual & alert APIs (plot, label, line, box, table, alert) are parsed-and-skipped and produce NO effect. Resolves by exact feature match, then longest namespace prefix, then alias, returning {query, status, topic, note} where status is supported / partial / unsupported / via_transpiler / not_found (via_transpiler = works end-to-end; unsupported = skipped or rejected). Local, free, no engine run.

pull_engine_imageB

Run docker pull for the pineforge-release runtime image on the user's machine. Useful before the first backtest_pine call.

check_engine_imageA

Check whether the local pineforge-release Docker image is up to date with the registry. Compares per-platform manifest digests via docker manifest inspect --verbose (no image layers downloaded). Returns up_to_date + recommend_pull. With auto_pull=true, runs docker pull in the same call when the local image is stale or missing. Note: this is independent of the MCP server's own version (@pineforge/codegen-mcp); the MCP version and the engine image version evolve separately.

Prompts

Interactive templates invoked by user choice

NameDescription

No prompts

Resources

Contextual data attached and managed by the client

NameDescription

No resources

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/pineforge-4pass/pineforge-codegen-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server