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 分