drift — mandate enforcement for AI agents

io.github.mrpkk由 GitHub 账号 mrpkk 发布v0.1.0更新于 Nov 5, 2026

Block an action a signed mandate does not permit: amount, payee, audience, currency, window, intent.

已验证Streamable HTTP可网页运行金融安全与监控AI 与机器学习

概览

AI 生成的概览

远程 MCP 服务器,在动作发生前按已签署的授权(mandate)检查 AI 智能体拟执行的操作,返回 ALLOW 或 DENY。

可以做什么
  • 对照授权检查单个拟执行操作,返回裁决结果和作出裁决的规则
  • 在一次会话中检查整组或整批操作,返回提交数、允许数、拒绝数、按规则统计的违规和链式指纹
  • 按实际执行顺序列出六条执行规则,并说明每条规则存在的原因
  • 规则覆盖金额、收款方、受众、币种、有效期窗口和意图,默认结果为拒绝
适用场景
当智能体在授权范围内被赋予付款或支出权限,需要在执行前对每个操作加以约束时使用;也可用于向授权被拒的人解释拒绝原因。
运行要求
需要远程 MCP 端点;未声明本地安装、账号、密钥或请求头。README 另提到可用 pip 包自行运行。需要能访问该端点的网络。
安装前请注意
它不验证授权签名、不执行操作、不保存状态;intent 字段来自智能体,属不可信输入,因此只能限制损害范围,不能证明意图。每天 100 次免费检查,超出后按 x402 逐次计费,调用可能产生费用。

安装

在 SourceWeft 中

  1. 打开 控制台中的 drift — mandate enforcement for AI agents,将其添加到工作区。
  2. 为需要使用其工具的对话启用该服务。

Web executable,通过 Streamable HTTP。 远程服务在工作区中配置后即可从网页运行时运行。

交给智能体安装

把这段提示词粘贴到 Claude Code、Codex、Cursor 等智能体,或 SourceWeft 对话中。智能体会读取该服务器的安装指南,先向你展示发布者、端点和登录方式,经你同意后再把它添加到你的客户端。密钥不会写进任何命令。

阅读 https://sourceweft.com/mcp/io.github.mrpkk%2Fdrift/install.md,并按其中说明把这个 MCP 服务器接入我的客户端。修改任何配置之前,先告诉我它的发布者、端点和登录方式,等我确认。不要把 API 密钥写进命令或我会提交的文件;问我密钥应从哪里获取。

查看智能体所依据的安装指南

其他 MCP 客户端

把它添加到你客户端的 mcpServers 配置中。

{
  "mcpServers": {
    "drift-mandate-enforcement-for-ai-agents": {
      "type": "http",
      "url": "https://drift.rta.lat/mcp"
    }
  }
}

README

drift

[M8ven Score] [Listed on mcpservers.org] [mrpkk/drift MCP server]

Continuous mandate enforcement for AI agents. Every action is checked against the signed mandate before it happens, not once at signing.

Live: https://drift.rta.lat · MCP endpoint: https://drift.rta.lat/mcp

pip install drift          # or: pip install -e .python3 -m drift.http_server --http 8080

The gap

An agent is granted a mandate: who to pay, how much, in which currency, until when. AP2 verifies that mandate once, at signature time. After that the agent acts alone, and nothing holds it inside its authority.

Measured proof that this matters, from the AP2 Python SDK itself:

verify_chain documents:  "enforcing expected_aud / expected_nonce on the terminal hop when provided"
but kb_sd_jwt.verify calls verify_expected_claims only when typ in TYP_TERMINAL,and a kb+sd-jwt+kb token — which the SDK itself produces whenever the payloadcarries a cnf — falls into TYP_INTERMEDIATE:
  hop type      : kb+sd-jwt+kb  aud in token  : https://attacker.example/ap2  expected_aud  : https://honest-merchant.example/ap2  ACCEPTED a token with the wrong audience.

The protocol an agent trusts with its spending authority does not check that the authority was not substituted. drift checks it.

What it checks

#rulecatches
1amountover the limit — the most common form of drift
2payeewrong recipient
3audiencepayment redirected to someone else
4currencycurrency substituted
5windowoutside the validity period
6intentintent outside the allowlist

