Deterministic Security, Cost Circuit-Breakers & Privacy Guardrails for Production AI Agents
Autonomous AI agents and Model Context Protocol (MCP) servers introduce non-deterministic operational risks: runaway API spend, sensitive data exfiltration across streaming chunks, and unauthorized tool execution.
I design zero-dependency, sub-millisecond TypeScript primitives that sit between LLMs and critical infrastructure—giving engineering teams deterministic safety guarantees without supply-chain bloat or vendor lock-in.
flowchart LR
A[User / Prompt] --> B[redact-stream]
B -->|Sanitized Stream| C[LLM / AI Agent]
C -->|Tool Call Request| D[token-fuse]
D -->|Within USD Budget| E[mcp-warden]
E -->|Policy Verified + Audited| F[(MCP Tools & Infra)]
style B fill:#0f172a,stroke:#38bdf8,stroke-width:1.5px,color:#f8fafc
style D fill:#0f172a,stroke:#f59e0b,stroke-width:1.5px,color:#f8fafc
style E fill:#0f172a,stroke:#10b981,stroke-width:1.5px,color:#f8fafc
| Package | Focus | Key Guarantee |
|---|---|---|
mcp-warden |
MCP Firewall & Audit | JSON-RPC tool-call policy enforcement, path-traversal blocking & SHA-256 audit logs. |
token-fuse |
FinOps Circuit-Breaker | Real-time USD spend caps & semantic infinite-loop termination in < 1ms. |
redact-stream |
Streaming PII Scrubber | Chunk-boundary aware API key, JWT & PII redaction with reversible local tokens. |
- Zero External Runtime Dependencies:
0third-partynpmpackages in production builds—eliminating transitive CVE risks. - Universal Edge Compatibility: Pure Web Standard APIs (
ReadableStream,TransformStream,crypto.subtle) running identically across Node.js, Bun, Deno, and Serverless Edge runtimes. - Deterministic Latency: Engineered for inline request pipelines with strict memory bounds and zero regex catastrophic backtracking.
All libraries in this ecosystem are MIT-licensed, vendor-neutral, and maintained independently. If these guardrails protect your production API budgets, customer privacy, or MCP toolchains, consider backing ongoing development and security maintenance.