Skip to content
subcloakdocs

Automation and AI

cloakctl command-line tool

Every cloakctl command and flag: run a headless proxy, replay captured requests, and run collections, flows, monitors, mocks and load tests from Terminal.

cloakctl is the command-line tool that ships inside Cloak Proxy. It does three jobs: it talks to the running app (list, show, replay and export captured requests), it runs a capture proxy on its own with no app window (for scripts and CI), and it runs the API client workspace from Terminal, like Newman or the Postman CLI. It is also the MCP server that AI assistants use.

The tool lives inside the app bundle at:

/Applications/Cloak Proxy.app/Contents/Resources/cloakctl

You can run it from there, but a link on your PATH lets you type cloakctl. The app shows the exact path and a ready-made command in Settings › Advanced › Command line.

Settings › Advanced shows where cloakctl is and copies the commands that link it and connect AI assistants.

  1. Where cloakctl is on this Mac
  2. Copies the command that links cloakctl into /usr/local/bin
  3. Copies the command that adds the MCP server to Claude Code
Settings, Advanced tab: TLS key logging, the Command line section with the cloakctl path and a Link to /usr/local/bin command, and the AI assistants (MCP) section
  1. Open Settings › Advanced and click Copy next to Link to /usr/local/bin.

  2. Paste the command into Terminal and press Return. macOS asks for your password because /usr/local/bin belongs to the system.

    Terminal
    sudo mkdir -p /usr/local/bin
    sudo ln -sf "/Applications/Cloak Proxy.app/Contents/Resources/cloakctl" /usr/local/bin/cloakctl

    The first line only matters on a Mac where /usr/local/bin doesn’t exist yet.

  3. Check that it works:

    Terminal
    cloakctl status

The link points into the app, so it keeps working after you update Cloak Proxy. Remove it with sudo rm /usr/local/bin/cloakctl.