Default is DENY. Rules run in fixed order, so a refusal names the most important reason rather than an incidental one.

MCP tools

toolpurpose
drift_checkcheck one action against a mandate
drift_sessioncheck a sequence, get a report with a chain fingerprint
drift_explainshow the rules in the order they apply

No SSE, no stateful sessions, no HTTP framework. Standard library only.

Example

python
from drift import Mandate, Drift, Action
m = Mandate(    payee_id="shop", audience="https://merchant.example/ap2",    max_amount_minor=10_000, currency="USD",    valid_from=1_700_000_000, valid_until=1_700_086_400,    allowed_intents=("buy",),)d = Drift(m)verdict, rule = d.submit(Action(    intent="buy", payee_id="shop", audience="https://merchant.example/ap2",    amount_minor=99_999, currency="USD", at=1_700_000_060,))print(verdict, rule)   # DENY amount

Limits, stated plainly

  • Does not verify mandate signatures. That is AP2's job. drift runs after signature verification, at the level of decisions.
  • Does not execute. It decides; the caller acts.
  • Does not keep state. A session is an argument. No state means no attack surface and no divergence under replication.
  • Does not tell truth from intent. intent arrives from the agent and is untrusted input. drift bounds the damage; it does not certify the intent.

If an agent controls both intent and amount, it can lie in both. Closing that gap is attest's job: attest proves afterwards, drift bounds beforehand. They are complements.

Use it from your agent

json
{  "mcpServers": {    "drift": { "url": "https://drift.rta.lat/mcp" }  }}

That block is how our own agents call this server. Tools: drift_check (one action), drift_session (a sequence), drift_explain (the six rules and why each exists). 100 free checks per day, then $0.005 per call over x402.

Licence

Apache-2.0.

来源:README.md,提交 83a85c8

工具

3

drift_check

Check one action against a mandate

Check ONE proposed action against a signed agent mandate BEFORE it happens. Returns {"verdict": "ALLOW"|"DENY", "rule": <name>} plus a report with a ledger fingerprint. Six rules run in a fixed order, so a refusal names the most important reason rather than an incidental one: amount, payee, audience, currency, window, intent. Anything unclassified is DENY. Use immediately before any action that spends money, moves a credential or changes state on someone else's behalf. Do NOT use to: verify mandate signatures (AP2 does that, and this server runs after signature verification), execute the action (it only decides), or certify that an intent is truthful — "intent" arrives from the agent and is untrusted input. An agent that lies within its limits still leaves a ledger entry; proving what really happened is attest's job, not this one's. Amounts are integer minor units (cents), never floats. Window bounds are inclusive. Fully idempotent: the same inputs always give the same verdict and the mandate is never mutated.

输入参数action必填mandate必填

drift_session

Check a sequence of actions and fingerprint the ledger

Check a SEQUENCE of proposed actions against one mandate. Returns {submitted, allowed, denied, breach_by_rule, fingerprint}. Use for a whole plan or batch, not a single action — use drift_check for that. The fingerprint is the point: rewriting or reordering any earlier decision changes the hash, so tampering with history becomes visible instead of silent. Do NOT use it to execute the actions, or as evidence of what actually happened. It reports what was PROPOSED against a mandate you supply. Read-only. Idempotent for a fixed action list. Amounts in integer minor units, as in drift_check.

输入参数actions必填mandate必填

drift_explain

Show the enforcement rules in the order they apply

Return the six enforcement rules in the exact order they are applied, each with a plain-language reason it exists. Takes no mandate and no action. Use when a refusal did not make sense, or before explaining a denial to someone whose mandate was rejected. A refusal you cannot explain is one nobody will trust. Do NOT use it to check an action — it performs no check, and cannot predict which rule will fire, only the order they are tried in. Constant output, fully idempotent, opens no files, contacts no host.

无需输入参数。

版本历史

1
  1. v0.1.0最新Oct 15, 2026

评分

已满足适用检查项的 100%

该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。

  • 近 30 天内可连通必需25 分
  • 已声明认证方式必需10 分
  • 已列出工具必需15 分
  • 描述必需15 分
  • 图标10 分
  • 文档15 分
  • 许可证10 分