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).
mercury --helpGlobal options
Section titled “Global options”Available on every command:
| Option | Values |
|---|---|
--log-level | trace | debug | info | warn | error |
--log-format | pretty | json |
--no-banner | suppress the startup banner |
MERCURY_LOG_LEVEL is honored as an environment variable equivalent to --log-level.
MERCURY_LOG_LEVEL=debug mercury servemercury --log-level trace --log-format json run --helpRun the Mercury REST server.
mercury serve --host 127.0.0.1 --port 8080Routes 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.
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:
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-1Notes
--operationuses the formlibraryId:version:definition(e.g.Test:1.0.0:InDenominator).--valuesetis repeatable.--parameter(alias--param) is repeatable; format isname:value:type.- Use CQL-only or ELM-only per run.
edition
Section titled “edition”Print the compile-time edition without starting the server.
mercury --no-banner editionCommunity binaries print:
edition=communityMarketplace binaries are built with the marketplace Cargo feature and print:
edition=marketplaceMERCURY_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.
lang-tests
Section titled “lang-tests”Run the CQL language test suite and write a summary. This is how the conformance numbers are reproduced.
mercury lang-tests --dir cql-tests/tests/cqlSee Conformance & correctness for what the results mean.