Command What it does Needs the app running
cloakctl run Runs a headless capture proxy and prints each exchange. Can record, report and fail a CI job. No
cloakctl ca Prints the path of the root certificate, creating it if needed. No
cloakctl status Port, request count and active debugging tools. Yes, or cloakctl run
cloakctl list Captured requests, one per line. Yes, or cloakctl run
cloakctl show ID Headers and bodies of one request, as JSON. Yes, or cloakctl run
cloakctl curl ID One request as a cURL command. Yes, or cloakctl run
cloakctl replay ID Sends a captured request again. Yes, or cloakctl run
cloakctl export Every captured request as HAR. Yes, or cloakctl run
cloakctl events ID Since 0.4.0 A streamed response one event per line, optionally following it live, or from a session file. See Streaming responses. Yes, or a session file with --session
cloakctl llm Since 0.4.0 Model calls in a saved session or the running app: tokens, cost and speed by model; --max-cost fails CI over a budget. See LLM Inspector. No with --session; otherwise yes
cloakctl mcp The Model Context Protocol server, on standard input and output. Since 0.5.1 --app, --host, --scope and --metadata-only narrow the assistant scope for that connection. For traffic and proxy tools
cloakctl collection list Collections, requests and environments in the workspace. No
cloakctl collection run Runs a collection, or a .http file Since 0.4.1, with its tests and reporters. No
cloakctl collection import, export Since 0.4.1 Adds a Postman, OpenAPI, HAR, Insomnia or .http file to the workspace, or writes a collection as a .http file. No
cloakctl query 'EXPR' [FILE] Since 0.4.1 Requests matching a typed query, from a HAR or session file or the running app. --fail-if-any for CI. Without a file
cloakctl mock Serves a collection’s saved examples on localhost. No
cloakctl perf Load tests a collection. No
cloakctl spec Lints, imports and syncs OpenAPI specs. No
cloakctl docs Writes a collection’s API documentation as one HTML file. No
cloakctl flow Since 0.2.0 Lists flows, or runs one with inputs. No
cloakctl monitor Since 0.2.0 Lists monitors, or runs one now and adds the run to its history. No
cloakctl sdk Since 0.2.0 Generates a TypeScript, Python or Swift client SDK from a collection. No
cloakctl mcp-server Since 0.2.0 Generates a Node.js MCP server from a collection. No
cloakctl contract Since 0.4.0 Checks a saved session against an OpenAPI spec (Markdown, JSON or JUnit), or drafts a spec from it. See Contract checking. No
cloakctl diff Since 0.4.0 Compares two recordings of the same journey (Markdown or JSON) and fails on the differences you choose. See Release diff. No
cloakctl tests Since 0.4.0 Makes a test collection (Postman v2.1) from a recording, to run with cloakctl collection run; --run runs it at once. See Make tests from traffic. No
cloakctl compare-envs Since 0.4.0 Sends a recording’s requests to another environment and reports what differs (Markdown or JSON). See Compare environments. No
cloakctl report Since 0.4.0 Builds a bug-report bundle (summary, redacted HAR and session, replayable flow, cURL repros) from a HAR, a session or the running app. See Report Bug. No (--from-app needs it)
cloakctl authz Since 0.4.0 Replays a saved session as other users and reports which endpoints leak data. See Authorization matrix. No
cloakctl trace Since 0.4.0 Checks trace propagation in a saved session (Markdown or JSON), or lists the requests in one trace. See Distributed tracing. No
cloakctl rules TOOL … Since 0.4.0 List, read, create, change, delete, enable and disable one tool’s rules; switch the tool on or off. See Manage rules from the command line. Yes
cloakctl rules folders, sets, … Since 0.4.0 Rule folders and sets: list, switch on and off, export, import. See Rule folders and sets. Yes
cloakctl cert Since 0.4.0 The root certificate: whether this Mac trusts it, its PEM, its file. Yes
cloakctl external-proxy Since 0.4.0 Show, set or turn off the upstream proxy. Yes
cloakctl app-capture Since 0.5.0 App Capture: its state and picked apps; ask to capture an app, which you allow in Cloak Proxy. See App Capture. Yes
cloakctl mcp on|off|status Since 0.4.0 Let AI assistants use the app, or lock them out. Yes
cloakctl toxiproxy on|off|status Since 0.4.0 The Toxiproxy-compatible API. Yes
cloakctl scenarios Since 0.4.0 Lists failure scenarios, switches them on and off, creates one from a template, and reads the log of what they did. See Failure scenarios. Yes
cloakctl skills Since 0.4.0 Lists, installs, updates, removes or exports the agent skills for Claude Code, Codex or a folder. See Agent skills. No
cloakctl setup Since 0.4.0 Prints the guided capture checklist for a target and applies steps, such as installing the certificate in booted simulators. No (asks the app when it’s running)
cloakctl browser Since 0.4.0 Opens a capturing browser (Chrome, Chromium, Edge, Brave or Firefox in its own proxied profile), or lists them. See Capture targets. No
cloakctl electron Since 0.4.0 Starts an Electron app with capture, or lists them. No
cloakctl capture-config Since 0.4.0 Generates or writes a Docker Compose override, docker run flags, an env file, a Flutter proxy file or an Android network security config. No
cloakctl env Since 0.4.0 Prints the proxy variables for zsh, bash, fish or PowerShell: eval "$(cloakctl env)". No
cloakctl docs-search Since 0.4.0 Searches these docs offline. No
cloakctl scope Since 0.5.1 The active scope: check URLs, create, import, include, exclude and activate scopes. See Security testing. Yes
cloakctl tokens Since 0.5.1 Tokens and sign-in flows in the captured traffic, with their findings. See Tokens and sign-in. Yes
cloakctl fuzz Since 0.5.1 Runs the request fuzzer against hosts you pass with --scope; a dry run without --confirm. No
cloakctl ai-scan, mcp-pins, guard Since 0.5.1 Prompt injection and leaked secrets in a session, MCP tool pins and the AI Guard. See AI security. No with --session; otherwise yes
cloakctl team Since 0.7.0 Team Cloud: whoami and pull a team set with a CI token, ci create a CI token on an admin’s Mac, and audit verify an exported audit log. See Team Cloud. No
cloakctl mcp-exec Since 0.7.0 Starts a shared team MCP server with its vault references filled in for you. Agent configs that Cloak Proxy installs run it; you don’t run it yourself. No
cloakctl findings Since 0.5.1 Lists, shows, exports, creates, imports and checks an engagement’s findings. No

cloakctl run starts a capture proxy without the app. It uses the same engine, the same root certificate and the same debugging-tool rules format as the app, and prints one line per finished request. Use it on a Mac where you don’t want the app open, in scripts, or to wrap a test command in CI. The CI options are covered in depth in Headless runs and CI.

Terminal
cloakctl run --port 9091 --ssl 'api.example.com' --ssl '*.example.com'

On start it writes the listening address and the certificate path to standard error:

