governed-mcp
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., "@governed-mcp Comment on ticket T-1001 that the refund was processed, and hold it if approval is needed."
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.
governed-mcp
Agents propose, a policy layer enforces. An agent that reads tickets, emails or documents is reading text an attacker can write, and a well-written system prompt is a request, not a control. governed-mcp is an MCP server that sits in front of any other MCP server and decides, outside the model, what each tool call may do: go straight through, wait for a named person to approve it, or be refused. Approvals are claimed once, retries of the same step are recognised as retries, writes carry a step-derived idempotency key downstream, writes can be read back and checked, and every decision lands in a hash-chained audit log.
It is a small, readable reference (about 1,300 lines of Python in the package), extracted from ideas in Liyagent, a governed agent platform. It is not a product and has no production users.
flowchart LR
subgraph app["Claude Agent SDK app"]
C[coordinator] -->|Agent tool| T[triage sub-agent<br/>read tools only]
C -->|Agent tool| E[executor sub-agent<br/>write tools]
end
T -- MCP stdio --> G
E -- MCP stdio --> G
subgraph G["governed-mcp (role: agent)"]
P{policy<br/>allow / require_approval / deny}
K[step key]
V[read-after-write check]
end
P -- allow --> D[(downstream MCP server<br/>fake CRM)]
P -- require_approval --> Q[(approvals<br/>SQLite)]
P -- deny --> X[refused]
H[person: CLI or MCP client<br/>role: approver] -- approve / reject --> Q
Q -- claimed once --> D
D --> V
G -.-> A[(hash-chained<br/>audit log)]Quickstart (2 minutes, no API key)
git clone https://github.com/pavansky/governed-mcp && cd governed-mcp
uv sync
uv run python -m examples.demo # coordinator -> triage -> executor, held write, CLI approval, verified result
uv run python -m evals.run # 6 governance scenarios against the real stack, stub model
uv run pytest -q # unit + integration testsWhat the demo shows: the triage agent reads ticket T-1001, the executor's comment goes straight through (allow), its update_ticket comes back pending_approval and the ticket is untouched, the agent's retry finds the same request instead of making a new one, a person approves with the CLI, the gateway runs the call with the held arguments, reads the ticket back to confirm the change, and the audit chain verifies.
Use it yourself:
uv run governed-mcp -c examples/governed.yaml tools # every downstream tool and its posture
uv run governed-mcp -c examples/governed.yaml serve # agent-facing MCP server on stdio
uv run governed-mcp -c examples/governed.yaml pending
uv run governed-mcp -c examples/governed.yaml approve apr_... --as you --note "looks right"
uv run governed-mcp -c examples/governed.yaml reject apr_... --as you --note "already refunded"
uv run governed-mcp -c examples/governed.yaml audit verify [--anchor <head hash>]With Claude (needs ANTHROPIC_API_KEY):
uv sync --extra agent
uv run python -m examples.agent_app "Triage ticket T-1002 and handle whatever it needs."
uv run python -m evals.run --live # live scenarios; skipped cleanly without a keyThe app uses claude-opus-5-5 with adaptive thinking; --model claude-sonnet-5-5 is the cheaper choice for routine triage.
To put a person's MCP client (Claude Desktop, Claude Code) on the approver side, register governed-mcp -c governed.yaml serve --role approver --as <name> there. That role adds approve and reject; the agent role never has them.
Related MCP server: AgentGuard MCP Server
What is in the repo
Path | What it is |
| YAML policy: glob rules, argument conditions ( |
| SQLite approvals: |
| Idempotency key derived from run, step, tool and canonical arguments |
| Hash-chained audit log; |
| The governor: schema check, policy, hold or execute, key injection, read-after-write check, audit; role-scoped governance tools |
| Stdio MCP server (MCP Python SDK 2.x low-level |
| Fake ticketing/CRM MCP server with read and write tools; honours idempotency keys; can be told to drop writes silently |
| Claude Agent SDK app: coordinator plus |
| The same shape driven by a deterministic stub model, for offline runs |
| Agent Skills: |
| Scenario evals with deterministic outcome checks; offline by default, |
The evals
Every scenario runs the real processes (agent-role gateway, fake CRM, approval CLI) and checks outcomes: what the CRM's records say, what the approvals table and audit chain say. The stub model only chooses tool calls, and in the injection scenario it is deliberately gullible, obeying every instruction it reads in the ticket, so the result depends on the gateway alone.
Scenario | What it proves |
| allowed write goes through; held write changes nothing until approved; approval executes, verifies, and the agent sees the stored result |
| ticket text tells the agent approval is pre-granted; the stub tries |
| four identical calls make one approval; two approvers click at once and one wins; the write is applied once downstream; a retry after approval returns the stored result |
| destructive tool refused, nothing queued, posture visible in the tool listing |
| downstream acknowledges an update it dropped; the read-back check marks the approval |
| a person's rejection, with their reason, is what the agent's retry gets back |
The suite is checked against itself: switching off the role check and the argument check makes prompt_injection fail 4 of its 11 checks.
Live mode runs the same CRM through examples/agent_app.py with Claude and asserts the outcomes that must hold whatever the model does: no unapproved ticket, refund or delete write landed, and the happy path left an update_ticket waiting for a person.
How this maps to an enterprise deployment
Here | In a customer deployment |
| Policy-as-code reviewed like any other change; per-tenant or per-agent policies; owners for each rule |
| Approvals in the tools people already use (Slack, Teams, ServiceNow, Jira), tied to SSO identity, separation of duties (the person who started the agent does not approve its writes) |
SQLite approvals + audit | PostgreSQL with row locks, or a workflow engine; audit head anchored to WORM storage or a SIEM so truncation and rewrites are detectable |
Step keys | The orchestrator's own run and step ids, passed as MCP |
| Reconciliation against the system of record, alerting on drift |
Fake CRM | Jira, ServiceNow, Salesforce, an internal ERP: anything with an MCP server, unchanged |
| Team-specific procedures shipped with the agent so its behaviour matches the policy it runs under |
| Red-team scenarios per customer workflow, run in CI on every policy or prompt change |
Limitations, stated plainly
Single node. SQLite serialises writers, which is what makes claims safe here. Several gateway replicas need a shared database with real row locks.
At-least-once at the edge. If the gateway dies after sending an approved call and before recording the result, the row stays
executing, and resending it is a second delivery. The idempotency key makes that harmless only if the downstream honours it. Many APIs do not, and then it is not harmless.No step id means identical calls collapse. Without a step in
_meta, two deliberately identical writes in one run share a key and the second is treated as a retry of the first. That is the safe direction to be wrong in, but it is a limitation. The live Agent SDK app does not pass a step id, so it relies on this.Tamper-evident, not tamper-proof. Anyone who can write the database can rebuild the chain from a tampered row onward. Anchor
audit headsomewhere they cannot reach.Read-only is the downstream's claim. A tool annotated
readOnlyHint: truegetsread_default. Pin or override tools whose annotations you have not checked (policy-authoringcovers this).Approver authentication is out of scope.
--asrecords a name; it does not prove one. Real deployments put identity in front of the approver channel.Stdio only. The gateway serves stdio. The MCP SDK's streamable HTTP transport would be the next step for a shared deployment.
The offline evals test the enforcement layer, not the model. They show the gateway holds against a model that does the wrong thing. Whether Claude does the right thing (reports the approval id, does not route around a denial) is what
--livemeasures, and that has not been run in CI because it needs a key.
Licence
MIT. All data in the examples is synthetic.
Available Tools
9 toolsadd_commentBIdempotent
[policy: allow] Add an internal comment to a ticket.
Inputs: body (required), ticket_id (required). Returns: object
approval_statusARead-only
Check a held call by its approval_id. Returns its status (pending, executing, done, failed, rejected, expired) and, once done, the downstream result.
Inputs: approval_id (required).
delete_customerBDestructive
[policy: deny] Permanently delete a customer and their tickets.
Inputs: customer_id (required). Returns: object
get_customerCRead-only
[policy: allow] Get a customer record.
Inputs: customer_id (required). Returns: object
get_ticketARead-only
[policy: allow] Get one ticket with its full body and comments.
Inputs: ticket_id (required). Returns: object
issue_refundBIdempotent
[policy: require_approval] Refund an amount to a customer's account balance.
Inputs: amount (required), reason (required), customer_id (required). Returns: object
list_pendingARead-only
List tool calls waiting for a human decision.
Inputs: no named parameters.
search_ticketsARead-only
[policy: allow] Search tickets by text in title/body, optionally filtered by status.
Inputs: query, status. Returns: result
update_ticketAIdempotent
[policy: require_approval] Change a ticket's status (open|in_progress|closed), priority (P1-P4) and/or assignee.
Inputs: ticket_id (required), status, assignee, priority. Returns: object
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 9 tools
Each tool maps to a distinct resource+action: searching vs. fetching tickets, commenting vs. updating status, refunding, and deleting a customer are all clearly separated. The only mild overlap is between list_pending (all held calls) and approval_status (one call by id), but the descriptions make the boundary readable.
Strong, predictable snake_case verb_noun pattern (search_tickets, get_ticket, add_comment, update_ticket, issue_refund, delete_customer). The two approval tools deviate slightly toward noun phrasing (list_pending, approval_status), with approval_status notably lacking a verb.
Nine tools is well within the ideal 3-15 range and each one earns its place across the ticket, customer, and approval-gate surfaces. No tool looks redundant or vestigial.
Read/update/comment/refund/delete are covered, but there is no create_ticket and no customer creation or update, so the lifecycle is not closed. The approval flow also lacks any approve/deny operation, leaving agents to rely on an out-of-band human decision.
Maintenance
Related MCP Connectors
MCP server for your apps' tools and custom tools, plus hosted AI agents and approval-gated workflows
Zero-secret MCP gateway for AI agents: risk-scored, audited calls with human-in-the-loop approval.
Supervised API-write gateway for AI agents with policy, human approval and execution receipts.
One MCP server for all your MCP servers: code mode, per-tool permissions, approvals and audit.
Related MCP Servers
- AlicenseAqualityCmaintenanceSecurity-enforcing MCP proxy that sits between an AI agent and any number of downstream MCP servers, intercepting every tool call through a capability-token policy gateway that can allow, deny, or escalate to human approval before the call reaches any real tool. It also exposes built-in operator tools for approval workflows, audit trail queries, token management, voice/HUD output, and hierarchical2116Apache 2.0
- FlicenseNot gradedqualityDmaintenanceProvides a secure MCP boundary for AI agents, intercepting and validating tool calls, redacting secrets, and requiring human approval for sensitive actions with a tamper-evident audit trail.-
- AlicenseNot gradedqualityCmaintenanceProvides a human-in-the-loop approval gateway for AI agents, enforcing policies and audit logging for MCP-compatible tool calls.Apache 2.0
- AlicenseNot gradedqualityBmaintenanceProvides a governance layer for MCP servers, enforcing policy-based allow/deny/approval rules, requiring human approval for risky calls, and recording an auditable trail of every AI agent tool call.MIT