The PromptGuard CLI finds the LLM SDK clients in your Python, JavaScript and TypeScript code, rewrites them to route through the PromptGuard proxy, and scans text for threats from your terminal or CI.
Installation
Release notes for each CLI version, and where to report a bug: Versioning & support.macOS / Linux (install script)
.sha256 file published beside
it, and installs it to /usr/local/bin.
Release binaries
Every release publishes prebuilt binaries, each with a.sha256 checksum, including Windows
x86_64. The CLI’s README
lists every one.
Build from source (Cargo)
For a platform with no prebuilt binary, such as Linux ARM64, build a release tag from the repository with a current stable Rust toolchain:cli-v<version> with the latest release’s tag, shown on the
releases page.
The crate is not published to the Rust package registry, so it installs from
the repository rather than by name.
Verify Installation
Quick Start
Find LLM SDK usage
scan parses the .py, .ts, .tsx, .js and .jsx files under the current directory (skipping dependency, build and test locations; see Troubleshooting) and prints, for each provider it finds, the files and the line and column of each SDK client, followed by a summary. It runs locally and needs no API key.
Route it through PromptGuard
init takes your API key from --api-key or PROMPTGUARD_API_KEY, or asks for it (and offers to open the signup page), validates it against the API, then:
- Detects which LLM SDKs the project uses
- Adds the PromptGuard proxy URL as the base URL of each SDK client it can rewrite
- Writes the API key to
.env(change with--env-file) - Creates
.promptguard.jsonand adds it and the env file to.gitignore
promptguard revert undoes them.
Commands
Runpromptguard <command> --help for every flag of a command.
Setup
Auth
Inspect
Monitor
Security testing
Other
Global options
promptguard scan
Without --text or --file, scan detects LLM SDK usage in the current directory. With either, it sends the content to the PromptGuard API for a threat scan. Add --offline to scan the content on your machine against a bundled regex rule pack instead: no network and no API key, but a subset of the API’s detection, with no ML classifiers and no project policy. Add --untrusted (with --offline) for content from outside your control, such as tool output or retrieved documents, to also run the indirect-injection rules.
Exit codes: 0 when the content is allowed or no SDK usage is found, 2 when the content is blocked or any SDK usage is found (protected or not), 1 on error.
promptguard redteam
Run adversarial security tests against your configuration.
Use the global
-v for detailed per-test results.
Examples:
promptguard policy
Manage guardrail configurations as YAML files (policy-as-code).
Examples:
promptguard mcp-proxy
Wrap an MCP server and check every tool call it receives. Put the proxy in
front of the server’s command wherever your client launches it; a refused call
is answered with JSON-RPC error -32600.
Examples:
mcpServers file (Claude Desktop, Cursor, Windsurf), the proxy is
the command and the server follows --:
Supported Providers
This table comes from the CLI’s own provider registry. Gemini and Bedrock are detected but not rewritten, because the CLI cannot rewrite their clients to point at the proxy (the Python Gemini client has no base URL parameter, and Bedrock goes through boto3 or the AWS SDK); route them through PromptGuard yourself or use the SDKs. Azure OpenAI was previously listed here; the CLI does not recognise the
AzureOpenAI class.Configuration
.promptguard.json
init writes .promptguard.json in the project root: the API key, proxy URL, providers, exclude patterns (from --exclude, or defaults that skip test files, node_modules, dist and virtualenvs), env file and the files PromptGuard manages. promptguard config shows it; change it by re-running init or editing the file.
Environment Variables
Telemetry
The CLI sends no telemetry. It makes network requests only when a command needs one: commands that use the PromptGuard API send your API key and aUser-Agent: promptguard-cli/<version> header to the API, and promptguard update calls the GitHub releases API when you run it. SDK detection (scan without --text/--file), scan --offline, status, config, apply, enable, disable and revert work locally.
CI/CD Integration
GitHub Actions
scan --offline fails the step (exit 2) when a block rule matches; verify fails it when any check fails.
GitLab CI
Troubleshooting
Command not found after installation
Command not found after installation
Solution: put the install location on your PATHOr re-run the install script, which prints where it installed the binary.
No LLM calls detected
No LLM calls detected
Check:
- Are you in the project root?
scanscans the current directory. - Is the code in an excluded location?
node_modules,.git,dist,build,__pycache__,__tests__,venv,.venv,.nextand.mypy_cacheare skipped, as are*.test.js,*.test.ts,*.spec.jsand*.spec.tsfiles. - Is the provider in Supported Providers?
False positives in comments/strings
False positives in comments/strings
The CLI parses code with tree-sitter, not regex. If you see false positives,
report them at github.com/promptguardhq/promptguard-cli/issues.
Something else is wrong
Something else is wrong
Run
promptguard doctor, then promptguard verify.MCP Server
The CLI includes a native MCP server for AI-powered editors:promptguard mcp-proxy.
Next Steps
Cursor
AI-native security in Cursor
MCP Server
Connect to any AI editor
GitHub Scanner
Scan repos on push and PR
VS Code Extension
See findings in your editor