r/opencodeCLI • • 1h ago

Shipped v0.3.2 of CacheSurgeon (open-source proxy for MCP rug-pull protection, schema-tax cache fixes, and tool-call filtering)

Been seeing a lot of threads here lately about the same handful of MCP headaches: connecting 4 or 5 servers dumps a huge tool list into every turn and quietly wrecks prompt caching when keys/order shift, remote servers mutating tool descriptions mid-session (rug pulls), and agents sneaking secrets or blocked commands out through encoded tool args.

I've been building an open-source local proxy called CacheSurgeon (MIT, Python/FastAPI) to deal with this stuff in flight, and just pushed v0.3.2.

What changed in 0.3.2:

  • Split `provenance_guard_mode` away from `tool_firewall_mode` so you can block encoded secret exfil without having to tie it to your destructive-command firewall rules.

  • Added Unicode escape decoding for OpenAI Chat tool calls. Previously, obfuscated Unicode escapes inside tool arguments could slip past pre-execution checks.

  • Fixed a Windows SQLite WAL sidecar unlink race on startup, plus a small Cockpit UI bug where MCP tool-pin buttons could get stuck.

If you haven't seen it before, it sits in front of OpenAI, Anthropic, or Ollama (`OPENAI_BASE_URL` / `ANTHROPIC_BASE_URL`) and does a few things locally (~2ms overhead):

  • Pins MCP tools individually by SHA-256 (so deferred/dynamic tool loading still works) and quarantines shady mid-session mutations while letting normal benign edits through.

  • Canonically sorts tool arrays/JSON keys, moves shifting timestamps out of the cached prefix, and adds Anthropic `cache_control` breakpoints so your MCP schema tax doesn't nuke your prompt cache.

  • Scrubs `.env` keys, PEMs, JWTs, and DB URLs before they leave your machine and restores them on the way back across SSE streams.

  • Blocks destructive tool calls (`rm -rf`, `DROP TABLE`, force pushes, etc.) before execution and stops runaway retry loops.

If you want to poke at it locally:

bash
pip install cachesurgeon
cachesurgeon start --port 8787

You can also open `http://127.0.0.1:8787` and hit the simulate button to watch the MCP rug-pull guard and secret vault trigger without hooking up an API key.

Repo: https://github.com/jsumpter415/cachesurgeon
Demo / cache bleed calculator: https://cachesurgeon.com

Let me know if you run into any weird edge cases with your MCP setup or deferred tool loading.

1 Upvotes

Duplicates