deterministic-mcp-guardrails
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
deterministic-mcp-guardrails
Clean-room, zero-external-dependency Node.js ESM reference implementation of a deterministic, zero-LLM compliance and engineering MCP control plane.
Every policy gate, static scanner, cryptographic approval check, and receipt-chain verifier executes deterministically using only Node.js built-in modules (node:crypto, node:fs, node:path, Intl.DateTimeFormat). Ambiguous, malformed, expired, replayed, or unverified inputs always fail closed.
Architecture
stdio (JSON-RPC 2.0 NDJSON)
+------------------+ ----------------------------> +------------------------------+
| MCP Client / | | src/mcp/server.mjs |
| Coding Agent | <---------------------------- | 7 Deterministic MCP Tools |
+------------------+ structuredContent + JSON +--------------+---------------+
|
+----------------------+---------------------+-------------+--------------+
| | | |
v v v v
+-------------------+ +-------------------+ +-------------------+ +---------------------------+
| Quiet-Hours | | Static Guardrails | | PreToolUse Gate | | PostToolUse Ledger & |
| Engine | | Engine | | (HMAC-SHA256) | | Verdict Compiler |
| src/engine/ | | src/engine/ | | src/gate/ | | src/ledger/ |
| quiet-hours.mjs | | static-guardrails | | hmac-gate.mjs | | receipt-ledger.mjs |
+-------------------+ +-------------------+ +-------------------+ +---------------------------+
| - 08:00-21:00 TZ | | - SQL-001..003 | | - timingSafeEqual | | - SHA-256 JSONL chain |
| - Intl IANA DST | | - JS-001..003 | | - 6-tuple binding | | - tamper/gap detection |
| - Fail-closed on | | - HTML-001 | | - ReplayCache | | - compileVerdict rejects |
| ambiguous NANP | | - Zero LLM calls | | - Strict expiry | | on any failed check |
+-------------------+ +-------------------+ +-------------------+ +---------------------------+Related MCP server: proofgate-runtime
Components
src/engine/quiet-hours.mjs: Pure deterministic US FCC/TCPA quiet-hours engine (08:00-21:00recipient local time) usingIntl.DateTimeFormatIANA timezones, covering single-TZ states, Hawaii, Alaska, Puerto Rico, Arizona (no DST), DST spring-forward/fall-back boundaries, and fail-closed rejection of unknown or multi-TZ ambiguous NANP area codes.src/engine/static-guardrails.mjs: Zero-LLM SQL migration and JS/TS/HTML static safety rule engine enforcing 7 rules (SQL-001,SQL-002,SQL-003,JS-001,JS-002,JS-003,HTML-001).src/gate/hmac-gate.mjs: Constant-time (crypto.timingSafeEqual) HMAC-SHA256PreToolUsehuman-approval gate cryptographically binding(action, scope, artifactSha256, approverId, expiresAtIso, nonce)with single-useReplayCacheenforcement and strict expiration validation.src/ledger/receipt-ledger.mjs: Append-only hash-chained SHA-256 JSONL receipt ledger (appendReceipt,verifyChain,verifyChainFromText) and synchronousPostToolUsecompliance compiler (compileVerdict).src/mcp/server.mjs: Thin stdio JSON-RPC 2.0 MCP server exposing 7 tools:check_quiet_hoursscan_sql_migrationscan_js_sourcemint_approval_tokenverify_approval_gatecompile_verdictverify_receipt_chain
Quickstart
Requires Node.js >= 20 (zero runtime npm dependencies; no npm install needed).
# Run unit and live stdio MCP integration tests
npm test
# Run the standalone mutation proof matrix (0 false positives, 100% mutant kill rate)
npm run mutation-test
# Start the stdio JSON-RPC 2.0 MCP server
DMG_HMAC_SECRET="replace-with-32-byte-random-secret" npm startVerified Test Output
npm test
> deterministic-mcp-guardrails@1.0.0 test
> node --test tests/guardrails.test.mjs
✔ quiet-hours: allows calling during 08:00-20:59 local time and blocks outside (10.634ms)
✔ quiet-hours: handles Hawaii, Alaska, Puerto Rico, Arizona no-DST, and DST transitions (0.6468ms)
✔ quiet-hours: fails closed on ambiguous, unknown, malformed inputs, and naive timestamps (0.2607ms)
✔ static-guardrails: SQL-001, SQL-002, SQL-003 positive detection and clean negatives (1.1796ms)
✔ static-guardrails: JS-001, JS-002, JS-003, HTML-001 positive detection and clean negatives (0.7497ms)
✔ hmac-gate: mint, timing-safe verify, single-use replay rejection, tamper & expiry checks (2.6607ms)
✔ receipt-ledger: hash-chained JSONL append, verify, tamper detection, and fail-closed compileVerdict (6.0257ms)
✔ mcp-server: live stdio JSON-RPC 2.0 initialize, tools/list, and tools/call round-trip (54.2873ms)
ℹ tests 8
ℹ suites 0
ℹ pass 8
ℹ fail 0
ℹ cancelled 0
ℹ skipped 0
ℹ todo 0
ℹ duration_ms 135.9876npm run mutation-test
{
"baselineFixtures": 7,
"falsePositives": 0,
"totalMutants": 22,
"killedMutants": 22,
"escapedMutants": 0,
"killRatePercent": 100,
"passed": true
}Failure Modes
See FAILURE_MODES.md for the complete failure-mode matrix and fail-closed guarantees.
License
MIT License. Copyright (c) 2026 Mateo Cafferata.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
Pre-execution governance for AI agents. Deterministic PASS/FAIL/REVIEW verdicts, replayable proof.
Pre-action security checks for coding agents before they run, install, fetch or trust something: audit_code, check_package, check_prompt, check_command, check_domain, scan_site. Each returns a verdict an agent can branch on (pass/warn/review/block), is read-only and never stores what you submit. 50 calls per IP per day are free with no signup; after that each successful call costs 0.01 USDC over x402 on Base.
Authorize AI agent tool calls before they run: policy-as-code, human approval, signed receipts.
Supervised API-write gateway for AI agents with policy, human approval and execution receipts.
Related MCP Servers
- AlicenseAqualityCmaintenanceEnables agents to submit proposed actions against governed domain text and receive proceed, escalate, or block decisions, with persisted review-queue handling over stdio JSON-RPC.1MIT
- AlicenseBqualityBmaintenanceEnables MCP clients to verify claims against evidence, generate and validate tamper-evident receipts, and pre-filter prompt-injection attempts through stdio JSON-RPC tools.5825 PyPIApache 2.0
- AlicenseBqualityBmaintenanceExposes a native JSON-RPC 2.0 stdio MCP server that lets autonomous coding agents self-verify before finishing a turn, catching broken syntax, mutated public signatures, out-of-scope edits, banned imports, and deleted test assertions via deterministic static AST checks against a SHA-256 baseline. It enables zero-token spec validation, drift detection, checkpointing, and atomic rollback of broken agent mutations.51MIT
- AlicenseAqualityBmaintenanceA JSON-RPC 2.0 stdio server that enables users to estimate LLM costs, scan prompt injection, audit MCP configs, and summarize JSONL traces for guarding autonomous AI agent budgets and tool loops.5MIT