Skip to main content

Context Audit CLI

Feature row 58 — Sprint CA-OSS (Partial)

Phase 1 ships today: the CLI, JSON output, and a handful of common MCP client configs. Phase 2 (README polish, CI), Phase 3 (PyPI), and Phase 4 (PDF output, web UI) are in progress.

What this is

behavry-ca (Context Audit) is a standalone CLI that answers a question every agent user eventually asks: how many tokens are my MCP integrations costing me before I've even typed a prompt?

The tool parses the config files of the common MCP clients — Claude Code, Claude Desktop, Cursor, VSCode MCP extensions — identifies every registered server, calls each server's tools/list, counts the tokens in the raw response, and prints a breakdown by server and by tool.

You don't need Behavry's backend to use it. You don't need a tenant. It's a single binary (or pip install behavry-ca) and a few seconds of runtime.

Why it matters

Typical findings after running behavry-ca on a real developer setup:

  • A single MCP server registering dozens of rarely-used tools, eating 15k+ tokens of context before any work starts
  • Descriptions carrying multi-paragraph usage examples that dominate the token count
  • Multiple servers duplicating similar tools (two different "filesystem" servers both exposing read_file)

The output is the same data Context Window Governance uses in the commercial product — only without the enforcement / policy layer.

Usage

behavry-ca scan

By default, scan auto-detects configs in:

  • ~/.claude.json
  • ~/Library/Application Support/Claude/claude_desktop_config.json (macOS)
  • ~/.cursor/mcp.json
  • ~/.vscode/mcp.json

Point it at a specific file with --config:

behavry-ca scan --config /path/to/claude_desktop_config.json

Output:

Server                 Tools   Tokens  Per-tool avg
filesystem 12 3,412 284
github 48 14,882 310
slack 21 8,199 390
brave-search 3 612 204
---------------------------------------------------
TOTAL 84 27,105

Add --json for structured output, --format table|csv|md for alternatives.

Recommendations

behavry-ca recommend runs a scan, then applies a set of rules of thumb and suggests:

  • Candidates for removal — servers with no tools that have been called in the last N days (requires audit log access)
  • Candidates for trimming — tools whose descriptions are the top 10% by token count
  • Duplicates — tools with similar names and signatures across different servers

Rules live in recommendations.yaml and are customizable.

JSON output

The JSON shape matches the commercial product's Context Gate metrics, so teams that start with the OSS CLI can hand the output directly to a Behavry Professional / Enterprise trial for ongoing enforcement.

Source and downloads

  • Repo: github.com/behavry/behavry-ca
  • Install:
    • pip install behavry-ca (when Phase 3 ships)
    • brew install behavry/tap/behavry-ca (planned)
    • Signed binary releases: macOS arm64 / x86_64, Linux arm64 / x86_64
  • License: Apache 2.0