Polar CLI
$ polar Official High RiskPolar CLI (polar / @polar-sh/cli) manages Polar developer billing—products, checkouts, customers, meters, and local webhook forwarding—from the terminal. Supports --fields dot-notation filtering, -d/--data JSON payloads, --org scoping, and POLAR_ACCESS_TOKEN for headless automation.
npm install -g @polar-sh/cli polar combines structured resource commands, --fields projection to save context tokens, and local webhook tunneling (polar listen) that remote MCP servers cannot provide.
Agent-Readiness Checklist
Static evaluation (not yet probed on this host). Run npm run data:probe locally to capture live verification.
FCRS-1.0 6-Dimension Breakdown
Supports structured JSON output, dot-notation --fields projection, -d/--data payloads, and POLAR_ACCESS_TOKEN headless auth.
--fieldsfilters nested fields cleanly for low-token consumption-d/--dataaccepts inline JSON payloads non-interactively
Stores tokens in OS keyring, supports POLAR_ENVIRONMENT=sandbox, and scopes requests via --org, though billing writes affect live checkouts.
- OS keyring storage plus
POLAR_ENVIRONMENT=sandboxisolation
Available via @polar-sh/cli on npm/npx, official install script, and GitHub release binaries.
- Installable via
npm install -g @polar-sh/cliandpolar.sh/install.sh
Covers products, checkouts, meters, orders, and local webhook testing in one CLI.
- Unified API management and local webhook dev workflow
Official Polar repository (polarsource/cli) under Apache-2.0 license.
- First-party Polar open-source repository
Clear documentation at polar.sh/docs/cli with explicit --fields and environment examples.
- Official Polar CLI reference docs
Security, Auth & Guardrails
Stores interactive polar auth login tokens in the OS native keyring (macOS Keychain, Linux Secret Service, Windows Credential Manager), or reads POLAR_ACCESS_TOKEN and POLAR_ENVIRONMENT env vars.
Apache-2.0 open-source CLI; Polar Sandbox is free, while live sales incur Polar merchant-of-record fees.
# Polar CLI (polar) Agent Rules - Set `POLAR_ENVIRONMENT=sandbox` and `POLAR_ACCESS_TOKEN` before running write tests. - Always pass `--fields` on list/get calls to avoid dumping large billing payloads into context. - Never create or modify live production products, checkouts, or refunds without explicit approval.
Agent-Ready Command Recipes
Safe Read-Only Queries
polar products list --fields id,name,is_recurring
Fetches products in the active organization while projecting only essential fields to minimize token usage.
polar orders get <order_id> --fields id,amount,currency,customer.email
Reads specific order and customer fields using --fields dot notation.
Controlled Writes & Previews
POLAR_ENVIRONMENT=sandbox polar products create -d '{"name":"Pro Plan"}' Creates a test product in Sandbox mode using -d JSON payload.
Strengths for Agents
- + Dot-notation
--fieldsfiltering keeps billing responses compact for agent context windows. - + OS keyring storage paired with
POLAR_ACCESS_TOKENandPOLAR_ENVIRONMENT=sandboxworks cleanly locally and in CI.
Caveats & Pitfalls
- ! No
--dry-runflag oncreateorupdatemutations. - ! Requires explicit
POLAR_ENVIRONMENT=sandboxto prevent accidental production changes when testing.