Cloak Proxy listening on 127.0.0.1:9091
CA: /Users/ada/Library/Application Support/CloakProxy/cloak-proxy-ca.pem
Flag Value What it does
--port Number Port to listen on. Default 9090. Pick another port, such as 9091, while the app is running on 9090.
--ssl Host pattern Decrypts HTTPS for hosts matching the pattern. Repeat for several. Wildcards work: *.example.com, or '*' for everything. Without it, HTTPS passes through as encrypted tunnels.
--ssl-app App name Decrypts every HTTPS connection from that app. Repeat for several. From 0.4.2, a browser’s name (Google Chrome, Firefox, Safari…) prints a warning to stderr: decrypting all of a browser’s traffic breaks sign-ins and bot-protected sites, and cloakctl browser opens a Capturing Browser instead. Since 0.4.2
--tools Path to a JSON file Loads debugging-tool rules, and which tools are on, from a file made with Tools › Export Rules… (Map Local, Map Remote, Scripting, Block List and the rest).
--keylog Path Writes TLS session keys in SSLKEYLOGFILE format for Wireshark.
--all-interfaces None Listens on 0.0.0.0 so other devices can connect. By default it listens on 127.0.0.1 only.
--scope Since 0.5.1 Path to a .cloakscope.json file Holds the run to a scope: traffic outside it isn’t recorded.
--out-of-scope Since 0.5.1 dontRecord, block or record With --scope: what happens to traffic outside it. dontRecord is the default; block answers 403 and closes tunnels.
Flag Value What it does
--record Path Saves the traffic when the run ends: HAR if the file ends in .har, otherwise a Cloak Proxy session (.cloaksession).
--redact None Removes tokens, cookies, passwords and keys from the recording.
--report Path Writes a Markdown report: endpoints with calls, errors, p50 and p95; possible secrets (masked); security header grades; performance findings; and schema changes. When the run made model calls, the report has an AI section (tokens, cost, failures by model).
--mock Path to a .har or .cloaksession Answers requests from a recording instead of the network, for offline tests. Unrecorded requests to a recorded host get a 404.
--trace HOST_PATTERN Since 0.4.0 Adds a sampled W3C traceparent to requests for matching hosts, so each one gets a backend trace. Repeatable. --trace-unsampled clears the sampled flag.
--duration Seconds Stops after this long.
--quiet None Doesn’t print each request.
--fail-on-5xx None Exits with 1 if any response was a server error.
--fail-on-error None Exits with 1 on any 4xx, 5xx or failed request.
--fail-on-secrets None Exits with 1 if high-severity secrets were found.
--fail-on-schema-change None Exits with 1 if an endpoint’s JSON shape changed during the run.
-- A command and its arguments Runs the command with the proxy and certificate environment set, and stops the proxy when it exits. Must come last.

The run stops on Control C, on SIGTERM, after --duration, or when the command after -- exits. Then it writes the recording and the report, and prints a one-line summary to standard error:

42 requests, 9 endpoints, 1 errors, 0 possible secrets, 0 schema changes

Each finished request prints as one line:

Part Example Meaning
Id #12 The request’s number in this run.
App [node] The app that sent it, or ? when it can’t be identified.
Status 200, TUN, ERR The response status, TUN for an HTTPS connection passed through without decrypting, or ERR for a failure.
Method and URL GET https://api.example.com/v1/users The request.
Duration and size 84ms 2 KB Time to complete and response body size.

Decrypted requests end with a lock symbol. Failed requests print the error message on an indented second line.

Terminal
cloakctl ca

Prints the path of the Cloak Proxy root certificate (~/Library/Application Support/CloakProxy/cloak-proxy-ca.pem). If no certificate exists yet, it creates one first. Use it to point a runtime at the certificate, for example export NODE_EXTRA_CA_CERTS="$(cloakctl ca)".

These commands ask the running app (or a running cloakctl run) for what it captured, through the local control API. They find the app’s port in its saved settings. If the proxy listens somewhere else, add --port N.

Terminal
cloakctl status
cloakctl list --host api.example.com --errors --limit 20
cloakctl list --query 'status:5xx app:MyApp'
cloakctl show 12
cloakctl curl 12
cloakctl replay 12
cloakctl export --out session.har
Command Options Output
cloakctl status --port N JSON: app, port, recording, flowCount and activeTools.
cloakctl list --search TEXT (URL or app name contains it), --host HOST (host contains it), --graphql OPERATION (GraphQL requests whose operation contains it) Since 0.4.0, --query 'EXPR' (a typed query) Since 0.4.1, --errors (only failures, 4xx/5xx and GraphQL errors), --limit N (default 50), --port N One line per request, newest last: #12 200 GET [Safari] https://api.example.com/v1/users 84ms. Tunnels show TUN, failures ERR. GraphQL requests add the operation in braces and any errors: #52 200 POST [ShopApp] https://api.shopapp.example/graphql {mutation CreateOrder} 410ms GraphQL errors: PAYMENT_DECLINED: Your card was declined.
cloakctl show ID --port N Pretty JSON with the summary fields, request and response headers and bodies, and WebSocket messages.
cloakctl curl ID --port N The request as a curl command.
cloakctl replay ID --port N Sends the request again, unchanged, through the proxy, and prints the new request and response as JSON. The replay also appears in the app.
cloakctl export --out FILE, --since ID|ISO8601-TIME Since 0.4.0, --port N Every request the proxy remembers, as HAR. Without --out it writes to standard output. --since exports only requests newer than a request id, or started at or after a time.

