Castrel Proxy is a lightweight local proxy client. It connects to Castrel over WebSocket, receives instructions from the server, executes them on your machine, and sends results back.
It provides five core capabilities:
Castrel Proxy pairs with the server, keeps a persistent connection, executes tasks locally, and returns results. If you configure MCP, it can also call local MCP tools when needed.
Recommended public entry:
curl -fsSL https://castrel.ai/castrel-proxy/install.sh | bash
This installer downloads the platform package from Castrel's public package storage, verifies .sha256, then installs castrel-proxy. For private mirrors, set CASTREL_PROXY_PACKAGE_BASE_URL before running the installer.
Default behavior installs to user-level ~/.local/bin (no sudo).
Use a custom install directory:
curl -fsSL https://castrel.ai/castrel-proxy/install.sh | bash -s -- --install-dir ~/bin
If you do not provide --install-dir in an interactive terminal, the installer asks you to input an installation directory. Leave it empty to use the default ~/.local/bin.
Installer options:
--install-dir <path> Install into a custom directory
Environment variables are also supported:
CASTREL_INSTALL_DIR=~/.local/bin
If your chosen directory is not in $PATH, the installer prints a command you can add to your shell rc file.
When you use --install-dir, the installer also checks PATH and gives clear guidance so the binary can be found in new shells.
curl -fsSL https://castrel.ai/castrel-proxy/install.sh | bash
pip install castrel-proxy
Requirement: Python >= 3.10
Get a verification code and server URL from your Castrel admin UI, then run:
castrel-proxy pair <verification_code> <server_url>
After pairing, Castrel Proxy will:
~/.castrel/config.yaml~/.castrel/whitelist.conf~/.castrel/mcp.json and sync MCP tool info once (skipped if not configured)# Background daemon mode (default, Unix/macOS only)
castrel-proxy start
# Foreground mode (all platforms)
castrel-proxy start --foreground
castrel-proxy status
castrel-proxy logs
castrel-proxy logs -f
castrel-proxy stop
castrel-proxy unpair
By default, Castrel Proxy uses ~/.castrel/:
~/.castrel/config.yamlserver_url: server URLverification_code: pairing codeclient_id: stable ID derived from hostname + MAC (16 hex chars)workspace_id: extracted from the verification codepaired_at: pairing timestamp~/.castrel/whitelist.confgit, kubectl)~/.castrel/mcp.json~/.castrel/castrel-proxy.pid~/.castrel/castrel-proxy.log~/.castrel/<session_id>/terminal.logcommand_line + policy checks)When the server sends a local_tool_call, Castrel Proxy executes a single command_line string locally and returns stdout, stderr, exit_code, and timing.
Security behavior (in order):
deny_all: all shell execution is blockedallowlist: every subcommand must pass the server allowlistpassthrough: local whitelist ~/.castrel/whitelist.conf is appliedCompound commands like ls && cat file | grep foo are parsed and validated command by command.
Castrel Proxy supports:
replace / append / prependConstraints:
read_enabled / write_enabled / edit_enabled)If you want to expose local MCP tools to the server, configure ~/.castrel/mcp.json and use:
castrel-proxy mcp-list
castrel-proxy mcp-sync
Supported transports (as implemented):
stdio (requires command + args, optional env)http (requires url)sse (requires url)Castrel Proxy can execute http_proxy_call from the server and return the upstream status/body to Castrel. This is used to access internal observability endpoints (for example intranet Prometheus) without exposing them publicly.
HTTP forwarding is controlled by workspace policy (http.enabled, optional http.allow_hosts).
Castrel Proxy supports local_interactive_call for start/write/read/stop style command sessions, which is useful for commands that require incremental interaction.
No. It makes an outbound WebSocket connection to the server and does not require inbound ports.
Add the base command name to ~/.castrel/whitelist.conf (one per line). For example, to allow kubectl get pods, add kubectl.
Common reasons:
Stop the proxy, uninstall, and remove all local configs and logs:
castrel-proxy stop
rm -f "$(command -v castrel-proxy)"
rm -rf ~/.castrel
castrel-proxy stop
pip uninstall castrel-proxy
rm -rf ~/.castrel