MandateGuard

MandateGuard

Deterministic, auditable payment policy enforcement for AI agents. It provides pre-action authorization with scopes, budgets, allowlists, and signed mandates via an MCP server.

Category
访问服务器

README

<!-- mcp-name: io.github.ezequiellich44-cmd/mandateguard -->

MandateGuard

CI MCP Registry License: MIT

Deterministic, auditable payment policy for autonomous AI agents.

MandateGuard is a pre-action enforcement layer that sits between an agent and its tools/wallet. Every tool call that moves money is evaluated by a pure, deterministic engine — budgets, allowlists, denylists, rate limits, and signed mandates — before anything executes. No LLM is ever in the decision path, which is exactly what makes every verdict reproducible and every ledger entry verifiable.

It ships with an MCP server so any agent (Claude, Cursor, or your own harness) can mount it as a guardrail in minutes.


Why

The 2026 agentic-economy reality:

  • OWASP LLM08 — Excessive Agency is one of the top LLM app risks. Agents given wallets are getting drained: the SoK on agentic commerce documents $40M+ in real losses (drain attacks, memory poisoning, tool abuse).
  • Payment standards (Google AP2's Intent/Cart/Payment mandates, Coinbase x402, ERC-8004) define what a mandate is — but none of them ship the enforcement layer that actually blocks an agent mid-flight.
  • Gartner: 40% of enterprise apps will embed agents by end of 2026. Those agents will move money. They need rails.

The market gap: a deterministic (non-LLM) policy engine + audit trail + MCP distribution. That is this repo.

Features

  • Deterministic engine — same inputs, same verdict, always. Auditable by replay, no model sampling in the decision.
  • Per-actor scopes — allowed tools, allowed destinations, per-call max, currency, per-window call limits.
  • Global guards — total budget caps, destination allowlist/denylist.
  • Signed mandates (Ed25519) — short-lived, nonce-bound, issuer-signed authorizations in the AP2 / x402 style. An agent cannot widen its own scope.
  • Tamper-evident ledger — every decision is append-only and SHA-256 chained. Any edit, reorder, or deletion is detected by a linear scan.
  • MCP server — mount as a guardrail; tools for policy, authorize, mandate issuance, and ledger health.
  • Zero deps in the decision pathcryptography only for mandates; the core rules run on the stdlib alone.

Install

# from this repo (works today; also on the official MCP Registry)
git clone https://github.com/ezequiellich44-cmd/MandateGuard.git
cd MandateGuard
python -m pip install -e .

# or directly from the source:
python -m pip install "git+https://github.com/ezequiellich44-cmd/MandateGuard.git"

Note: mandateguard on PyPI is pending Trusted Publisher setup; until then the repo URL is the canonical install path. The MCP bundle is live on the official MCP Registry (io.github.ezequiellich44-cmd/mandateguard), so MCP-aware clients can install it without any Python step.

Quickstart

from mandateguard import Intent, Policy, PolicyEngine, Scope

policy = Policy(
    scopes={
        "wallet-agent": Scope(
            tools=("pay",),
            destinations=("0xGOOD",),
            max_amount=1000,          # per call
            currency="usd",
            max_calls_per_window=5,
        )
    },
    global_max_amount=2000,           # per actor
    allowlist=("0xGOOD",),
    denylist=("0xSCAM",),
)
engine = PolicyEngine(policy)

decision = engine.authorize(
    Intent(tool="pay", destination="0xGOOD", amount=800, actor="wallet-agent")
)
print(decision.status)   # DecisionStatus.APPROVED

Denied calls are blocked with structured reasons; state (spend/rate) commits only on approval, so replays are deterministic.

MCP server

The package ships an installable MCP server entrypoint:

python -m pip install -e ".[mcp]"
mandateguard-mcp            # stdio server, ready for Claude/Cursor/harness

For Claude Code:

claude mcp add mandateguard -- mandateguard-mcp

MandateGuard is published on the official MCP Registry: io.github.ezequiellich44-cmd/mandateguard (version 1.0.0, mcpb bundle, active). MCP-aware clients that sync the registry can discover and install it directly. The bundle ships the same stdio server and 14-tool surface.

Exposed tools: set_scope, set_global_policy, authorize, init_ledger, ledger_status, create_mandate_signer, issue_mandate, check_mandate, activate_license, license_status, reset_state, plus Pro-gated revoke_mandate and persist_state behind a signed Pro license (USDT purchase — see the Buy section).

Mandates

from mandateguard import Mandate, MandateSigner, verify_mandate

issuer = MandateSigner()
m = Mandate(actor="wallet-agent", max_amount=500, currency="usd",
            tools=("pay",), destinations=("0xGOOD",),
            not_before="2026-01-01T00:00:00+00:00",
            not_after="2099-01-01T00:00:00+00:00", nonce="abc", issuer="you")
sig = issuer.sign(m)
verify_mandate(issuer.public_key_bytes, m, sig)   # True

Architecture

See docs/ARCHITECTURE.md for the decision flow and state model, docs/THREAT_MODEL.md for what this does and does not protect against, and docs/LAUNCH.md for the commercial pitch and go-to-market kit.

Agent intent ──> authorize(intent) ──> PolicyEngine
                                          │  scope? allowlist? denylist?
                                          │  budget? rate limit? mandate?
                                          ▼
                                     APPROVED / DENIED / REQUIRES_APPROVAL
                                          │
                                          ▼
                              append-only SHA-256 ledger (audit)

Tests

python -m pytest -q

License

MIT. See LICENSE.

推荐服务器

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 模型以安全和受控的方式获取实时的网络信息。

官方
精选