MandateGuard
MandateGuard
自律型AIエージェントのための決定的・監査可能な支払いポリシー。
MandateGuardは、エージェントとそのツール/ウォレットの間に位置する、アクション実行前の強制レイヤーです。資金を移動させるすべてのツール呼び出しは、何かが実行される前に、純粋で決定的なエンジン(予算、許可リスト、拒否リスト、レート制限、署名付きマンデート)によって評価されます。決定経路にLLMが介在することは決してありません。それがまさに、すべての判定を再現可能にし、すべての台帳エントリを検証可能にする理由です。
MCPサーバーが同梱されているため、任意のエージェント(Claude、Cursor、独自のハーネス)が数分でこれをガードレールとして組み込めます。
なぜ
2026年のエージェンティック経済の現実:
OWASP LLM08 — Excessive Agency(過剰なエージェンシー) は、LLMアプリの主要リスクの1つです。ウォレットを与えられたエージェントが資金を搾取されています。エージェンティックコマースに関するSoKは、4,000万ドル超の実損(不正送金攻撃、メモリポイズニング、ツール悪用)を記録しています。
支払い標準(Google AP2 のIntent/Cart/Paymentマンデート、Coinbase x402、ERC-8004)はマンデートが何であるかを定義していますが、実行中のエージェントを実際にブロックする強制レイヤーを同梱しているものはありません。
Gartner:2026年末までに企業アプリの40% がエージェントを組み込むでしょう。それらのエージェントは資金を移動します。彼らには決済レールが必要です。
市場のギャップ:決定的な(非LLM)ポリシーエンジン + 監査証跡 + MCP配布。それがこのリポジトリです。
Related MCP server: gov-mcp
機能
決定的エンジン — 同じ入力には常に同じ判定。リプレイによる監査が可能で、決定にモデルのサンプリングはありません。
アクターごとのスコープ — 許可されたツール、許可された送信先、呼び出しごとの上限、通貨、ウィンドウごとの呼び出し回数制限。
グローバルガード — 総予算の上限、送信先の許可リスト/拒否リスト。
署名付きマンデート(Ed25519) — AP2 / x402スタイルの、短期間有効・ナンスに紐づく・発行者署名付きの認可。エージェントは自身のスコープを広げることはできません。
改ざん検出可能な台帳 — すべての決定は追記専用で、SHA-256チェーンで連結されます。編集、並べ替え、削除はいずれも線形スキャンで検出されます。
MCPサーバー — ガードレールとして組み込み可能。ポリシー、承認、マンデート発行、台帳ヘルスのためのツールを提供します。
決定経路にゼロ依存 —
cryptographyはマンデート専用。コアルールは標準ライブラリだけで実行されます。
インストール
# 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"注:PyPI上の
mandateguardはTrusted Publisherの設定待ちです。それまでは、リポジトリURLが正規のインストールパスです。MCPバンドルは公式のMCP Registry(io.github.ezequiellich44-cmd/mandateguard)で公開されているため、MCP対応クライアントはPythonの手順なしでインストールできます。
クイックスタート
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拒否された呼び出しは構造化された理由とともにブロックされます。状態(支出/レート)は承認時のみコミットされるため、リプレイは決定的です。
MCPサーバー
このパッケージには、インストール可能なMCPサーバーのエントリポイントが同梱されています:
python -m pip install -e ".[mcp]"
mandateguard-mcp # stdio server, ready for Claude/Cursor/harnessClaude Codeの場合:
claude mcp add mandateguard -- mandateguard-mcpMandateGuardは公式のMCP Registryに公開されています:io.github.ezequiellich44-cmd/mandateguard(バージョン1.0.0、mcpb バンドル、アクティブ)。レジストリを同期するMCP対応クライアントは、これを直接検出してインストールできます。このバンドルには、同じstdioサーバーと14ツールのインターフェースが同梱されています。
公開ツール:set_scope、set_global_policy、authorize、init_ledger、ledger_status、create_mandate_signer、issue_mandate、check_mandate、activate_license、license_status、reset_state、さらに署名付きProライセンス(USDT購入 — Buyセクション を参照)を必要とするPro限定の revoke_mandate と persist_state。
マンデート
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アーキテクチャ
決定フローと状態モデルについては docs/ARCHITECTURE.md を、これが保護する対象と保護しない対象については docs/THREAT_MODEL.md を、商用ピッチとゴーツーマーケットキットについては docs/LAUNCH.md を参照してください。
Agent intent ──> authorize(intent) ──> PolicyEngine
│ scope? allowlist? denylist?
│ budget? rate limit? mandate?
▼
APPROVED / DENIED / REQUIRES_APPROVAL
│
▼
append-only SHA-256 ledger (audit)テスト
python -m pytest -qライセンス
MIT。 LICENSE を参照してください。
This server cannot be deployed
Maintenance
Related MCP Connectors
Agent-native MCP for governed commerce, x402 payments, paid capabilities, and verifiable receipts.
Compliance MCP for AI agents: sanctions & KYT screening on 50+ chains, stablecoin-freeze, oracle.
Pre-spend firewall for AI agents. Approves, blocks, flags transactions against policy rules.
Zero-secret MCP gateway for AI agents: risk-scored, audited calls with human-in-the-loop approval.
Related MCP Servers
- AlicenseNot gradedqualityCmaintenanceBudget & cost control for AI agents: hard per-agent spend caps, rate limits, idempotency, and human-in-the-loop approval — enforced before each LLM call, not after the invoice. One hosted MCP endpoint (no proxy or self-hosting), settled via x402 (USDC on Base).MIT
- AlicenseNot gradedqualityCmaintenanceAn MCP server that enforces runtime governance on AI agent actions — file access, command execution, delegation chains, and permission escalation.MIT
- AlicenseNot gradedqualityDmaintenanceMCP server that enables AI agents to propose USDC payments on the Soroban blockchain with deterministic policy enforcement and injection protection, while providing payment status and attestation tools.MIT
- FlicenseNot gradedqualityBmaintenanceAn 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.-