The native control layer for the Phantom Engine — engineered for precision orchestration and human-like web interaction.
ph is a high-performance command-line utility designed to manage the Phantom Engine lifecycle. It provides an ergonomic interface for session orchestration, real-time diagnostics, and simulating complex user behaviors across the engine's tiered execution environments.
Phantom CLI serves as the primary gateway for developers and agents to interact with the engine. It handles:
- Server Orchestration: Background process management for the MCP server.
- Interactive Configuration: Streamlined environment bootstrapping.
- Behavioral Simulation: Triggering human-like events (clicks, typing, navigation) with high-fidelity anti-detection.
- Real-time Observability: Live streaming of DOM mutation events and server logs.
ph communicates with the Phantom MCP Server using JSON-RPC 2.0 over HTTP. This decoupled architecture allows the CLI to manage local or remote engine instances seamlessly. It leverages tokio for asynchronous I/O and hyper for robust network transport.
- Rust Toolchain: 1.75.0 or newer.
- Phantom Engine: The server components must be built (
cargo build --workspace).
Build and install the binary directly from the source:
# From the repository root
cargo install --path phantom-cliBootstrap your local environment with a single command. The CLI will guide you through the configuration process:
ph setup initTip
The setup command generates unique API keys and secure encryption keys for session snapshots automatically.
Control the background engine process without leaving your terminal.
# Start the engine in detached mode
ph up --background
# Monitor live server logs
ph logs --follow
# Gracefully terminate the engine
ph downSimulate realistic user behavior to bypass sophisticated bot detection.
# Navigate to a URL with protocol normalization
ph navigate google.com
# Simulate a human-like click with randomized coordinates
ph click ".login-button"
# Type text with realistic per-character delays
ph type "#search" "phantom engine" --delay 45Inspect the internal state of the engine in real-time.
# Enter an interactive REPL shell
ph interactive
# Stream live DOM deltas via SSE
ph watch
# Inspect text nodes within the current scene graph
ph inspect "Checkout"| Command | Description |
|---|---|
ping |
Verify connection to the MCP server. |
status |
Show health, session metrics, and circuit breaker status. |
up |
Launch the Phantom Engine server. |
down |
Stop the background server process. |
logs |
View and follow engine process logs. |
tab |
Manage browser tabs (new, list, switch, close). |
cookies |
Manage the persistent cookie store. |
session |
Orchestrate snapshots and session clones. |
setup |
Bootstrap and verify the local environment. |
interactive |
Launch the Phantom interactive shell. |
ph loads settings from .env by default. These can be overridden via global flags:
| Env Variable | CLI Flag | Description |
|---|---|---|
PHANTOM_BIND_ADDR |
--server |
MCP server address (Default: 127.0.0.1:8080) |
PHANTOM_API_KEY |
--key |
Engine authentication key. |
phantom-cli/
├── src/
│ ├── commands/ # Subcommand implementations
│ ├── client.rs # JSON-RPC transport layer
│ ├── errors.rs # Unified CLI error types
│ └── main.rs # CLI entry point and argument parsing
└── README.md # This file
This project is licensed under the Apache-2.0 License. See LICENSE.md for details.