Documentation menu

Connect your agent to Lightwick.

Research strategies against your captured market data—without giving your agent access to live trading.

Research only. Lightwick MCP cannot place orders, activate a strategy, or access live-trading state.

Connect over stdio

Lightwick MCP is a local JSON-RPC server. Your client launches the executable and communicates over standard input and output; no port, cloud service, or broker credential is exposed.

Choose the executable your Lightwick build provides.

Packaged builds should point at their bundled lightwick-mcp executable. When developing from source, build it with Swift and use the resulting absolute path.

Build from source
swift build --product lightwick-mcp
./.build/debug/lightwick-mcp
Generic MCP client configuration
{
  "mcpServers": {
    "lightwick": {
      "command": "/absolute/path/to/lightwick-mcp"
    }
  }
}

Restart or reload your MCP client, then ask it to call list_series. If the tool appears and returns a structured response, the connection is ready.

Your first research session

A productive session moves from data quality to behavior, then from fitted results to evidence the strategy has not seen.

  1. 1

    List captured series

    list_series

    Find the symbol and timeframe combinations that are actually available.

  2. 2

    Inspect bar quality

    get_bars

    Check coverage, session gaps, price scale, and whether data was resampled.

  3. 3

    Create and validate

    create_strategy · validate_strategy

    Compile before saving and keep diagnostics in the loop while revising.

  4. 4

    Evaluate signals

    evaluate

    See whether conditions transition, plots warm up, and risk expressions resolve.

  5. 5

    Backtest

    backtest

    Use the correct point value, tick size, sizing mode, costs, and slippage.

  6. 6

    Optimize with holdout

    optimize

    Compare in-sample and withheld results; prefer a stable plateau over an isolated peak.

  7. 7

    Start a forward test

    start_forward_test

    Record the idea before new data arrives.

Ask your agent
Using Lightwick:

1. List the captured market-data series.
2. Inspect ES m5 coverage and its largest gap.
3. Create and validate a simple trend strategy.
4. Evaluate every signal before backtesting it.
5. Backtest with ES pointValue 50 and tickSize 0.25.
6. Optimize with the default 30% holdout and report stability.
7. Start a forward test only if the out-of-sample result holds up.

All 21 MCP tools

Tools are grouped by the job they perform. In normal use, let the agent select them; this reference is for understanding its actions and giving precise instructions.

Strategy library

Read and change the same saved-strategy library the Mac app uses.

list_strategies

List saved strategy metadata without loading source.

get_strategy

Read a saved strategy and its complete .mtrade source by ID or exact name.

create_strategy

Compile and save a new strategy.Nothing is saved when compilation fails.

update_strategy

Change metadata or source by strategy ID.New source must compile before the update is written.

delete_strategy

Delete a saved strategy by ID.

validate_strategy

Compile arbitrary source and return stable diagnostics without saving it.

format_strategy

Return canonically formatted source, preserving comments.

Language help

Give the agent the grammar and semantics it needs before it authors code.

get_language_guide

Return the full Lightwick Script guide.

get_grammar

Return EBNF, the language version, risk fields, and signal kinds.

list_builtins

List callable functions and zero-argument values, optionally filtered by category.

Market data

Discover and inspect completed OHLCV bars already held by Lightwick.

list_series

List captured symbol/timeframe pairs with bar counts and coverage.

get_bars

Read up to 500 recent bars and report the largest observed gap.

request_backfill

Queue an asynchronous history request for the running app.

list_backfill_requests

Inspect pending, in-progress, fulfilled, failed, or rejected backfills.

Research

Run the deterministic strategy engine over captured completed bars.

evaluate

Return every signal, plot coverage, resolved risk rule, and diagnostic.Use this before backtest when behavior is surprising.

backtest

Simulate next-bar fills with instrument sizing, costs, slippage, and risk exits.

optimize

Grid-search inputs with a 30% holdout by default and report neighbor stability.

Forward tests

Freeze an idea before future bars exist, then compare fitted and truly later performance.

start_forward_test

Freeze source, inputs, instrument configuration, and the current-time boundary.

list_forward_tests

List registered observations and their identifiers.

get_forward_test

Compare pre-boundary fit with bars and trades observed afterward.

delete_forward_test

Remove a forward-test journal entry.

How market data reaches MCP

MCP does not connect to Rithmic. It reads the completed OHLCV bar store that Lightwick maintains on disk.

  1. Lightwick loads a series.History and each newly completed bar are persisted by the app.
  2. MCP reads the shared store.list_series, get_bars, and the research tools use those completed bars.
  3. Missing intraday series may be resampled.The response includes a dataNote; daily and weekly series are never synthesized this way.
  4. Backfill stays app-owned.request_backfill writes a bounded queue entry. Nothing is fetched while Lightwick is closed or disconnected.
Inspect before trusting.

get_bars reports the expected bar interval and the largest observed gap. A backtest can be mathematically correct over incomplete data and still support the wrong conclusion.

The research boundary

The server is intentionally useful on one side of a hard line and powerless on the other.

MCP can

  • Read and change saved strategies
  • Validate and format arbitrary source
  • Read captured completed bars
  • Backtest and optimize when entitled
  • Register forward tests

MCP cannot

  • Place, modify, or cancel orders
  • Activate a strategy in live trading
  • Read broker credentials
  • Reach the network or filesystem from a script
  • Turn advisory signals into execution

Authoring and validation remain available without Lightwick Pro. backtest and optimize require an active entitlement.

Troubleshooting

The server does not appear in my client

Use an absolute executable path, verify the file can run on your Mac, then restart the client. Protocol messages use stdout; server logs use stderr.

list_series is empty

Open the desired symbol and timeframe in Lightwick while connected, or queue request_backfill. The MCP server does not fetch from the broker itself.

A compiling strategy produces no signals

Call evaluate. Signals require an exact false-to-true transition; missing warm-up values cannot fire and a condition already true on the first evaluated bar never transitions.

Futures profit is scaled incorrectly

Set the instrument configuration explicitly. ES normally uses pointValue: 50 and tickSize: 0.25; leaving point value at 1 scales every profit figure incorrectly.

Backtest or optimize says Lightwick Pro is required

Open Lightwick and sign in with an active subscription. Strategy authoring, language help, validation, formatting, data inspection, and evaluation do not cross that research entitlement gate.