gama-fastpath
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@gama-fastpath check if rm -rf / is blocked before running it"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
gama-fastpath
Deterministic pre-LLM gate: blocks catastrophic/destructive or env-disclosure requests and answers money math without any model call. Offline, stdlib only.
Structural gate (
dsc.gate, pinned as adscdependency): shell requests are split into statements and pipelines, tokenised withshlex, wrappers (sudo,env,xargs,timeout, ...) are unwrapped, andsh -cpayloads plus$(...)/backtick substitutions are analysed recursively. Flags may be reordered, quoted or abbreviated; it is the parsed argv that decides, not a phrase list. This repo no longer carries its owngate.py.recursive delete/overwrite of
/,/etc, home (~,$HOME) — includingrm -fr /,rm --recursive --force /,sudo rm -rf --no-preserve-root /find ... -delete/find ... -exec rmSQL
drop/truncate, anddelete/updatewithoutWHEREreads of
/etc/shadow,/etc/passwd,id_rsa,.env, cloud credentialscurl|wget ... | sh|bash|python,sh -c "$(curl ...)",eval $(curl ...)mass outbound mail (
pošalji mejl svim kupcima,send email to all customers)fork bombs,
mkfs/dd of=/dev/sd*, recursivechmod/chownon/
Each denial returns
route:"block",blocked:true, a stablecodeand a humanreason(e.g.destructive_root_delete,sql_delete_without_where,sensitive_file_read,remote_code_exec,bulk_mail).T1/T2regexes (dsc.gate) remain only as a cheap pre-filter for natural-language policy phrases (prompt injection), not as the gate.Math:
PDV 17% na neto 2400-> 2808.00;17% od 1450-> 246,50 (Decimal, half-up).Diacritics fold:
Obriši->obrisi(risk match works on Bosnian text).SQLite response cache (TTL 6 h) keyed by a SHA-256 of the full normalized request + tenant/session,
/stats. Freshness (clock, stock, price) and multi-step text are never read from or written to it — the rules aredsc.cachepolicy, shared withgama-offline.
Run
pip install -r requirements.txt # dsc, pinned by commit (gate + amount + cache policy)
python3 fastpath.py # :8071
curl -s localhost:8071/optimize -d '{"text":"Obriši sve fajlove u /var/log"}'
# {"route":"block","blocked":true,"code":"catastrophic_command","reason":"...",...}
curl -s localhost:8071/optimize -d '{"text":"rm -fr /"}'
# {"route":"block","blocked":true,"code":"destructive_root_delete",...}
curl -s localhost:8071/optimize -d '{"text":"PDV 17% na neto 2400"}'
# {"route":"math_pdv","answer":"2808.00",...}Tests: python3 -m unittest discover -s tests -v
Related MCP server: tripwire-guard
MCP server (stdio, no SDK)
The package ships fastpath_mcp.py: JSON-RPC 2.0 over stdio, protocol
2025-06-18, stdlib only.
pip install gama-fastpath # provides gama-fastpath-mcp
pip install "dsc @ git+https://github.com/gamai-io/dsc@7c433d59c848d2853abda639753bcec7042890cf" # pinned gate
gama-fastpath-mcp # MCP server on stdin/stdoutPyPI forbids direct-URL requirements, so dsc (pinned by commit in
requirements.txt) is a separate install; without it the handshake still
works and fastpath_route returns the exact install command.
{"mcpServers": {"gama-fastpath": {"command": "gama-fastpath-mcp", "args": []}}}Three tools, each returning JSON:
tool | input | returns |
|
|
|
|
| the allowlist: every route, its meaning, all stable denial codes, cache policy |
|
| version, port/bind, cache DB + entry count, TTL, counters, |
tools/call → fastpath_route {"command": "rm -fr /"}:
{"ok":true,"route":"block","blocked":true,"code":"destructive_root_delete",
"reason":"rekurzivno brisanje korijena ili kucnog direktorija: /",
"ms":0.16,"decision":"deny",
"explain":"gate denied (destructive_root_delete): no model call, request never executed"}tools/call → fastpath_route {"request": "17% od 1450"}:
{"ok":true,"route":"math","answer":"17% od 1450 = 246,50","ms":0.4,
"decision":"answer","explain":"deterministic arithmetic, Decimal half-up; model never called"}CLI and exit codes
python3 fastpath.py --check 'rm -fr /' # prints JSON, exit 3
python3 fastpath.py --check 'zdravo' # prints JSON, exit 0exit | meaning |
| request allowed/answered (may still route to |
| denied by the gate ( |
| usage error (missing |
Measured
T1 block 0.03 ms, T2 block 0.06–0.94 ms, PDV 6.2 ms cold first call (math is recomputed on every request, never served from the cache).
LUMI MI250X guarded bench: false_success 19.7% raw -> 0/1,000; 10k rerun (2026-11-04) 1/10,000 (FAIL) — earlier 0/10,000 not reproduced; 114.4 rps @ CONC=512 (prior run).
Related: https://github.com/gamai-io/crossnode-bench (DOI 10.5281/zenodo.23933835).
Apache-2.0.
Tests
make testCache safety
The key is
dsc.cachekey.request_key—v2:+ SHA-256 over the canonical JSON object{"v","t","tenant","session","ctx"}, wheretis the full normalized request andsessionis the optional tenant (sidortenantin the body, orX-Tenant-ID). Fields are JSON values, not|-joined substrings, so a delimiter in the text cannot collide with another tenant. Two different inputs or tenants never share an entry, and caller text is not stored in the key. Pre-v2 rows are unreachable (oldq:keys): they miss once and age out by TTL.cache_getalso refuses any non-v2 key.Deterministic math is computed before the cache lookup and is never read from it, so a stored answer cannot override
PDV ...arithmetic (regression: storing0.00for a PDV query still returns2808.00).dsc.cachepolicy.block_reasonowns "may this be replayed?".cache_putand/storerefuse fresh text (clock, stock, price), multi-step chains and answers shorter than 15 chars;/storeanswers{"ok": true, "stored": false, "reason": "fresh"}instead of silently writing.optimizeskips the cache read for the same texts, so a row written before this rule existed is ignored rather than served.
Security / deployment
Default bind is
GAMA_FASTPATH_BIND=0.0.0.0for LAN/Tailscale callers. On a public host, block the port at the firewall (verified on one of our hosts: ufw default-DROP, the port unreachable from an external node while 80/443 answer).POST /storeis loopback-only. Remote callers must setGAMA_FASTPATH_STORE_TOKENand send it asX-Store-Token; without it the endpoint answers403.Request bodies are capped by
GAMA_FASTPATH_MAX_BODY(default 262144 bytes) and oversized requests get413, so one client cannot exhaust memory.The HTTP handler never echoes parser exceptions back to the caller.
Money formats
dsc.amount.parse_amount (imported here, not copied) accepts BHS/EU/US thousands separators
deterministically (Decimal, half-up): 2400, 2.400, 2.400,00, 1.234.567,89, 2,400.00
all resolve correctly. Regression tests cover these forms; the earlier regex stopped at the
first separator and returned 2.81 for 2.400,00.
How this is sold (and what it saves)
The gate is free to adopt: it is a deterministic pre-LLM step, and metering it would cost more than it earns. What it returns, measured on our traffic (2026-11-23):
PDV 17% na neto 2400→ 2808.00 in 6.2 ms, 0 tokens, versus 2.53 s and ~$0.0019 through a model.rm -rf /,drop table,obrisi sve→ blocked in 0.03–0.06 ms before any model runs.Every answer that never reaches the model is a call the customer does not pay for.
We charge for the harness and the audit around the gate (evidence receipts, replay), not for the arithmetic. A buyer is shown their own intercepted-request count, not a percentage we computed on our own workload.
Available Tools
3 toolsfastpath_healthA
Health of the local fastpath: version, port/bind, cache DB path and entry count, TTL, in-process counters and whether the HTTP listener answers.
Inputs: no named parameters.
fastpath_routeA
Route one request/command through the deterministic 0-LLM gate: returns route block|math|math_pdv|cache|time|llm, the decision (deny|answer|pass), the denial code and reason when blocked, and the computed answer when the gate can answer without a model. Under 10 ms, no token spent.
Inputs: sid, command, request.
fastpath_rulesA
List the routing allowlist: each route, whether it answers or passes to an LLM, the stable denial codes the gate can return, and the cache policy.
Inputs: no named parameters.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 3 tools
Each tool occupies a clearly distinct niche: route executes a routing decision, rules introspects the allowlist/denial-code configuration, and health reports diagnostics. There is no plausible way to mistake one for another, and the descriptions reinforce the separation explicitly.
All three tools use the identical fastpath_<noun> pattern with matching casing and prefix, giving a highly predictable namespace. The convention is noun-oriented rather than verb_noun, but it is applied uniformly across the entire set.
Three tools is lean but justified for a narrow deterministic gate whose core action is a single routing call. It sits just below the ideal range, though nothing feels padded or redundant.
The surface covers the runtime path (route), configuration introspection (rules), and diagnostics (health), which is a coherent lifecycle view. However, there is no way to mutate the allowlist, invalidate or inspect individual cache entries beyond a count, or batch-route requests, leaving agents unable to change gate behavior.
Maintenance
Related MCP Connectors
Decision-only prompt routing and firewall checks for local/cloud routing, PII and jailbreak risk.
Deterministic prompt-injection detector; signed, offline-verifiable verdicts. Not an LLM.
OpenAI-compatible BYOK LLM gateway: per-task routing, shadow evaluation, promotion gates.
Real-time MCP & A2A prompt-injection, jailbreak, and tool-schema poisoning firewall for AI agents.
Related MCP Servers
- AlicenseAqualityDmaintenanceSecurity, cost, and health governance proxy for MCP infrastructure. Enforces YAML-configurable security policies (blocklists, rate limits, token budgets), tracks real token costs via tiktoken, monitors server health with live JSON-RPC probes. Features OAuth 2.1/OIDC with RBAC, web dashboard, payload normalization, semantic shell AST analysis, mTLS, and a formal STRIDE threat model.4604 npm4MIT
- AlicenseNot gradedqualityCmaintenanceProvides a local, read-only MCP server that scans untrusted text for prompt-injection and returns an allow/review/block decision with evidence. It runs entirely on-device with no network requests and redacts sensitive strings by default.43 npmMIT
- AlicenseAqualityBmaintenanceOffline server that explains any shell command token-by-token and flags destructive ones (rm -rf /, curl | sudo bash, dd/mkfs/shred to a disk device, chmod -R 777 /) — a safety gate for agentic shell execution.3132 npm5MIT
- AlicenseNot gradedqualityBmaintenanceEnables fully offline, token-free screening of text through a local Laya typed-decision model, exposing prompt-injection/jailbreak detection plus structured choice, score, and yes/no judgments in about 55ms per call. It also reports service status with measured metrics and known limitations.2MIT