Repository navigation
Expand file tree
/
Copy pathrun.sh
More file actions
executable file
·70 lines (63 loc) · 2.8 KB
/
Copy pathrun.sh
File metadata and controls
executable file
·70 lines (63 loc) · 2.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#!/usr/bin/env bash
# apexe basic example: scan tools, inspect results, start MCP server.
set -euo pipefail
OUTPUT_DIR="./output"
BINDINGS_DIR="$OUTPUT_DIR/modules"
ACL_PATH="${HOME}/.apexe/acl.yaml"
PORT="${APEXE_EXAMPLE_PORT:-8000}"
echo "=== Step 1: Scan tools ==="
echo " ls — options and operands; schema depends on your implementation"
echo " jq — boolean flags, parsed from GNU-format help"
echo " curl — the widest surface here; flag count depends on your build"
echo
# `--write-acl` is the compatibility spelling: a scan produces the inventory,
# `acl init` writes the policy once, and this applies the scan to it in one step.
# Without it the ACL below would not exist — `scan` no longer writes policy.
apexe scan ls jq curl --no-cache --output-dir "$BINDINGS_DIR" --format table \
--write-acl
echo
echo "=== Step 2: List generated modules ==="
apexe list --bindings-dir "$BINDINGS_DIR"
echo
echo "=== Step 3: Inspect binding file (check the schema properties) ==="
FIRST_BINDING=$(ls "$BINDINGS_DIR"/*.binding.yaml 2>/dev/null | head -1)
if [ -n "$FIRST_BINDING" ]; then
echo "Binding file: $FIRST_BINDING"
head -50 "$FIRST_BINDING"
echo "..."
fi
echo
echo "=== Step 4: Review the generated ACL ==="
echo "ACL path: $ACL_PATH"
if [ -f "$ACL_PATH" ]; then
sed -n '1,160p' "$ACL_PATH"
else
echo "ACL was not found. Run 'apexe acl init' to write a starter policy."
fi
echo
echo "=== Step 5: Integration configs with ACL enforcement ==="
echo "--- Claude Desktop ---"
apexe serve --show-config claude-desktop --bindings-dir "$BINDINGS_DIR" --acl "$ACL_PATH"
echo
echo "--- Cursor ---"
apexe serve --show-config cursor --bindings-dir "$BINDINGS_DIR" --acl "$ACL_PATH"
echo
echo "=== Step 6: Start HTTP server with Explorer UI and ACL enforcement ==="
echo "Open http://127.0.0.1:${PORT}/explorer in your browser."
echo "Click 'cli.curl' → fill in JSON input → click Call."
echo ""
echo "Explorer shows only required fields. Replace null with a real value before"
echo "calling a required string input such as curl's URL."
echo ""
echo "Try in Explorer:"
echo ' cli.ls → {} → listing of the current directory'
echo ' cli.ls → {"l": true, "file": ["/etc/hosts"]} → BSD/GNU long listing'
echo ' → {"long": true, "file": ["/etc/hosts"]} → uutils long listing'
echo ' Use the schema property declaring -l; the JSON key varies by implementation.'
echo ' cli.curl → {"url": "https://httpbin.org/get", "silent": true}'
echo ' → denied by the generated ACL because curl is open-world'
echo "Review $ACL_PATH before adding a narrow allow rule for a real use case."
echo ""
echo "Press Ctrl+C to stop."
echo
apexe serve --transport http --port "$PORT" --explorer --bindings-dir "$BINDINGS_DIR" --acl "$ACL_PATH"