These commands see the proxy engine’s own list of the most recent 5,000 requests. That list starts empty each time the proxy restarts, isn’t emptied by Clear Session, and doesn’t include sessions you open from files.

If the app isn’t running, these commands stop with:

error: Couldn't reach Cloak Proxy on port 9090. Is the app (or `cloakctl run`) running? (…)
Since 0.4.1

cloakctl query prints the requests that match a typed query, from a HAR or session file, or from the running app when you don’t give a file.

Terminal
cloakctl query 'status:5xx -host:*.example.net' run.har --fail-if-any
cloakctl query 'app:ShopApp dur:>1s' --count
cloakctl query --explain 'status:5xx app:ShopApp'

See Query language › command line for every option.

Since 0.4.0

cloakctl rules TOOL lists, creates and changes one tool’s rules in the running app, so a script or CI job can set up mocks and breakpoints. TOOL is mapLocal, mapRemote, rewrite, breakpoint, scripting, blockList, allowList, networkConditions, dnsSpoofing, mockSets or alerts.

Terminal
cloakctl rules mapLocal create --url 'api.example.com/v1/cart' --name "Empty cart" --status 200 --body '{"items":[]}'
cloakctl rules mapLocal list
cloakctl rules mapRemote test 6F1C2A3B-0000-4000-8000-00000000AB12 --url 'https://api.example.com/v1/orders?page=2'
cloakctl rules mapLocal disable 6F1C2A3B-0000-4000-8000-00000000AB12
cloakctl rules rewrite create --json rule.json # fields as in `cloakctl rules rewrite example`
cloakctl rules breakpoint off
Command What it does
cloakctl rules TOOL [list] The tool’s rules
cloakctl rules TOOL get ID One rule as JSON
cloakctl rules TOOL create --json FILE A new rule from a JSON file, or - for standard input. Fields as in cloakctl rules TOOL example.
cloakctl rules TOOL create --url PATTERN [--name NAME] [--method GET] [--folder "A › B"] [--status N --body TEXT] A new rule from flags. --folder puts it in a folder, created when needed.
cloakctl rules TOOL update ID --json FILE Changes the given fields
cloakctl rules TOOL delete ID, enable ID, disable ID Deletes a rule, or turns it on or off
cloakctl rules TOOL on, off Switches the whole tool
cloakctl rules TOOL example Every field a rule of the tool has
cloakctl rules TOOL test ID|--json FILE --url URL [--method GET], or --request ID Since 0.5.1 Whether a saved rule (or rule fields; with both, that rule with those fields changed) matches a URL or a captured request, the first reason it doesn’t, and what the tool does with it, such as the URL Map Remote sends it to. Changes nothing; exits 1 when it doesn’t match, so a script can check a rule before relying on it.
Terminal
$ cloakctl rules mapRemote test --json remote.json --url 'https://api.example.com/v1/orders?page=2'
Matches https://api.example.com/v1/orders?page=2
Sent here instead
→ http://localhost:8080/orders?page=2

Certificate, upstream proxy and assistants

Section titled “Certificate, upstream proxy and assistants”
Since 0.4.0
Command What it does
cloakctl cert [info|pem|path] The root certificate: whether this Mac trusts it, its PEM text, or its file
cloakctl external-proxy [show] The upstream proxy every request goes through
cloakctl external-proxy set HOST:PORT [--socks] [--user NAME --password-env VAR] Sets the upstream proxy. The password is read from the environment variable VAR, so it never appears in your shell history. Up to 0.4.1 a SOCKS5 proxy ignores the username and password; from 0.4.2 it uses them. Since 0.4.2
cloakctl external-proxy off Turns the upstream proxy off
cloakctl mcp on|off|status Lets AI assistants use the app, or locks them out. While it’s off, cloakctl mcp (the MCP server assistants run) is refused with MCP access to Cloak Proxy is turned off; every other cloakctl command keeps working, including cloakctl mcp on. The setting is saved.
cloakctl toxiproxy on [--api-port 8474]|off|status The Toxiproxy-compatible API on 127.0.0.1
Since 0.4.0

cloakctl rules switches rule folders and sets in the running app, for example to turn a test scenario on before a UI test run and off after it.

Command What it does
cloakctl rules folders [--tool TOOL] Every folder: tool, path, on or off, rule count and sets
cloakctl rules folder enable NAME [--tool TOOL] Turns a folder on. disable turns it off.
cloakctl rules folder create NAME --tool TOOL [--parent NAME] Creates a folder
cloakctl rules folder delete NAME [--tool TOOL] [--delete-rules] Deletes a folder; its rules move up a level unless you add --delete-rules
cloakctl rules sets Every set, the active one marked with *
cloakctl rules set activate NAME Turns the set’s folders on and every other set’s folders off
cloakctl rules set off Turns every set’s folders off
cloakctl rules set create NAME [--folders A,B] Creates a set from those folders, or from the folders that are on now
cloakctl rules set delete NAME Deletes a set
cloakctl rules export --set NAME or --folder NAME [--out FILE] Writes a set or a folder, with its rules, as a rules file
cloakctl rules import FILE Adds a rules file, from export or Tools › Export Rules…

