Reference
CLI
Complete reference for the mocko command. For a guided tour of the same options, see Running Mocko: CLI.
Usage
mocko [options] [path to mocks folder]The mocks folder is optional; without it, file mocks are disabled for the session. Requires Node.js 20.19 or newer, installed with npm install -g @mocko/cli.
Options
| Flag | Default | Description |
|---|---|---|
-h, --help | Show usage help. | |
-v, --version | Show the installed version. | |
-w, --watch | off | Watch the mocks folder and reload on file changes. |
-p, --port | 8080 | Port for the mock server. |
-u, --url | unset | Proxy target for requests no mock matches. Unset means unmatched requests return 404. |
-t, --timeout | 30000 | Max milliseconds to wait for a proxied response. |
--no-ui | UI on | Disable the control panel. |
-r, --redis | unset | Redis URL enabling Redis mode, e.g. redis://localhost:6379. |
-P, --ui-port | 6625 | Port for the control panel. |
Examples
$mocko --watch mocks
$mocko -p 4000 -u https://demo-api.mockoapp.net --watch mocks
$mocko --no-ui -r redis://localhost:6379 mocks
Notes
- The UI is enabled by default; the CLI generates a fresh internal secret per run to connect it to the mock server.
- Hidden files and folders (names starting with a dot) inside the mocks folder are ignored.
- On unsupported Node versions the CLI exits with a link to the update instructions instead of failing later at runtime.