AgentGate MCP server
Commit Nov 1, 2026Enforces a deterministic execution boundary and cryptographic audit ledger for LLM tool calls through schema validation and human-in-the-loop approval.
Also known as kmlyz/agentgate
- Stars
- 0
- Tools
- —
- Downloads, 30 days
- —
- Latest version
- —
- Last commit
- Nov 1, 2026
- License
- Apache-2.0
What is AgentGate MCP?
AgentGate enforces a deterministic execution boundary and cryptographic audit ledger for LLM tool calls through schema validation and human-in-the-loop approval.
Summary generated from the project's README
About AgentGate MCP server
Securing autonomous agent actions through a deterministic execution boundary is the primary function of agentgate. It acts as a protective layer between large language models and mutable systems by intercepting tool calls at runtime to enforce strict schema validation. This setup is designed for developers building agents that require high-security guarantees, such as those performing Git operations or SQL commands.
Users interact with the system through a split architecture where the agent MCP server only possesses staging and read-only tools, while administrative actions are isolated to an operator MCP or a CLI. When a sensitive mutation is requested, the system moves the request into a PENDING_APPROVAL state. A human operator must then use the gate CLI to list proposals, approve them to receive a one-time HMAC-SHA256 token, and finally execute the proposal.
Security is maintained through cryptographic verification of payload digests and environmental state fingerprints to prevent parameter tampering or state drift. The system also utilizes sqlglot for AST SQL inspection to block comment injection and tautological filters. All lifecycle states are recorded in a SHA-256 hash-chained audit ledger.
What you can do with it
- 1Auditing the entire agent lifecycleSecurity teams can review a complete, tamper-proof history of every proposal created, approved, and executed.
Written from the project's README. Every use case is checked against a quote from it.
README
View on GitHubAgentGate
Deterministic execution boundary and cryptographic audit ledger for LLM tool calls.
Overview
AgentGate provides a deterministic execution boundary between autonomous agents and mutable systems. It intercepts LLM tool calls at runtime, enforces strict schema validation, stages sensitive mutations into an out-of-band PENDING_APPROVAL state, and verifies cryptographic authorization tokens before execution.
Quickstart
from agentgate.guardrails.adapters.git import CommitProposal, CommitType
from agentgate.runtime import RuntimeGuardrailToolCallback
callback = RuntimeGuardrailToolCallback()
# Intercept runtime tool call via Google ADK callback
receipt = callback.intercept_runtime_tool_call(
tool="propose_commit",
args={
"branch": "main",
"commit_type": CommitType.FEAT,
"scope": "core",
"short_summary": "add execution gate",
},
)
# Returns:
# {
# "status": "pending_approval",
# "proposal_id": "prop_a1b2c3d4",
# "staged_receipt_id": "rcpt_prop_a1b2c3d4",
# "state_fingerprint": "...",
# "message": "PROPOSAL SUBMITTED: ... Staged out-of-band for human operator approval."
# }
CLI Workflow
Operator review, token issuance, and execution:
# List staged proposals
gate list
# Operator approves proposal out-of-band (returns signed approval token)
gate approve prop_a1b2c3d4
# Execute proposal using the one-time cryptographic token
gate execute prop_a1b2c3d4 --token <approval_token>
Architecture & Security Invariants
- Physical Role Separation: The agent MCP server (
agent_mcp) physically excludes approval and execution tools from its manifest (tools/listcontains only staging and read-only tools; unexpected calls returnUnknown toolorE_PERM). Administrative controls are isolated tooperator_mcpand the CLI. - Cryptographic Approval Tokens: Operator approval generates a one-time HMAC-SHA256 token binding
proposal_id,payload_sha256,state_fingerprint, andnoncewith a 30-minute TTL. - TOCTOU & State Drift Immunity: Environmental state fingerprints (
git rev-parse HEADand working tree status) are captured at staging. Environment mismatches detected at execution abort withE_STATE_DRIFT. - Parameter Tampering Protection: Payload digests are cryptographically verified at execution; modified payloads abort with
E_PAYLOAD_TAMPERED. - AST SQL Inspection (
sqlglot): Multi-dialect AST parsing blocks comment injection (--\nDROP), tautological filters (WHERE 1=1,WHERE TRUE,WHERE 'a'='a'), and indirect execution (CALL,EXECUTE IMMEDIATE). - Blast-Radius Risk Tiering:
- Tier 0 (Unconstrained): Read-only inspections, diffs, and test runs. Allowed to execute directly.
- Tier 1 (Reversible): Atomic local file edits with pre-flight rollback checkpoints.
- Tier 2 (Hard Gate): Irreversible Git operations (
push -f, branch deletions), SQL DDL (DROP,ALTER,TRUNCATE), and unconstrained DML requiring signed human approval.
- Hash-Chained Audit Ledger: SHA-256 blocks tracking all proposal lifecycle states (
proposal_created,operator_approved,mutation_executed).
Ecosystem & Integrations
- Google Agent Development Kit (ADK): Interception via
before_tool_callback. - Model Context Protocol (MCP): FastMCP server with separated
agentandoperatortransport profiles. - Pydantic: Parameter validation via
extra="forbid"models and deterministic field constraints. - sqlglot: Multi-dialect SQL AST parser and tautology analyzer.
Verification
The test suite covers schema validation, cryptographic token lifecycle, adversarial SQL injections, and role isolation:
uv run ruff check .
uv run python -m pytest
Status: 281 passing tests, zero linter warnings.
AgentGate Pro
For Slack interactive Block Kit dispatchers (HMAC-SHA256 verified) and Cloud Run deployment scaffolding (Terraform / Dockerfile), see agentgate-pro.
AgentGate MCP questions
How does AgentGate handle sensitive mutations?
Sensitive mutations are staged into an out-of-band PENDING_APPROVAL state that requires human operator approval and a cryptographic token for execution.
How does the system prevent SQL injection attacks?
It uses AST SQL inspection via sqlglot to block comment injection, tautological filters, and indirect execution attempts.
What happens if the environment changes between approval and execution?
The system captures environmental state fingerprints at staging and will abort execution with an E_STATE_DRIFT error if a mismatch is detected.
Can the agent bypass the approval process for all tools?
No, the agent MCP server physically excludes approval and execution tools from its manifest, isolating administrative controls to the operator MCP and CLI.