SDK Reference
CLI Usage
Use the CUP command-line tool to capture UI trees and debug accessibility.
Basic usage
python -m cupnpx cupCaptures the foreground window and prints the compact tree to stdout.
Options
| Flag | Description | Example |
|---|---|---|
--scope | Capture scope | --scope full |
--app | Filter by app name | --app Discord |
--depth | Max tree depth (0 = unlimited) | --depth 3 |
--json-out | Save pruned CUP JSON to file | --json-out tree.json |
--full-json-out | Save full (unpruned) CUP JSON to file | --full-json-out full.json |
--compact-out | Save compact text to file | --compact-out tree.txt |
--platform | Force platform adapter | --platform web |
--cdp-port | Chrome DevTools port | --cdp-port 9222 |
--cdp-host | Chrome DevTools host | --cdp-host localhost |
--verbose | Show diagnostics | --verbose |
Examples
# Capture all windows
python -m cup --scope full
# Filter by app name
npx cup --app "VS Code"
# Save JSON output
python -m cup --json-out tree.json
# Capture Chrome via CDP
python -m cup --platform web --cdp-port 9222
# Run diagnostics
npx cup --verboseMCP server
To run CUP as an MCP server, see MCP Setup.