governance-gateway
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., "@governance-gateway check this message for PII and safety before I send it: 'Email me at jane@example.com'"
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.
governance-gateway
Governance checks that an AI agent runs before it acts, built so they keep up with the agent instead of falling behind it.
Every request gets a format check and a personal-data (PII) scan, which never skip. A safety classifier, which flags toxic text and jailbreak attempts, is the slow, optional check: it runs only if a cheap screen finds the text suspicious and it can still finish before the request's deadline. Under load, a guardrail that checks everything falls behind and its checks finish after the agent has already acted; this one stays on time and never drops the privacy check.
It runs locally as an MCP server, so text never leaves your machine, and works with any MCP client: Claude Desktop, Claude Code, Cursor, VS Code, Gemini CLI and others. In Claude Code an optional hook makes the checks compulsory for every command, file write and web request the agent makes.
Install
With uv nothing needs installing in advance:
uvx governance-gateway --versionOr with pip: pip install governance-gateway, then run governance-gateway.
Python 3.10 or later; the only dependency is the mcp package.
Related MCP server: genpark-jev-system1-subconscious-decision-skill
Add it to your AI tool
Claude Desktop: in claude_desktop_config.json (Settings > Developer > Edit Config):
{
"mcpServers": {
"governance-gateway": { "command": "uvx", "args": ["governance-gateway"] }
}
}Cursor: the same block in ~/.cursor/mcp.json (or .cursor/mcp.json in a project).
Gemini CLI: the same block in ~/.gemini/settings.json.
VS Code (Copilot agent mode): in .vscode/mcp.json:
{
"servers": {
"governance-gateway": { "type": "stdio", "command": "uvx", "args": ["governance-gateway"] }
}
}Claude Code:
claude mcp add governance-gateway -- uvx governance-gatewayIf you installed with pip, use "command": "governance-gateway" and no args.
Tools
Tool | What it does |
| Runs the checks. Returns |
| Requests so far: verdicts, mean and 95th-percentile lag, share on time, share of classifier checks skipped or screened out. |
| The latest decisions: verdict, kinds of personal data found, timing. No text. |
| For a pipeline's deadline, traffic shape, peak-hour factor, detector recall, target and cost share: whether checking everything is enough, adaptive checking is needed, or only more capacity helps. |
| Races "check everything" against the deadline-aware guard on a simulated clock with measured check costs. |
Resources: governance://status and governance://policy (which checks run, which are
mandatory, and how the gateway decides). All tools are read-only.
Make the checks compulsory in Claude Code
An MCP tool is only called when the agent decides to call it. In Claude Code a
PreToolUse hook can run the check before every action instead. The easiest way is the
governance-guard plugin, which adds both the server and the hook:
/plugin marketplace add tanishq-ctrl/governance-gateway
/plugin install governance-guard@governance-gatewayOr add the hook yourself to ~/.claude/settings.json (or a project's
.claude/settings.json):
{
"hooks": {
"PreToolUse": [
{
"matcher": "Bash|Write|Edit|MultiEdit|NotebookEdit|WebFetch",
"hooks": [
{
"type": "command",
"command": "uvx",
"args": ["--from", "governance-gateway", "governance-gateway-hook"],
"timeout": 10,
"onFailure": "block"
}
]
}
]
}
}The hook sends the text of each action (the command, the file content, the URL) to the
running gateway, with a budget of GSL_HOOK_DEADLINE_MS (default 200 ms):
harmful or malformed: the action is refused and the agent is told why;
personal data found: you are asked whether to allow it;
otherwise: nothing changes, and your normal permissions apply.
If the gateway is not running, the hook still runs the personal-data scan itself. If the
check cannot run at all, the action is blocked (set GSL_FAIL_OPEN=1 to allow it
instead). Addresses at GSL_ALLOW_EMAIL_DOMAINS (default anthropic.com, users.noreply.github.com, example.com) are ignored, so commit trailers pass.
Settings
Option | Environment | Default | Meaning |
|
|
| Run the suspicion screen before the classifier |
|
|
| How the classifier's cost is estimated from recent checks |
|
| 1 | Workers serving the queue |
|
| none | Append one JSON line per decision (no text) |
|
| 8737 | Local port for the hook (127.0.0.1 only) |
| Do not open the local port |
What it detects, and what it does not
Personal data: e-mail addresses, telephone numbers and US-style national ID numbers, by pattern. Names, postal addresses and other identifiers are not detected.
Harmful text: a TF-IDF and logistic-regression classifier trained on ToxicChat, real prompts to a public chatbot labelled by people. On held-out ToxicChat messages it catches about 6 in 10 harmful messages with a precision of about 0.78; it is a light first line of defence, not a complete safety system, and it was trained on English.
The screen passes on 95% of harmful messages in validation and sends about 31% of ordinary traffic to the classifier.
Use it alongside, not instead of, your organisation's own data-protection controls.
Background
The gateway comes from an MSc project that measured how far governance checks fall behind fast automated decisions as load grows. Checking everything collapses at full capacity: on real chatbot traffic it stopped meeting its target at 77% of capacity. The deadline rule held to 1.06, and the screen plus the deadline rule to 1.44, while keeping the privacy check on time.
Prabhu, T. S. (2026). Quantifying "Governance Speed Lag" (GSL) in Agentic AI Ecosystems: A simulation-based framework for self-adaptive real-time data compliance. MSc Data Science project, VIT.
Source and issues
https://github.com/tanishq-ctrl/governance-gateway
Licence
Code: MIT. The bundled models and workload data are derived from ToxicChat and are for non-commercial use only (CC BY-NC 4.0); see LICENSE-DATA.md.
Available Tools
5 toolscheck_messageARead-only
Check a text before acting on it: format, personal data (always) and safety (if time allows).
Returns the verdict ('allow', 'redact' or 'block'), the reasons, the redacted text when personal data was found, whether the safety classifier ran, and the timing against the deadline. The original text is never echoed back.
Inputs: text (required), deadline_ms. Returns: object
decision_matrixBRead-only
Which checking policy a pipeline needs at a given mean load (the project's decision matrix).
traffic: 'even', 'random' or 'bursty'. peak_factor: busiest-hour ratio q (1 = steady). recall: the detector's recall with no queue; target: required share caught in time; cost_share: the detector's share of checking cost; load: mean arrivals รท capacity.
Inputs: load, recall, target, traffic, +3 more. Returns: object
governance_statusCRead-only
Requests handled so far: verdicts, lag (mean, p95), share on time, share skipped.
Inputs: no named parameters. Returns: object
recent_decisionsBRead-only
The latest governance decisions, newest last: source, verdict, kinds of personal data found, whether the classifier ran, and timing. The checked text is never included.
Inputs: limit. Returns: result
simulate_loadBRead-only
Race 'check everything' against the deadline-aware guard with measured check costs.
traffic: 'steady', 'rush_hour' or 'real_chatbot' (real WildChat timings). Returns, for each guard, the final lag, harmful messages caught in time, the share of PII checks on time and the share of classifier checks skipped.
Inputs: load, seed, seconds, traffic, +1 more. Returns: object
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelogโฆ
TDQS
Scored across 5 tools
Each tool has a clearly distinct role: check_message performs an actual check, governance_status reports aggregate metrics, decision_matrix recommends a policy by load, simulate_load runs comparative simulations, and recent_decisions lists recent records. The only mild adjacency is between status metrics and recent decisions, but their granularity and use cases are clearly different.
The names mix verb_noun (check_message, simulate_load) with noun_noun or adjective_noun phrases (governance_status, decision_matrix, recent_decisions). It remains readable, but there is no predictable verb-first or resource-first convention across the set.
Five tools is well scoped for a governance gateway: one operational check, one status view, one recent-decisions view, one policy matrix, and one simulation. Each tool has a clear purpose and none feels redundant or excessive.
The surface covers the core lifecycle: checking text, inspecting aggregate and recent outcomes, evaluating policy by load, and simulating alternatives. Minor gaps remain around configuring or updating policies/thresholds and drilling into per-source or per-rule details, but the main workflows are covered.
Maintenance
Related MCP Connectors
Deterministic runtime safety for AI agents: scan PII, gate tool actions, verify LLM output.
Real-time MCP & A2A prompt-injection, jailbreak, and tool-schema poisoning firewall for AI agents.
Real-time prompt injection filtering, MCP payload inspection, and A2A trust scoring.
AgentGuard โ 20-tool AI safety MCP: policy preflight, risk scoring, audit logging, rate limits.
Related MCP Servers
- AlicenseNot gradedqualityCmaintenanceEnables AI agents to operate through a local, signed boundary that blocks prompt injection and secret leakage, verifies outputs, preserves cross-session memory, and provides offline-verifiable receipts. It also exposes 900+ MCP tools for discoverable agent actions.7MIT
- AlicenseNot gradedqualityNot gradedmaintenanceEnables agents to resolve routine typed routing, loop-stall arbitration, and tool safety checks locally instead of invoking a frontier LLM, returning schema-enforced decision outputs and telemetry at sub-millisecond latency. Also provides reversible execution checkpoints, token budgets, and decay-based episodic memory for safe, privacy-preserving autonomous operation.MIT
- AlicenseNot gradedqualityBmaintenanceEnables inspection and governance of enterprise ingested context by classifying security clearance tiers, sanitizing cross-department prompts, and enforcing role-based access boundaries to prevent data leaks. It runs as a zero-dependency MCP server compatible with Claude Desktop, Cursor, and other agent frameworks.7MIT
- AlicenseAqualityAmaintenanceAgent trust & data safety MCP: PII/secret redaction, email validation, sanctions screening, and OSV vulnerability checks for AI agents.2130MIT