safe4_price
Safe4 price
Price and accepted payment networks for one Safe4 decision. Free to call. Returns the same x402 terms the HTTP endpoint advertises, so an agent can see the cost before committing to a paid call.
無需輸入參數。

ai.safe4由 safe4.ai 發布官方發布者v1.0.0更新於 Oct 24, 2026
Tests an AI agent's purchase against the task it was given. Paid per call in USDC via x402.
一個託管型 MCP 伺服器,用來檢驗 AI 代理擬進行的付款是否符合其被交付的任務,並回傳允許或拒絕的決定。
Web executable,透過 Streamable HTTP。 遠端服務在工作區中設定後即可從網頁執行環境執行。
把這段提示詞貼上到 Claude Code、Codex、Cursor 等代理程式,或 SourceWeft 對話中。代理程式會讀取該伺服器的安裝指南,先向你展示發布者、端點和登入方式,經你同意後再把它新增到你的客戶端。金鑰不會寫進任何命令。
閱讀 https://sourceweft.com/mcp/ai.safe4%2Fsafe4/install.md,並按其中說明把這個 MCP 伺服器接入我的客戶端。修改任何設定之前,先告訴我它的發布者、端點和登入方式,等我確認。不要把 API 金鑰寫進命令或我會提交的檔案;問我金鑰應從哪裡取得。把它新增到你客戶端的 mcpServers 設定中。
{
"mcpServers": {
"safe4": {
"type": "http",
"url": "https://api.safe4.ai/mcp/"
}
}
}Safe4 decides whether an AI agent's proposed payment should be allowed, by testing the purchase against the task the agent was actually given.
The case it exists for is the one budget limits miss: a payment that is inside every budget, in an allowed category, and to an approved counterparty — and is still the wrong purchase, because it does not serve the task.
This repository is the public manifest and client example for the hosted MCP
server. The service itself runs at api.safe4.ai; there is no server to
install.
Streamable HTTP, no installation:
Connecting and listing tools are free. Only safe4_authorize is paid.
safe4_price — freeReturns the current price and the payment networks the endpoint accepts, so an agent can see the cost before committing to a paid call.
safe4_authorize — paid, settled per call in USDC over x402Returns an ALLOW or DENY decision for a proposed payment, with a reason
code, the concepts it matched, and a hash-chained audit entry.
Called without a payment it returns the x402 challenge instead of a decision.
An x402-aware client pays and calls again with the resulting payload in the
payment argument.
Arguments:
The task and the two allow-lists are the principal's constraints, not the
agent's — they are what the purchase is tested against, so an agent that writes
its own task is grading its own homework. Safe4 records every field it was
given and marks the task context as request-supplied, so a substituted
constraint is visible in the audit entry afterwards.
The example runs the entire free surface — connect, list tools, read the price,
fetch the challenge — and stops before signing anything. It needs only httpx:
no key, no funded wallet.
Drop --dry-run and set SAFE4_BUYER_PRIVATE_KEY to buy a real decision. That
signs an EIP-3009 authorisation for exactly the amount and payee the server
advertised, and nothing else; the script holds no custody and Safe4 never sees
the key.
Four checks, in order, and a purchase must clear all of them:
allowed_counterparties, payment
to anyone else is refused. This is the only check that sees a swapped payee;
task text and category are identical in that attack.Every decision is appended to a hash-chained audit log. Each entry carries the previous entry's hash, so the record is tamper-evident and continuous across restarts and redeploys.
Priced per call in USDC over x402. The endpoint advertises
its terms in the 402 challenge; buyers pay on whichever advertised network
suits them. Safe4 holds no wallet key and takes no custody of buyer funds.
Reporting instructions are in SECURITY.md. Please do not open a public issue containing exploit details.
The manifest and client examples in this repository are MIT licensed. The hosted service they describe is a separate commercial product.
來源:README.md,提交 21c0542
Safe4 price
Price and accepted payment networks for one Safe4 decision. Free to call. Returns the same x402 terms the HTTP endpoint advertises, so an agent can see the cost before committing to a paid call.
無需輸入參數。
Safe4 authorize
Decide whether a proposed agent payment should proceed. Settled per call in USDC over x402. Called without ``payment`` it returns the price list rather than a decision; call it again with the signed payload to receive one. The task and the two allow-lists are the principal's constraints, not the agent's: they are what the purchase is tested against, so an agent that writes its own ``task`` is grading its own homework. Safe4 records every field it was given in the audit entry and marks the task context as request-supplied, so a substituted constraint is visible afterwards. Args: task: The task the agent was given, as stated by its principal. purchase: What is being bought. purchase_purpose: Why this purchase serves the task. amount: Decimal amount as a string, for example "25.00". currency: Currency of the proposed payment, for example "USDC". counterparty: Who would receive the payment. service_category: Category of the thing being bought. allowed_service_categories: Categories the principal permits. allowed_counterparties: Optional payees the principal permits. When supplied, payment to anyone else is denied. task_id: Optional caller-side task identifier, echoed into the audit. payment: An x402 payment payload for this call. Omit to receive the price list instead of a decision.
task必填amount必填paymenttask_idcurrency必填purchase必填counterparty必填purchase_purpose必填service_category必填allowed_counterpartiesallowed_service_categories必填已滿足適用檢查項的 100%
該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。
{ "mcpServers": { "safe4": { "type": "http", "url": "https://api.safe4.ai/mcp/" } }}python examples/mcp_buyer_demo.py https://api.safe4.ai --dry-run