DEV Community

Cover image for Stop Burning Coding Agent Tokens Blindly: A Zero-Dependency Local Token Budgeter & MCP Server
Kestrel DevTools
Kestrel DevTools

Posted on

Stop Burning Coding Agent Tokens Blindly: A Zero-Dependency Local Token Budgeter & MCP Server

When working with Claude Code, Cursor, Windsurf, or custom MCP agents on medium-to-large repositories, two silent failure modes show up constantly:

  1. Context window bloat: A handful of generated lockfiles, fixtures, or bundled assets quietly eat 60–80% of your prompt budget.
  2. Accidental secret exposure: .env fragments or API tokens slip into packed context blocks before anyone notices.

To solve both locally with zero external runtime dependencies and zero telemetry, I built TokenGuard (tokenguard-mcp + VS Code / Cursor extension):

  • 1-command repo audit: npx tokenguard-mcp scan . ranks token hogs and estimates prompt cost across 10 frontier models.
  • Stdio MCP server (2025-12-11 schema): Gives coding agents native tools (scan_repo, estimate_cost, pack_context, check_secrets) directly over stdio.
  • VS Code / Cursor / Windsurf extension: Live status-bar token/USD counter, inline secret-leak diagnostics (redacted locally), and 1-click XML/Markdown context packing.

Links & Open-Source Repos (MIT)

(Side project note for CS/algorithms folks: we also just released a free 62-page sample PDF from our 2,315-page bilingual monograph Structure and Proof in Algorithms covering combinatorial search, matroids, parsing, and SSA compilers: https://augustfu-droid.github.io/structure-and-proof-in-algorithms-sample/)

Would love feedback from anyone running local MCP servers or context-budgeting workflows!

Top comments (0)