Skip to main content
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)

The script downloads the latest release’s binary for macOS (Apple Silicon or Intel) or Linux x86_64, checks it against the .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:
Replace 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:
  1. Detects which LLM SDKs the project uses
  2. Adds the PromptGuard proxy URL as the base URL of each SDK client it can rewrite
  3. Writes the API key to .env (change with --env-file)
  4. Creates .promptguard.json and adds it and the env file to .gitignore
It shows the planned changes and asks before applying them. promptguard revert undoes them.

Commands

Run promptguard <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:
In a client’s mcpServers file (Claude Desktop, Cursor, Windsurf), the proxy is the command and the server follows --:
The dashboard’s MCP Server page builds these for your own server’s command. What the local check matches, which API answers count as unreachable, how messages are relayed in each direction, and the proxy’s limits are documented with the CLI, in its README’s MCP Proxy section.

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 a User-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

Solution: put the install location on your PATH
Or re-run the install script, which prints where it installed the binary.
Check:
  • Are you in the project root? scan scans the current directory.
  • Is the code in an excluded location? node_modules, .git, dist, build, __pycache__, __tests__, venv, .venv, .next and .mypy_cache are skipped, as are *.test.js, *.test.ts, *.spec.js and *.spec.ts files.
  • Is the provider in Supported Providers?
The CLI parses code with tree-sitter, not regex. If you see false positives, report them at github.com/promptguardhq/promptguard-cli/issues.
Run promptguard doctor, then promptguard verify.

MCP Server

The CLI includes a native MCP server for AI-powered editors:
This lets Cursor, Claude Code, Windsurf, and other MCP-compatible editors call PromptGuard tools directly. See the MCP docs or Cursor page for setup instructions. To check the tool calls an agent makes to other MCP servers, wrap them with 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
Last modified on November 16, 2026