NAME is a folder name, a "Parent › Child" path or an id; TOOL is a tool name such as mapLocal, breakpoint, rewrite or blockList.

Terminal
cloakctl rules set activate "Payment declined"
npm run test:e2e
cloakctl rules set off
Since 0.4.0

cloakctl scenarios switches failure scenarios in the running app around a test run, and reads what they did.

Command What it does
cloakctl scenarios Every scenario: on or off, its faults, and how many requests each broke
cloakctl scenarios on NAME Switches a scenario on; its counts start again. off switches it off, reset resets its counts, delete deletes it.
cloakctl scenarios templates The built-in templates
cloakctl scenarios create --template NAME --url PATTERN [--operation GRAPHQL_NAME] [--name NAME] [--on] Creates a scenario from a template, for the requests matching the URL pattern (and GraphQL operation)
cloakctl scenarios log [NAME] [--limit N] [--json] What each fault did to each request
Terminal
cloakctl scenarios create --template "Flaky API" --url 'api.example.com/v1/orders*' --on
npm run test:e2e
cloakctl scenarios log "Flaky API"
cloakctl scenarios off "Flaky API"
Since 0.5.4

Record only some apps and hosts, mute hosts, and set how much traffic the running app keeps. See Focus mode and session size.

cloakctl focus What's in focus, and how many requests weren't recorded
cloakctl focus set [--app NAME]... [--host HOST]...
Record only these apps and hosts (everything else passes through untouched)
cloakctl focus add|remove [--app NAME]... [--host HOST]...
cloakctl focus off Record everything again (the list is kept)
cloakctl focus on Focus on the last list again
Hosts: api.example.com, or *.example.com for the domain and every subdomain.
cloakctl mute Muted apps and hosts
cloakctl mute app NAME | host HOST [--domain] Stop recording an app, a host or (--domain) its whole domain
cloakctl unmute app NAME | host HOST
cloakctl retention How many requests, and days of them, the session keeps
cloakctl retention [--requests 50000|100000|250000|500000] [--days 1|3|7|0]
Add --json for the raw reply.
Since 0.6.0

Create, list and revoke Personal Cloud share links through the running app. They need a Personal Cloud plan, and the app asks you before every link is made.

cloakctl share --ids 12,13 | --query 'host:api.example.com status:>=500' | --file SESSION.har
[--name NAME] [--expires 1h|24h|7d|30d] [--max-views N] [--password-stdin] [--no-bodies] [--no-redact]
Create a link (redacted unless --no-redact) and print it;
--file shares a saved .cloaksession, .cloak or .har file instead
cloakctl share links [--activity] Links this Mac made: status, expiry, views (not the links);
--activity also lists when and from which country each was opened
cloakctl share revoke ID Revoke a link: it stops working and its data is deleted
Add --json for the raw reply.
Since 0.7.0

Commands for Team Cloud. In CI they use a CI token from the CLOAK_TEAM_TOKEN environment variable (or --token-file PATH); on a member’s Mac they use that Mac’s team keys.

