Skip to main content
Glama

ContextGuard (contextguard-mcp)

Stop burning $50–$200/month on AI-coding context-compaction loops in Claude Code, Cursor, Codex, and Windsurf.

License: MIT Node.js >= 20 Live Web Workbench

When an AI coding session loads an oversized CLAUDE.md, AGENTS.md, .cursorrules, historical plan doc, or unignored lockfile on boot — or re-reads the same files after compaction — 40%–80% of the context window is already consumed before tool call #1. Within 10–15 minutes of tool calls, compaction fires again, breaking prompt-cache continuity and multiplying input token costs by 5x–7x.

ContextGuard is a zero-dependency Node.js CLI, Model Context Protocol (MCP) server, and Chrome Manifest V3 Side Panel extension that audits token traps, compiles a deterministic <5 KB START.md boot card, and compresses web docs/GitHub PRs into strict token budgets.


Quick Start (Zero Install — 0 npm Dependencies)

# 1. Audit startup token burn, lockfile leaks & compaction risk in any repo
npx --yes github:oneandroid-max/contextguard-mcp audit .

# 2. Enforce a CI pull-request startup token ceiling (e.g. <= 6,000 tokens)
npx --yes github:oneandroid-max/contextguard-mcp audit . --max-boot-tokens 6000

# 3. Compile a <5 KB START.md boot card from oversized CLAUDE.md / AGENTS.md files
npx --yes github:oneandroid-max/contextguard-mcp slim . --write

# 4. Compress an HTML doc, PR diff, or log file to a 3,000-token Markdown budget
npx --yes github:oneandroid-max/contextguard-mcp clip ./pr-page.html --budget 3000

Related MCP server: context-guard

Add as a Local MCP Server (Claude Code, Cursor, Windsurf)

Claude Code CLI (1 command)

claude mcp add contextguard -- npx -y github:oneandroid-max/contextguard-mcp --mcp

.mcp.json / .cursor/mcp.json

{
  "mcpServers": {
    "contextguard": {
      "command": "npx",
      "args": ["-y", "github:oneandroid-max/contextguard-mcp", "--mcp"]
    }
  }
}

Exposed MCP Tools

Tool

What It Does

contextguard_audit_workspace

Audits CLAUDE.md, AGENTS.md, .cursorrules, docs/plans/*.md, and lockfiles for token burn & compaction spirals.

contextguard_slim_boot_card

Generates a <5 KB START.md boot card and .claudeignore cutting startup reads by 60%–85%.

contextguard_compress_web_doc

Strips scripts, styles, SVGs, nav boilerplate, and duplicate stack traces into a budgeted Markdown prompt.

bidradar_search_public_bids

Searches live written/async public-sector RFPs, sub-threshold P-Card quotes, and ADA Title II PDF/web opportunities via BidRadar.


Browser Workbench, Chrome MV3 Side Panel & Pro Suite

Set SECOND_FOREMAN_PRO_KEY="SC1...." in your shell or .mcp.json env block to unlock unlimited multi-file JSONL transcript forensics, Pro .mcp.json/CI workflow generation, and unredacted BidRadar direct buyer emails ($29/mo or $149/yr instant Stripe checkout at secondforeman.com/contextguard/#pricing).


Privacy & Publisher Disclosure

  • 100% Local Processing: contextguard audits files and compresses HTML locally on your machine with zero telemetry and zero code/prompt uploads.

  • Publisher: Second Foreman LLC · 801 NW 10th Street #470, Oklahoma City, OK 73106-6931 · hello@secondforeman.com · Veteran-Owned Small Business.

  • Built and operated by an AI agent (Google Gemini) with Paul Edward Lewis Jr. human sign-off, guaranteed by Second Foreman LLC.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      B
      maintenance
      Enables local LLM tools and agentic IDEs to inspect repository token maps, retrieve clean token-bounded codebase snapshots, and audit code for hardcoded secrets via MCP over stdio.
      4
      MIT
    • A
      license
      Not graded
      quality
      C
      maintenance
      Enables autonomous coding agents to check memory, CPU, and disk headroom before heavy work, emitting cgroup-aware NEAR_OOM_THRESHOLD alerts that let them back off before an OOM kill or context blowup. It also scans a workspace for token-heavy, low-value paths such as dependency trees, build output, logs, and bundles, returning ranked findings and ready-to-paste exclude_globs to keep them out of the agent's context.
      MIT
    • A
      license
      B
      quality
      B
      maintenance
      Enables coding agents to pull repository context under a hard token cap by dropping noise files, cleaning whitespace and repeated lines, and truncating with fair-share budgets while reporting raw-versus-packed savings. Exposes context packing, per-file keep/drop inspection, and cumulative savings summaries as MCP tools over stdio.
      3
      MIT
    • A
      license
      B
      quality
      B
      maintenance
      Local CLI and MCP server that packs a repository into budgeted Markdown parts, writes a manifest of every included and skipped file with the reason, masks secrets in place, and exits non-zero when the snapshot drifts. For Claude, ChatGPT, Cursor and CI.
      26
      3,755 npm
      2
      MIT