Tollgate
A governance-gated MCP server that exposes travel, ops, and finance tools to agents while enforcing policy, approvals, budgets, and audit.
Search flights by origin, destination, and date.
Read calendar events for a given date and query city weather.
Check payee risk scores, with interpretation controlled by the governance layer.
Page on-call engineers using gateway-injected credentials.
Send emails.
Initiate outbound money transfers.
Query ERP invoices and parse unstructured invoice text with per-field confidence scores.
Route every tool call through Tollgate’s enforcement chain: policy denial, human approval, budget escrow/clawback, rate limiting, accountability, injection defenses, and hash-chained audit.
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., "@Tollgate transfer $4,200 to Acme with policy checks, approval, and audit trail"
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.
Tollgate — the governance gate for AI agents that move money
Deterministic policy enforcement, human approvals with cryptographic non-repudiation, budget escrow with clawback, and a tamper-evident audit chain — a zero-dependency governance gateway for any agent that touches money. Exposed to any agent as an MCP server.
Axiom: the LLM is an untrusted component. It proposes; deterministic code disposes. Every tool call an agent makes passes through the gate — and the gate never guesses.
Why
Teams won't give agents spending authority because three questions have no answer: what exactly can it do? who is accountable? can we audit it afterwards? Tollgate answers all three with a single enforcement point that every tool call must cross:
unknown tool → rate limit → circuit breaker → integrity check → read cache
→ accountability → blacklist → budget reserve → field-semantics contract
→ injection fence → financial guardrails → adaptive risk score
→ policy rules (with business-calendar context) → authenticated approval
→ execution → hash-chained auditDenial reasons flow back to the model so it can adapt. Anything that isn't explicitly allowed is denied — and that default is measured, not assumed (see Red team).
Related MCP server: agent-security-gateway
60-second demo
git clone https://github.com/kkU1444/agent-governance-gateway.git && cd agent-governance-gateway
python -m tollgate demo-web # no API key needed
# open http://127.0.0.1:8765 — approve the $4,200 transfer in the browserA travel agent runs a 15-step adversarial scenario: read-only calls pass, external email is blocked, a replayed payment is caught, a negative amount is rejected, an unregistered agent is refused, an unknown payee forces human sign-off, and an over-limit transfer hits a hard cap. Then the ops team freezes and claws back a fraudulent transfer, and the payee lands on a blocklist.
The money lifecycle
Approving a transfer is not the same as money leaving the building:
reserve (atomic, concurrency-safe) → human approval → execution
→ holding period (24h, funds in escrow, reversible)
→ settle | freeze → recover (clawback) → payee blacklist (permanent escalation)Budget pools use BEGIN IMMEDIATE critical sections so concurrent agents see
"occupied", not a stale balance. Clawbacks are two-step (freeze, then
recover), each with operator identity and reason written into the audit
chain.
Security architecture
Threat | Mechanism |
Prompt injection | deterministic fence + pattern guard + canary tokens planted in context (a canary in tool args is proof of hijack → hard deny) |
Semantic misreading ( | field-semantics contract — meaning and thresholds of risk fields are owned by code; upstream risk signals auto-flag payees |
Model hallucination / loops | forced replanning protocol, loop breaker, goal-anchored compaction |
Concurrency / stale state | atomic budget reservation (BEGIN IMMEDIATE) |
Rogue or unattributed agents | accountability registry — no registered owner, no execution; per-agent caps; approver authority levels |
Forged approvals | HMAC or Ed25519 signatures (pure-Python RFC 8032); private keys stay with approvers; |
Tool supply-chain tampering | registration/runtime tool fingerprints vs sealed baseline |
Credential theft | credential broker issues per-call, short-lived scoped credentials; secret scanning masks leaks in args/results |
Audit tampering | SQLite hash chain + |
Resource exhaustion (DoS) | per-agent sliding-window rate limits (money is capped by budget breakers, compute by rate limits) |
Policy files hot-reload on change; every reload lands in the chain as a
policy.reload entry (old hash → new hash), so changes to the law itself
are auditable.
Learning loop: attacks are auto-recorded into an intel base, replayed on
every change (tollgate drill), and live samples merge into the red-team corpus
(tollgate redteam) — real attacks become permanent regression tests.
Red team
$ python -m tollgate redteam
恶意样本拦截: 32/32 (召回率 100%) injection corpus: 32/32 blocked
良性样本误报: 0/8 (误报率 0%) false positives: 0/8
策略不变量模糊测试: 300 例,四条不变量全部成立 300 fuzz cases, all invariants holdFour fuzz invariants: the governance layer never crashes; execution is fail-closed (actual executions ≡ audited executions); the hash chain survives any input sequence; same seed reproduces exactly. THREAT_MODEL.md maps mechanisms to STRIDE, OWASP Agentic AI threats and MITRE ATLAS, and keeps an honest residual-risk list.
MCP server
python -m tollgate mcp # stdio JSON-RPC 2.0, zero dependenciesPoint any MCP client (Claude Desktop, Cursor, your own agent) at it — every
tool call crosses the full enforcement chain. Policy denials come back as
isError tool results with reasons, so the calling model can adapt.
MCP upstream proxy — govern any MCP server
Tollgate is also an MCP client: point it at any third-party MCP server
and it spawns the upstream, pulls tools/list, and registers every tool
under a namespaced prefix (upstream__tool) — each call then crosses the
full enforcement chain, and upstream tools follow the same policy rules as
local ones:
mcp_upstreams:
- name: github
command: ["npx", "-y", "@modelcontextprotocol/server-github"]
allow_tools: ["get_*", "list_*"]
risk: read(A bundled demo upstream ships as python -m tollgate.mcp_demo_upstream;
see the mcp_upstreams section in policies/demo.yaml. A runnable real-world
example — a zero-dependency filesystem MCP server at examples/fs_server.py,
wired read-only allow / write deny — is configured there too: fs_write_file
is rejected fail-closed and never touches the disk.)
To use Tollgate as the governance hub for Claude Desktop (or any MCP client), see docs/claude-desktop.md — one config entry gives every tool call (yours and every upstream's) the full enforcement chain, with the audit hash chain as the receipt.
Install
Python ≥ 3.10, zero mandatory dependencies (a bundled YAML-subset parser is used unless PyYAML is installed):
pip install tollgate-gateway # PyPI (import / CLI name stays `tollgate`)
pip install -e . # or from this repository
tollgate demo # or: python -m tollgate demoCLI surface
Command | Purpose |
| scripted adversarial scenario (terminal / web approvals) |
| approvals console + audit replay UI |
| settlement ledger operations (authenticated) |
| hash-chain check / approval signature check |
| attribution timeline / cross-ledger reconciliation |
| decision rationale / compliance report |
| budget pools / token & latency metering |
| drift regression / adversarial suite / attack replay |
| live agent against any OpenAI-compatible endpoint |
| risk-grade a new tool, draft policy YAML |
| tool fingerprint baseline / Ed25519 keypairs |
Docs
威胁模型 / Threat model — trust boundaries, STRIDE mapping, residual risks
Roadmap
Ed25519 for terminal approvals & settlement ops (web approvals done)
Pluggable storage (Postgres) for multi-instance deployments
Delegation chains (agent acting on behalf of a department)
Policy-change approval workflow (policy as a first-class audited asset)
Contributing & security
See CONTRIBUTING.md. Security issues: follow SECURITY.md — please do not open public issues for vulnerabilities.
License
Available Tools
13 toolsdemo__demo_echoA
[MCP:demo] 原样回显参数(演示只读工具)
Inputs: payload (required).
demo__demo_gated_actionC
[MCP:demo] 受治理的写动作(演示:策略/审批如何作用于上游工具)
Inputs: action (required), amount.
erp_query_invoiceC
从 ERP 查询发票并归一化为规范字段(只读,含重试)
Inputs: invoice_id (required).
fs__fs_list_directoryC
[MCP:fs] List files and directories.
Inputs: path (required).
fs__fs_read_fileC
[MCP:fs] Read the contents of a file.
Inputs: path (required).
get_calendarC
查看某日日程
Inputs: date (required).
get_weatherC
查询城市天气
Inputs: city (required).
page_oncallC
呼叫值班工程师(凭证由网关按次注入,Agent 不可见)
Inputs: message (required).
parse_invoice_textB
从非结构化文本抽取发票要素,带逐字段置信度(只读)
Inputs: text (required).
risk_checkC
查询收款方风险评分(risk_score 越高越危险,解释权在治理层)
Inputs: payee (required).
search_flightsC
搜索航班
Inputs: date (required), origin (required), destination (required).
send_emailD
发送邮件
Inputs: to (required), body (required), subject (required).
transfer_moneyC
向外转账付款
Inputs: to (required), amount (required), currency.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 13 tools
Each tool mostly maps to a distinct resource/action, and the demo/fs namespaces clarify provenance. erp_query_invoice vs parse_invoice_text and risk_check vs transfer_money are related but separable; only the generic demo_gated_action could conceptually overlap with governed writes like send_email or transfer_money.
Most names are snake_case, but prefix conventions are mixed: demo__demo_*, fs__fs_*, erp_query_invoice without a namespace separator, and bare names like get_calendar and send_email. The verb_noun pattern is common but not uniform, with page_oncall and risk_check deviating.
Thirteen tools fit comfortably in a well-scoped range and cover demo governance, filesystem access, ERP invoice lookup, calendar/weather/flights, messaging, payments, and risk checks. No tool appears purely redundant, although the demo tools are scaffolding.
The surface spans many domains but most have only one operation: filesystem has read/list but no write, calendar only get, email only send, and flights only search. This may be acceptable for an illustrative governance gateway, but agents would encounter dead ends for update/delete/read workflows.
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.
MCP server for mandates, delegation, policy-gated execution, credential grants, and audit.
MCP gateway with runtime security policy, tool-call-level control, and audit of agent actions.
Related MCP Servers
- FlicenseNot gradedqualityDmaintenanceAn MCP server that enables AI agents to safely interact with a double-entry payments ledger, enforcing idempotency, policy-based access control, and human-in-the-loop approval for high-value actions.-
- FlicenseNot gradedqualityDmaintenanceMCP server that provides a security gateway for AI agents, enforcing allow/confirm/deny policies on tool calls and requiring human approval for risky operations, with full audit logging.-
- AlicenseNot gradedqualityAmaintenanceDeterministic, auditable payment policy enforcement for AI agents. It provides pre-action authorization with scopes, budgets, allowlists, and signed mandates via an MCP server.MIT
- AlicenseNot gradedqualityBmaintenanceGoverns AI agents' spending by enforcing budgets, approvals, and kill switches before any payment, providing an MCP interface for tool calls with policy checks.377 npmApache 2.0