agentic-governance-gateway
An MCP server that provides a governance layer for coding agents, enforcing policies, validation, and human-in-the-loop for tool calls without requiring an API key.
README
Agentic Governance Gateway
An open-source governance layer that sits between coding agents and your systems. Policies, provenance, validation and human-in-the-loop — without an API key.
Why does this exist?
Agentic coding tools (Claude Code, Cursor, Copilot, …) generate code faster than humans can review it. The 2026 industry reports agree on one thing: governance is the bottleneck, not code generation.
- 92 % of enterprises report governance challenges with AI-generated code.
- 82 % had at least one production incident caused by AI-generated code in the last six months.
- 60 % deploy untested AI-generated code.
- 43 % cannot reliably tell whether code was written by a human or an agent.
agentic-governance-gateway is a small, framework-agnostic control plane
that sits in front of any tool an agent wants to call. Every action flows
through one canonical pipeline:
AgentAction
→ Budget check (cost estimation, daily/monthly caps)
→ Policy evaluation (OPA/Rego when available, JS fallback otherwise)
→ Validation (pluggable checkers: semgrep, npm test, checkov, …)
→ Human-in-the-loop (review for sensitive actions, hash-verified execution)
→ Execution (injected tool executor)
→ Audit + provenance (W3C PROV-O records, immutable trail)
Features
- Policy-as-code with OPA/Rego, plus a TypeScript fallback so the gateway works with zero external dependencies.
- Traceability with W3C PROV-O provenance and an in-memory or SQL store.
- Validation orchestration with pluggable checkers (StaticChecker and ScriptChecker ship out of the box).
- Human-in-the-loop with hash-verified execution: the action the human approved is the action that runs, or it is denied.
- Budget & cost control with per-agent daily/monthly caps.
- MCP server that drops into Claude Code, Cursor and any MCP-compatible client — no API key required.
- REST API for non-MCP clients.
- CLI for ad-hoc policy checks from the terminal.
Quick start
npm install
npm run build
npm test # unit + integration + rego tests
npm run test:e2e # MCP handler end-to-end tests
Run the CLI:
node dist/cli/index.js policies # list built-in rules
node dist/cli/index.js status # show active evaluator
node dist/cli/index.js evaluate \
--tool write_file \
--params '{"path":"prod/secrets.yml"}' \
--prompt "rotate the password"
# → decision: require_review / deny / allow
Connecting an MCP client
~/.cursor/mcp.json (Cursor) or the equivalent for Claude Code:
{
"mcpServers": {
"agentic-governance-gateway": {
"command": "node",
"args": ["/absolute/path/to/dist/mcp/main.js"]
}
}
}
The gateway then exposes three tools to the agent:
| Tool | Purpose |
|---|---|
governed_tool_call |
Submit a tool call through the governance pipeline |
governance_status |
Report evaluator + budget snapshot |
governance_audit_lookup |
Fetch an audit record by action id |
Agents are expected to call governed_tool_call instead of touching files,
git or shell commands directly.
Testing without an API key
The project is explicitly designed to be developed and tested with no Claude/OpenAI account:
- The policy engine has a pure TypeScript evaluator (
JsPolicyEvaluator) that mirrors the Rego policies exactly — no LLM involved. - The MCP server is exercised end-to-end via a fake in-process server in
tests/e2e/mcp-handlers.test.ts. - Rego policies are unit-tested with
opa test policies/(the CI job installs OPA automatically). - A cross-implementation parity test (
tests/integration/policy-parity.test.ts) verifies the TS and Rego evaluators agree on a shared set of inputs. It is skipped automatically whenopais not on PATH. - For full agent loops, point the gateway at a local Ollama model
(
model: "llama3:70b") — cost estimation returns 0 and no external API is called.
Project layout
agentic-governance-gateway/
├── src/
│ ├── core/
│ │ ├── policy-engine/ OPA + JS evaluator, rules
│ │ ├── traceability/ Audit store, PROV-O provenance
│ │ ├── validation/ Pluggable checkers + orchestrator
│ │ ├── hitl/ Human-in-the-loop gateway
│ │ ├── budget/ Cost controller
│ │ ├── gateway.ts Canonical pipeline façade
│ │ ├── config.ts
│ │ └── logger.ts
│ ├── mcp/ MCP server + entrypoint
│ ├── api/ REST API
│ ├── cli/ CLI
│ └── types/ Shared TypeScript types
├── policies/ Rego policies + tests
├── tests/
│ ├── unit/ Per-module unit tests
│ ├── integration/ Gateway + parity tests
│ └── e2e/ MCP handler tests
├── docs/ Architecture + ADRs
├── examples/ Runnable example policies & configs
├── Dockerfile
├── docker-compose.yml
└── .github/workflows/ci.yml
Architecture
See docs/architecture.md for the full design and docs/decisions/ for the ADRs that explain the trade-offs (OPA optional, in-memory vs SQL stores, MCP vs REST, …).
License
MIT — see LICENSE.
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。