Skip to content

CLI reference

The mercury CLI has four commands: serve (run the REST server), run (execute a single local operation), lang-tests (run the CQL language test suite), and edition (print the compile-time product edition).

Terminal window
mercury --help

Available on every command:

OptionValues
--log-leveltrace | debug | info | warn | error
--log-formatpretty | json
--no-bannersuppress the startup banner

MERCURY_LOG_LEVEL is honored as an environment variable equivalent to --log-level.

Terminal window
MERCURY_LOG_LEVEL=debug mercury serve
mercury --log-level trace --log-format json run --help

Run the Mercury REST server.

Terminal window
mercury serve --host 127.0.0.1 --port 8080

Routes are served under /cqf, /api, and /fhir. See Running the containers and Mounting your data drive for deployment.

Execute a single operation workflow locally. Data is supplied inline and isn’t persisted — see Loading data: preload vs inline.

Terminal window
mercury run \
--data /path/to/bundle.json \
--valueset /path/to/valuesets.json \
--operation Test:1.0.0:InDenominator \
--cql /path/to/Test.cql \
--context patient-1 \
--parameter "Measurement Period_start:2025-01-01:DateTime" \
--parameter "Measurement Period_end:2026-01-01:DateTime"

Use ELM XML instead of CQL by swapping --cql for one or more --elm inputs:

Terminal window
mercury run \
--data /path/to/bundle.json \
--valueset /path/to/valuesets.json \
--operation Test:1.0.0:InDenominator \
--elm /path/to/FHIRHelpers.xml \
--elm /path/to/Test.xml \
--context patient-1

Notes

  • --operation uses the form libraryId:version:definition (e.g. Test:1.0.0:InDenominator).
  • --valueset is repeatable.
  • --parameter (alias --param) is repeatable; format is name:value:type.
  • Use CQL-only or ELM-only per run.

Print the compile-time edition without starting the server.

Terminal window
mercury --no-banner edition

Community binaries print:

edition=community

Marketplace binaries are built with the marketplace Cargo feature and print:

edition=marketplace

MERCURY_EDITION is a runtime consistency check, not the switch that changes a binary’s edition. A community binary started with MERCURY_EDITION=marketplace refuses to start.

Run the CQL language test suite and write a summary. This is how the conformance numbers are reproduced.

Terminal window
mercury lang-tests --dir cql-tests/tests/cql

See Conformance & correctness for what the results mean.