cloakctl run --team-mocks ID --team-rules ID [--record FILE --upload --library ID --tag TAG] -- COMMAND
Run COMMAND with team mock and rule sets applied; --upload
sends the recording to the team library whose id --library names
cloakctl team whoami The CI token's team, its CI member id, and the sets it can read
cloakctl team pull --space ID --out DIR Export a team set the token can read into a folder
cloakctl team ci create --label LABEL [--read SPACE]... [--upload SPACE] [--team TEAM_ID]
Make a CI token (on an admin's Mac); it's shown once
cloakctl team audit verify FILE.jsonl --security-code CODE [--at-change N]
Check an exported audit log against your team (or --unpinned)
cloakctl mcp-exec --team TEAM_ID --space SPACE_ID --server SERVER_ID --pin HASH
Start a shared team MCP server for the person running it

See CI with cloakctl for a GitHub Actions example.

Terminal
cloakctl mcp

Starts a Model Context Protocol server on standard input and output. You don’t run this yourself; your AI assistant starts it. It accepts three options:

Flag What it does
--port N Talks to a proxy on this port instead of the app’s configured one.
--workspace DIR Uses this API-client workspace folder instead of the app’s.
--no-redact Returns credentials in tool results as captured, whatever the app’s Redact sensitive data before sending to AI setting.
--app NAME, --host HOST, --scope QUERY, --metadata-only Since 0.5.1 Narrow the assistant scope for this connection: one app, a host, a typed query, or metadata only. They can’t widen what the app allows. See MCP server.

Setup for Claude Code, Claude Desktop, Cursor and VS Code is on MCP server.

Since 0.5.1

These commands work with the Security testing tools. Run any of them without arguments, or with --help, for every option.

Terminal
# Scope: the hosts and paths you may test
cloakctl scope # the active scope and its rules
cloakctl scope check https://api.example.com/v1/orders cdn.example.com
cloakctl scope import engagement-scope.json # Cloak Proxy, Burp Suite or a host list
cloakctl scope exclude payments.example.com
# Tokens and sign-in flows (passive)
cloakctl tokens --section findings
# The request fuzzer: a dry run, then the real run
cloakctl fuzz --request order.txt --numbers 1:1000 --scope api.example.com --grep forbidden
cloakctl fuzz --request order.txt --numbers 1:1000 --scope api.example.com --grep forbidden --rate 20 --confirm
# AI security
cloakctl ai-scan --session run.cloaksession --fail-on high
cloakctl mcp-pins check --session run.cloaksession --pins mcp-pins.json
cloakctl guard test "mail ada@example.com"
# Findings and reports
cloakctl findings list ./pentest
cloakctl findings export ./pentest --format pdf --out report.pdf
cloakctl findings check ./pentest --fail-on high

cloakctl scope include and activate widen what tools may reach, so Cloak Proxy asks you to allow them; exclude applies at once. cloakctl tokens, mcp-pins list and guard log read the running app. fuzz, ai-scan --session, mcp-pins check and findings work without it. See Scope, Tokens and sign-in, Request fuzzer, AI security and Findings and reports.

The workspace commands read and write the API client’s workspace folder directly, so they work without the app. If the app is open, it picks up changes.

Each command looks for the workspace in this order:

  1. The folder given with --workspace DIR.
  2. The folder chosen in the app’s API client.
  3. ~/Library/Application Support/CloakProxy/Workspace.

Where a command takes a collection, you can pass its name, its id, or the path to a Postman collection or OpenAPI file. See Workspace and Git for the folder layout.

Terminal
cloakctl collection list --workspace ~/code/shop-api

Prints each collection with its request count and id, then each request’s method (or protocol), folder path and URL, then the names of the environments.

Since 0.4.1
Terminal
cloakctl collection import requests.http --workspace ~/code/shop-api
cloakctl collection export "Shop API" --out shop.http --folder Orders

collection import adds a Postman collection, OpenAPI spec, HAR, Insomnia export or .http/.rest file to the workspace. collection export writes a collection, or one folder with --folder, as a .http file. See .http files.

cloakctl collection run runs a collection with its scripts, tests, auth and variables, like Newman. It runs every request type the API client has: HTTP, GraphQL, gRPC, MCP, AI, SQL, WebSocket, Socket.IO, MQTT and TCP. See Collection runner for how runs work.

Terminal
cloakctl collection run "Shop API" -e Staging -d users.csv -n 1 \
-r cli,junit --reporter-junit-export results/api.xml
Flag Value What it does
-e, --environment Environment name, or a Postman environment .json file The environment to use. Default: the workspace’s active environment.
-g, --globals Postman globals .json file Globals to use instead of the workspace’s.
-d, --iteration-data .csv or .json file, or a dataset name One iteration per row. Columns become variables. See Datasets and data files.
-n, --iteration-count Number How many times to run. Default 1.
--folder Folder name Runs only that folder (found at any depth).
--delay-request Milliseconds Pause between requests. Default 0.
--bail None Stops at the first request that errors or has a failing test.
--timeout-request Milliseconds Timeout for every request, overriding each request’s own setting.
--insecure, -k None Doesn’t verify TLS certificates for any request.
--env-var KEY=VALUE Adds a variable to the environment. Repeat for several. With no environment, creates one named CLI.
-r, --reporters Comma-separated list: cli, json, junit, html Which reports to produce. Default cli.
--reporter-json-export Path Where the JSON report goes. Default cloak-run.json.
--reporter-junit-export Path Where the JUnit XML report goes. Default cloak-run.xml.
--reporter-html-export Path Where the HTML report goes. Default cloak-run.html.
--workspace Folder The workspace to use.

Instead of a collection, you can give the path to a .http or .rest file Since 0.4.1. With -e NAME, the environment’s values include those of the environment it’s based on and its .env files.

The cli reporter prints each request’s folder path, method, URL, status, size and time, then a check mark or cross per test, console output, and script errors. It ends with a summary:

requests 12 (0 failed) · tests 31 (1 failed) · avg response 142ms · total 2310ms

The command exits with 0 when every request and test passed, and 1 otherwise.

Terminal
cloakctl mock "Shop API" --port 4010

Serves the collection’s saved examples on http://localhost:4010 until you press Control C. Without --port, it picks a free port and prints it. Each call prints as GET /v1/users → 200 (Example name), or (no example) when nothing matched. Variables come from the active environment. See Mock servers.

Terminal
cloakctl perf "Shop API" --vus 20 --duration 60 --profile rampUp -e Staging
Flag Value What it does
--vus Number Virtual users. Default 10.
--duration Seconds How long to run. Default 30.
--profile fixed, rampUp, spike or peak Load shape. Default fixed.
--think-time Milliseconds Pause between each user’s iterations. Default 0.
-e Environment name or file The environment to use.
--workspace Folder The workspace to use.

It prints one line per second (active users, requests per second, average and p95 latency, errors), then totals with p90, p95 and p99 and a line per request. It exits with 1 if any request failed. See Load testing.

Command What it does Exit code
cloakctl spec lint FILE.yaml Checks a spec and prints each problem with its severity, rule, message and location. 1 if any problem is an error
cloakctl spec import FILE.yaml Adds the spec to the workspace with a linked collection generated from it. 0
cloakctl spec sync FILE.yaml Updates the workspace spec with the same title from the file, then syncs its linked collection. Add --spec NAME when the names differ. 0
cloakctl spec sync SPEC_NAME Syncs a workspace spec’s linked collection without changing the spec. 0

Sync keeps your tests, scripts, auth and examples, and prints each added (+), updated (~) and removed (-) request. All three accept --workspace DIR except lint. See Specs.

Terminal
cloakctl docs "Shop API" --out shop-api-docs.html

Writes the collection’s documentation as one self-contained HTML file, with the active environment’s values. See Generate docs, SDKs and MCP servers.

Since 0.2.0
Terminal
cloakctl flow list
cloakctl flow run "Create and fetch a pet" --input petName=Rex --input limit=5 -e Staging

cloakctl flow list prints each flow in the workspace with its number of blocks. cloakctl flow run NAME runs one, by name or id, the same way the Run button does.

Flag Value What it does
--input KEY=VALUE Sets one of the flow’s inputs for this run, replacing the saved value. Repeat for several.
-e Environment name, or a Postman environment .json file The environment to use. Default: the workspace’s active environment.
--workspace Folder The workspace to use.

It prints each block on its own line, indented like the flow, with ✓ for a block that passed, ✗ for one that failed and · for the rest, followed by any output NAME = value lines and a last line such as Create and fetch a pet: passed in 412 ms. The command exits with 0 when the flow passed and 1 when it failed, so a CI job or a cron entry can act on it.

Since 0.2.0
Terminal
cloakctl monitor list
cloakctl monitor run "Petstore health"

cloakctl monitor list prints each monitor with its interval and whether its last run passed, failed or never ran. cloakctl monitor run NAME runs the monitor’s collection once, now, with the monitor’s environment and your globals, prints the same summary as collection run, and adds the run to the monitor’s history in the workspace, so it shows up in the app. It exits with 1 when a request or test failed. Both accept --workspace DIR.

Use it from cron or launchd to keep a monitor running while the app is closed.

Since 0.2.0
Terminal
cloakctl sdk "Petstore" --language python --out ./petstore-python-sdk

Writes a client SDK for the collection straight into the --out folder, creating it if needed and replacing files with the same names, and prints how many files it wrote. (The app instead creates a <collection>-<language>-sdk folder inside the folder you choose.) --language is typescript (the default), python or swift. --out is required. Add --workspace DIR for a different workspace. See Client SDKs.

Since 0.2.0
Terminal
cloakctl mcp-server "Petstore" --out ./petstore-mcp
cloakctl mcp-server "Petstore" --out petstore-mcp.zip

Writes a ready-to-run Node.js MCP server with one tool per request in the collection. When --out ends in .zip, it writes a zip with the project in a folder named after the collection, like the app does. Otherwise it writes the project’s files straight into the --out folder, creating it if needed and replacing files with the same names. It prints the number of tools; run npm install and then npm start in the project. Add --workspace DIR for a different workspace. See MCP servers.

Since 0.4.0

Start a browser or an Electron app with capture, or generate what gets a container, Flutter app or Android app’s traffic in. They ask the app when it’s running, and otherwise use the certificate on disk and the port (--port, default the app’s port or 9090).

Terminal
cloakctl browser [chrome|chromium|edge|brave|firefox] [--url URL] [--fresh] [--no-localhost] [--dry-run]
cloakctl browser --list
cloakctl electron APP [--relaunch] [--no-localhost] [--dry-run]
cloakctl electron --list
cloakctl capture-config docker-compose --project DIR [--service NAME]... [--write]
cloakctl capture-config docker-run [--service NAME]
cloakctl capture-config env-file [--service NAME]
cloakctl capture-config flutter [--project DIR] [--device ios_simulator|android_emulator|android_usb|device] [--write]
cloakctl capture-config android [--project DIR] [--trust bundled|user] [--domain D]... [--write]
cloakctl env [--shell zsh|bash|fish|powershell]

Without --write, capture-config prints what it would write. Add --json for the full result. cloakctl setup takes --project and --relaunch for the matching steps:

Terminal
cloakctl setup docker --apply compose-override --project .
cloakctl setup electron --app "Notes Studio" --apply launch-electron --relaunch

They exit with 1 on errors (an app that isn’t installed, a folder without a compose file).

Since 0.5.0

From 0.5.0, App Capture in the running app (macOS). Asking to capture an app or turn App Capture on only shows the request in Cloak Proxy; you click Allow there.

Terminal
cloakctl app-capture [status] [--json] # the extension's state and the picked apps
cloakctl app-capture capture APP # ask to add an app (a name, or the path of an .app or a tool) and turn it on
cloakctl app-capture add|enable APP # ask to add an app, or to capture one that's turned off
cloakctl app-capture on # ask to turn App Capture on
cloakctl app-capture remove|disable APP # stop capturing an app (disable keeps it in the list)
cloakctl app-capture off # turn App Capture off
cloakctl app-capture quic on|off # block captured apps' HTTP/3 so they use TCP (on by default)

All take --port PORT (default: the app’s port, else 9090). A relative path to a file is made absolute, so the app can read the tool’s signature. While a request waits, the command prints Waiting for you to click Allow in Cloak Proxy (App Capture). It exits with 1 on errors.

Command 0 1 Other
run No --fail-on-… check failed and the wrapped command (if any) succeeded A --fail-on-… check failed, or an option was wrong The wrapped command’s own exit code; 127 if it couldn’t start
collection run Every request and test passed A request or test failed
perf No request failed Any request failed
flow run The flow passed The flow failed
monitor run Every request and test passed A request or test failed
spec lint No errors (warnings are fine) At least one error
contract check No request broke the contract A usage error 2: a request had an error (or a warning, with --fail-on warning)
diff No difference matched --fail-on A usage error 2: a difference matched --fail-on
compare-envs No request matched --fail-on A usage error 2: a request matched --fail-on
tests make The collection was made (with --run: every test passed) A usage error, or with --run a failing test or request
authz The run finished with no leak (or without --fail-on) An error, such as an unreadable session 2: with --fail-on vulnerable, an identity got the original user’s data
trace check No request broke propagation A usage error 2: a request broke propagation (or carried none, with --fail-on untraced)
events The stream ended cleanly, or is still live The request isn’t a stream, or a usage error 2: the server broke the stream, or its last event was cut off
llm Under the budget, or no --max-cost A usage error, or (with an id) the request isn’t a model call 2: over --max-cost, or a model without a price
setup Every required step is done An error, or a step that needs the app when it isn’t running 2: required steps are still to do
docs-search Something matched Nothing matched
query The command worked With --fail-if-any, something matched; with --fail-if-none, nothing did 2: the query has a problem
rules The command worked The app isn’t running, or a folder or set doesn’t exist
scenarios The command worked The app isn’t running, or a scenario doesn’t exist
rules TOOL test Since 0.5.1 The rule matches It doesn’t match, or a usage error
fuzz Since 0.5.1 The run (or dry run) finished A usage error, or a target outside --scope 2: with --fail-on-match, a result matched a --grep term
ai-scan, mcp-pins check Since 0.5.1 Nothing at the --fail-on level; the tools match the pin file A usage error 2: a finding at that level or a leak; a server’s tools differ or are new
findings check Since 0.5.1 No open finding at or above --fail-on A usage error 2: an open finding at or above --fail-on (default high)
rules TOOL, cert, external-proxy, mcp on|off, toxiproxy The command worked The app isn’t running, a usage error, or a rule that doesn’t exist
Any command Any error, printed as error: … on standard error

The app starts some cloakctl commands itself. You don’t need them, but you may see them in Activity Monitor.

Command What it’s for
cloakctl proxy-guard --pid PID --port PORT Started while the macOS proxy points at Cloak Proxy. If the app disappears without quitting (Force Quit, crash), it restores your previous proxy settings so the Mac stays online. --dry-run only reports what it would do.
cloakctl dns-standby Started at login by a LaunchAgent while you capture apps that ignore the proxy. When the app isn’t running, it answers DNS lookups for captured domains normally.
cloakctl bypass-scan [--port N] Lists apps connecting straight to the internet instead of through the proxy on that port (default 9090), with their direct connections. The app’s Not using the proxy list uses the same scan.
cloakctl render-icon --out DIR Builds the app icon. Used when building the app.