gov-mcp

gov-mcp

An MCP server that enforces runtime governance on AI agent actions — file access, command execution, delegation chains, and permission escalation.

Category
访问服务器

README

gov-mcp

Governed execution for any AI agent framework. Install in 30 seconds. Works with Claude Code, OpenClaw, and any MCP-compatible client.

pip install gov-mcp
gov-mcp install

An MCP server that enforces runtime governance on AI agent actions — file access, command execution, delegation chains, and permission escalation. Built on the Y*gov governance kernel.

Why

AI agents can read files, run commands, and call APIs. Without governance, a single prompt injection or misaligned sub-agent can rm -rf /, leak .env secrets, or escalate privileges.

gov-mcp sits between the agent and the system. Every action is checked against a governance contract before execution. Deterministic commands are auto-executed inline — no second tool call needed.

Performance (EXP-008)

Metric Without gov-mcp With gov-mcp Delta
Output tokens 6,107 3,352 -45.1%
Wall time 171.1s 65.8s -61.5%
Throughput 39,000+ checks/s
Concurrent agents 50 agents, zero deadlock
False positives 0 0 0

Security (SIM-001 tested): 50 concurrent agents, 1,000 checks, zero data leaks across isolated tenants.

Compliance: FINRA audit trail (3/4 requirements met), EU AI Act Article 14 compatible (3/5 met out of box, remaining 2 partial with clear upgrade path).

Limitations (Honest Assessment)

  • Per-event auto-hash: Implemented in v0.1.0 via governance envelope chain
  • Confidence score: Included in every governance response (1.0 deterministic, 0.95 auto-routed)
  • Multi-currency amount parsing: Supported ($, ¥, €, £, USD/EUR/CNY prefix, comma separators)
  • Per-client encryption keys: Not yet available (roadmap for legal vertical)
  • COSO/ISO report templates: Not yet available (roadmap for enterprise compliance)
  • Non-MCP ERP integration: Requires custom adapter (no native SAP/Oracle bridge)

Quick Start

1. Install

pip install gov-mcp

2. Write your governance contract

Create AGENTS.md:

## Agent: my-agent
## Prohibited: rm -rf, sudo, .env files, /etc access
## Permitted: file read/write, shell commands

3. One-command install

gov-mcp install

This will:

  1. Detect your environment (Claude Code, Cursor, Windsurf, OpenClaw)
  2. Start the GOV MCP server (background, auto port selection)
  3. Auto-configure detected clients
  4. Verify the connection
  5. Print a summary with next steps

4. Management commands

gov-mcp status     # Check if server is running
gov-mcp restart    # Restart with fresh config
gov-mcp uninstall  # Stop server, remove all configs

5. Manual setup (alternative)

If you prefer manual configuration:

# Start server directly
python -m gov_mcp --agents-md ./AGENTS.md --transport sse --port 7922

Connect from any MCP client:

{
  "mcpServers": {
    "gov-mcp": {
      "url": "http://127.0.0.1:7922/sse",
      "transport": "sse"
    }
  }
}

Tools (38)

Core Enforcement

Tool Description
gov_check Check action + auto-execute deterministic commands. Single entry point.
gov_enforce Full pipeline: check + obligation scan + delegation verify.
gov_exec [DEPRECATED] Use gov_check instead. Redirects with migration guide.

Delegation & Escalation

Tool Description
gov_delegate Register parent-child delegation with monotonicity validation.
gov_escalate Request permission expansion from principal. CIEU audit trail.
gov_chain_reset Clear stale delegation links (selective or full reset).

Contract Management

Tool Description
gov_contract_load Translate AGENTS.md into draft contract.
gov_contract_validate Validate draft contract coverage and health.
gov_contract_activate Activate validated contract for enforcement.

Audit & Observability

Tool Description
gov_report CIEU summary: decisions, deny rate, top violations.
gov_verify SHA-256 Merkle chain integrity verification.
gov_obligations Query obligation status from OmissionEngine.
gov_doctor Full 14-layer health check (contract, CIEU, obligations, heartbeat, hooks).
gov_benchmark Token savings benchmark: Mode A vs Mode B vs Mode C.
gov_seal Seal CIEU session with Merkle root for tamper-evident preservation.
gov_audit Causal audit report with violation replay for compliance evidence.
gov_trend 7-day CIEU event trend analysis with deny rate direction.

Governance Analysis

Tool Description
gov_baseline Snapshot current governance state for later comparison.
gov_delta Compare current state against saved baseline.
gov_coverage Detect agent governance blind spots.
gov_quality Contract quality scoring (8 dimensions).
gov_simulate A/B simulation: intercept rate, false positive rate, risk reduction.
gov_impact Predict contract change effects via CIEU replay.
gov_check_impact Convenience wrapper for gov_impact with explicit params.
gov_pretrain Learn contract improvements from historical CIEU data.

User Experience

Tool Description
gov_demo Zero-config 5-scenario governance demo.
gov_init Generate AGENTS.md template (python/node/go/generic).
gov_version Version info (gov-mcp + ystar-gov + python).
gov_policy_builder Contract data for UI rendering.
gov_reset_breaker Reset circuit breaker after manual intervention.

Domain & Data

Tool Description
gov_archive Hot/cold CIEU data tiering.
gov_domain_list List registered governance domain packs.
gov_domain_describe Domain pack details and vocabulary.
gov_domain_init Generate custom domain pack template.

How It Works

Agent proposes action
    |
    v
gov_check(agent_id, tool_name, params)
    |
    +-- Is agent delegated? --> Use delegated contract
    |   (otherwise)         --> Use global contract
    |
    +-- Contract check: ALLOW or DENY
    |
    +-- If ALLOW + deterministic Bash command:
    |   Execute inline, return stdout in response
    |   { "decision": "ALLOW", "auto_executed": true, "stdout": "..." }
    |
    +-- If ALLOW + non-deterministic:
    |   Return ALLOW only (agent handles execution)
    |
    +-- If DENY:
        Return DENY with violation details

Auto-Execution

Deterministic commands (ls, git status, cat, pwd, etc.) are classified by the structural router and executed inline within gov_check. The agent receives stdout/stderr in the same response — no second tool call needed.

This saves 22% tokens and eliminates one LLM round-trip per safe command. 66.7% of typical Bash commands are auto-executed (based on stress testing).

Governance Extension Layer

Every gov_check response includes a governance field — a structured audit envelope that rides on top of the MCP protocol:

{
  "decision": "ALLOW",
  "auto_executed": true,
  "stdout": "...",
  "governance": {
    "cieu_seq": 17753,
    "contract_hash": "sha256:b6e47016...",
    "contract_version": "1.0",
    "latency_ms": 1.9,
    "host": "claude_code"
  }
}
Field Description
cieu_seq Monotonic sequence number — total governance decisions made
contract_hash SHA-256 of the active governance contract
contract_version Contract name/version string
latency_ms Governance check latency (sub-2ms typical)
host Detected client ecosystem

This is backward compatible — callers that don't inspect governance are unaffected. The field enables audit trails, compliance reporting, and contract versioning across multi-agent deployments.

A2A Integration (Coming Soon)

Y*gov is designed as the governance layer for A2A (Agent-to-Agent) ecosystems. Every agent-to-agent communication can be audited, controlled, and proven compliant with CIEU five-tuple records.

Roadmap:

  • Phase 1 (Current): GOV MCP — governance for MCP tool calls (33 tools, 100% coverage)
  • Phase 2 (2026 Q3): GOV A2A — governance layer for the A2A protocol
  • Phase 3 (2026 Q4): Gov Pipeline — end-to-end multi-agent workflow governance

License

MIT

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选