Skip to content

Basic Example: Scan Tools, Explore via Browser

Scans ls, jq and curl, reviews the generated default-deny ACL, then starts an HTTP server with Explorer UI, ACL enforcement, and approval enabled.

Prerequisites

  • callpact installed (cargo install --path ../..)
  • ls, jq, and curl on your $PATH

Run

./run.sh

Set CALLPACT_EXAMPLE_PORT=18000 ./run.sh to choose another HTTP port. The default remains 8000; automated validation chooses a free temporary port.

What it does

  1. Scans ls, jq, and curl (extracts flags and generates JSON Schema)
  2. Writes binding files to ./output/modules/
  3. Prints the generated ~/.callpact/acl.yaml for review
  4. Prints Claude Desktop and Cursor configs with --acl and --enable-approval
  5. Starts the HTTP server with the same governance flags and Explorer UI at http://127.0.0.1:8000/explorer

The generated ACL allows local readonly tools and denies destructive, open-world, and unclassified modules by default. cli.ls is a useful safe call for this example, while cli.curl is expected to be denied until an operator reviews the policy and adds a narrowly scoped allow rule. Inspect the generated ACL for cli.jq rather than assuming a classification from its name.

When ls is scanned without a reviewed overlay, accepted flags can mark the module as approval-capable. --enable-approval lets the approval gate check the actual arguments. Neither listing below sends an escalating flag, so neither needs a prompt. Calls that do require approval are refused if the client cannot prompt for it. The ACL still denies cli.curl.

Using the Explorer UI

  1. Open http://127.0.0.1:8000/explorer in your browser

  2. Click cli.ls → type {} → click Call:

    {}
    
    You'll see your current directory listing immediately. This is the quickest way to verify CallPact works.

  3. Click cli.ls again to request a long listing and an operand. Use the schema property that declares the -l flag: l for BSD/GNU ls, or long for uutils ls (including Ubuntu 26.04). JSON property names are derived from each installation's declared flags, not portable CLI aliases.

BSD/GNU:

{"l": true, "file": ["/etc/hosts"]}

uutils:

{"long": true, "file": ["/etc/hosts"]}

Inspect the input schema in Explorer or run callpact list --verbose --format json with the example's --bindings-dir ./output/modules to confirm the property.

  1. Check that cli.curl is absent from the tool list. The generated ACL denies it because curl is an open-world tool. Review the matched rule with callpact acl explain cli.curl --caller @external --path ~/.callpact/acl.yaml.

  2. The response includes stdout, stderr, exit_code, trace_id, and duration_ms

Explorer prefills only required fields. It uses null when a required field has no declared default, so replace null with a value before executing the call. An untouched required string is rejected by schema validation rather than being sent to the CLI.

Claude Desktop integration

After testing with Explorer, switch to stdio for Claude Desktop:

callpact serve --show-config claude-desktop --bindings-dir ./output/modules \
  --acl ~/.callpact/acl.yaml --enable-approval

Copy the JSON into ~/Library/Application Support/Claude/claude_desktop_config.json, restart Claude Desktop.